no_pubkey apt-get update
I just installed a virtual machine using Ubuntu linux and got NO_PUBKEY error messages when tried to update my Ubuntu installation using "apt-get update" command. To fix this you'll need to install some gpg key:
gpg --keyserver wwwkeys.eu.pgp.net --recv 9AA38DCD55BE302B gpg --export --armor 9AA38DCD55BE302B | apt-key add -
Is it Time to Move to Linux?
Recently I'm installing Linux Ubuntu on a PC and quite impressed with their developments. Linux Ubuntu becoming more and more user friendly for me (although for average PC users will still quite difficult to use Linux).
With my current needs of computing and work which is almost all of it is web based, such as chat with my abroad collegues, checking emails, social networking, blogging, web administration, server administration, etc. I started to feel that the need of Microsoft Windows is less demanding.
Changing /tmp Partition Size on CPanel Server
Today one of my server have its /tmp partition is full and causing problems such as failed MySQL database query or Fantastico stop working because they can't write temporary file. Here is the solution I found on CPanel's forum:
lsof /tmpThen umount /tmp and /var/tmp:
umount -l /tmp umount -l /var/tmp
Then remove the old partition file:
rm -fv /usr/tmpDSK
Then create a new one:
/scripts/securetmp
Xen VPS can’t initialize iptables table ‘filter’
If you using HyperVM and get this error message after upgrading your dom0's Xen kernel:
iptables v1.2.11: can't initialize iptables table `filter': iptables who? (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.
It means that the library for the kernel is not copied yet to the VM. To fix this simply copy the new kernel library from /lib/modules/<new kernel> to VM's /lib/modules directory then restart the VM.
Recursive chmod for files or directories only
To do a recursive chmod to directories only you can run:
find . -type d -exec chmod 755 {} \;
And for files only:
find . -type f -exec chmod 644 {} \;
Delete Files Older Than n Days
In Linux system you can delete old unused files (usually the session files in /tmp) all at once by running this command:
find /path/to/files* -mtime +5 -exec rm {} \;
this command will delete files which is 5 days old, if you want to change the number of days to 3 days old, then you have to change +5 to +3 and run the command again.
Meaning of /dev/null 2>&1 in Crontab’s Cron Job
If you use cron job on Linux, some times you want to ignore the output of the command you executed. This can be done by adding “> /dev/null 2>&1” behind the cron job command.
The command is just work want it should be, but I always curious with what does 2>&1 means. The “> /dev/null” is pretty obvious of what it does without much more explanation, it just redirect all the output to /dev/null which in Linux means we don’t care with the output (or sort of, it’s my own definition).
Xen VPS “4gb seg fix up” Problem
It's a known issues on Xen based Virtual Private Server (VPS) that often it shows "4gb seg fix up" error messages. After a few search I found this command to fix it.
Run the commands below on DomU
First try disabling tls by renaming it to tls.disabled:
mv /lib/tls /lib/tls.disabled
mv /usr/lib/tls /usr/lib/tls.disabledIf this doesn't work then try this command:
echo 'hwcap 0 nosegneg' > /etc/ld.so.conf.d/libc6-xen.conf && ldconfigafter that you'll need to restart the VPS