Saturday, October 8, 2011

Ubuntu Server Upgrade

My server had been on 10.04 for a long time. With the upcoming 11.10 that means it would be 3 major releases behind. So I decided it was time to upgrade.

I ssh'ed to the server then upgraded via command line. First I made sure that all packages were up to date

> sudo apt-get update
> sudo apt-get upgrade
> sudo apt-get dist-upgrade

Now the release upgrade

> sudo do-release-upgrade

It returned with no new release. The Ubuntu Community website provided help. By default, update-manager only looks for LTS releases. Since my server version (10.04) was already LTS, there was no further LTS release to upgrade. I needed to change the setting.

> sudo vi /etc/update-manager/release-upgrades
to change to Prompt=normal

> sudo do-release-upgrade

Now it could find a release to upgrade. However, it gave a warning since I used SSH to connect to the server. Basically, the upgrade process may affect sshd, thus ssh-client. To prevent connectivity issues half-way through the upgrade, another sshd on port 1022 will be started as a backup.

I acknowledged the warning and proceeded. Fortunately there was no issue at all. My ssh session wasn't killed half-way through. Now my server is running 10.10. My next step is to upgrade to 11.04.

Tuesday, October 4, 2011

Time Synchronisation with ntp

My server was 5 minutes faster. Simple to fix.

> sudo apt-get install ntp

For more details see this link.


Ubuntu crontab to rsync

I had to schedule a job to back up my home directory on a server. It's quite simple.

As a normal user:

> crontab -e

then create a schedule entry for the backup job every day at 2 am

0 2 * * * /usr/bin/rsync -va --delete /home/me/ /var/me/ >> /tmp/crontab.log

I had to specify the full path /usr/bin/rsync. It didn't run without the full path.

For more details see this link.