Wednesday, 16 June 2004
Learn how to configure packages included with FreeBSD to keep your OS and programs up to date. This will show you how to create scripts and run them via cron to automate the whole process1. Install freebsd-updates. This will keep your system up to date with binary security patches
[root]# cd /usr/ports/security/freebsd-update [root]# make install clean
2. Install cvsup and create your basedir. This will keep your freeBSD source code and ports directory up to date
[root]# /usr/ports/net/cvsup [root]# make install clean [root]# mkdir /usr/local/etc/cvsup
Create a configuration file for cvsup updates. I create one file for source updates and one file for ports. If you installed the src, you can find an example cvsup file configuration in /usr/share/examples/cvsup
Source Code Update File: *default host=cvsup3.FreeBSD.org *default base=/usr/local/etc/cvsup *default prefix=/usr # Change the next line to match your release of freeBSD *default release=cvs tag=RELENG_4_9 *default delete use-rel-suffix *default compress src-all
Ports Directory Update File *default host=cvsup5.FreeBSD.org *default base=/usr/local/etc/cvsup *default prefix=/usr # This will get the latest release *default release=cvs tag=. *default delete use-rel-suffix *default compress ports-all
3.Install portupgrade. This will determine if any ports were updated with cvsup and do the actual program update
[root]# cd /usr/ports/sysutils/portupgrade [root]# make install clean
4. Create a script to run the programs. Here is an example of what I use #!/bin/sh
SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin HOME=/var/log
# fetch binary security updates freebsd-update fetch
# install the updates that were downloaded freebsd-update install
# download updated ports distfiles cvsup /usr/local/etc/cvsup/ports-supfile
# download updated source files cvsup /usr/local/etc/cvsup/core-supfile
# udpate the package database and install any updated ports pkgdb --autofix portupgrade -a -v
5. Now you can add your script to cron and have it run every night.
[root]# crontab -e (this will open a vi editor for your cron jobs) Add the following line: 06 4 * * * /usr/local/etc/cvsup/update.sh 2> &1 > /var/log/update.out
use :wq to save your cron jobs This will create a cron job that runs at 4:06 am everyday and the system out and system error will be output to the file /var/log/update.out
You can also have the results of the update emailed to you if you have an smtp server running on your server. To do this set up your cron job like this: 06 4 * * * /usr/local/etc/cvsup/update.sh 2> &1 > /var/log/update.out && cat /var/log/update.out | mail -s "update results" youremail@yourdomain.com
NOTE: In some cases you may have to run the update manually because of packages that require configuration. Some packages I know of are php, samba, and postfix. What will happen is you cron job will never end and you must kill it and run the update.sh manually. I have not figured out any work around for this yet. |
FreebSD Written by Guest on 2004-11-19 10:50:14 Hello, now for the FreeBSD OS... the Source Code.. will update the FreebSD OS ... now i am running FreeBSD 4.10 RELEASE .. and wanting to run FreeBSD 5.3 RELEASE... now is this gonna be hard doing it though cvsup and remotely? | Written by Guest on 2004-11-20 19:17:04 if the config file above change *default release=cvs tag=RELENG_4_9 to *default release=cvs tag=RELENG_5 do a cvsup and recompile | FreeBSD Written by Guest on 2004-11-21 12:42:44 And I won't have a problem about singel users... remmber this will all be done remotely?.. | why cvsup everyday? Written by Guest on 2005-03-19 13:29:25 it's just overkill for most users. Once a week should be fine. Also, to better use the cvsup infrastructure try to do your updates in days and hours of low usage. See this article for an in depth explanation: CVSup Infrastructure | Written by Guest on 2005-03-26 16:18:27 |
Powered by AkoComment 1.0 beta 2! |