Wednesday, 16 June 2004
Learn how to install and configure apt on Redhat/Fedora Linux. You can use apt-get to install new packages and keep your system up to date.1. Download the apt-get rpm for your distribution. You can find the rpms here .
Install the rpm with the following command (as root) [root]# rpm -Uvh apt*.rpm
2. run apt-get update. The first time you run this you will get a prompt to select your servers
[root]# apt-get update
3.Create a script to run the updates. Here is an example. Copy this to a file and make the file executable (chmod +x file)
#!/bin/sh
echo echo "*** DOING AN UPDATE ***" echo apt-get update
echo echo "*** DOING A CHECK ***" echo apt-get check
echo echo "*** DOING AN UPGRADE ***" echo apt-get upgrade -y
echo echo "*** DOING A DIST UPGRADE ***" echo apt-get dist-upgrade -y
echo echo "*** CLEANING UP ***" echo apt-get clean
4. Create a cron job to automatically run the update script every night
[root]# crontab -e (this will open a vi editor for your cron jobs)
copy this to the vi editor (**Replace SCRIPT_DIR with the directory you put the script in) 46 4 * * * SCRIPT_DIR/update.sh 2> &1 > /var/log/update.out
This will run the script every morning at 4:46 am and the system out and system error will be put in a log file /var/log/update.out. You can check that file to see if any updates were applied
If you have an smtp server configured you can have the results of your update emailed to you. To do this, create the cron entry like this: 46 4 * * * SCRIPT_DIR/update.sh 2> &1 > /var/log/update.out && cat /var/log/update.out | mail -s "update results" yourname@yourdomain.com
Powered by AkoComment 1.0 beta 2! |