I’ve been using Ubuntu for nearly one year now. I have to say, its a great distro. Everything works well and immediately. I run it as a server on my PC.That said, it’s time to move on to the point of this post.
I like to have a completely updated installation. Most of you Ubuntu users know that apt-get can take quite awhile if you have a bunch of packages to install. This can be fixed easily. Basically you just use a cron job to run apt-get whenever you want it updated. I have mine to update every Monday night at midnight.
You’ll want to be root when you create the cron job so that apt-get can run properly.
The first thing you’ll need to do is open up your favorite text editor and enter the cron information into a file. I’m going to call mine apt-get.cron.file. In this file you’ll need to enter exactly when you want the cron to run, as well as what you want it to do.
As I said, I have mine run every Monday at midnight (00:00). My entry looks like this so far:
0 0 * * Mon
This tells cron to run on the 0th minute of the 0th hour of every Monday of every month. The next step is to specify the user (root). Your cron entry should now look like:
0 0 * * Mon root
The final step is to specify the commands you want to run. I want to run three: apt-get update, apt-get upgrade, and apt-get dist-upgrade. When specifying multiple commands, you should connection them with &&.
0 0 * * Mon root apt-get update && apt-get upgrade && apt-get dist-upgrade
After you have your cron job written how you want it to be, you need to actually create a job for it. Once it’s saved into a file all you need to do is run
nano /etc/crontab
and insert that line into this file.
After all this is set up, all you need to do is go about your business and never have to worry about updating your computer again!