Posts Tagged ‘ update

Updating FreeBSD ports nicely using nice

Thanks to: http://scottspare.com/bsdfun/?p=75 for pointing me in the right direction. Compiling port updates can take a while and slow down your server. What you can do is use the ‘nice’ utility to force the processes to a lower priority. This will help your server to run almost normally during an update.

When you use the ‘nice’ command inside of csh or tcsh, you need to mind that you give the full path to the binary so you dont use the built-in ‘nice’ command.

# /usr/bin/nice -n 10 {your update command}

What i use is:

# /usr/bin/nice -n 10 portupgrade -aRrP

Man page for ‘nice’: http://www.freebsd.org/cgi/man.cgi?query=nice&apropos=0&sektion=0&manpath=FreeBSD+8.0-RELEASE&format=html

How to update my sparc FreeBSD install

So the spanking new freebsd-update doesn’t work for sparc systems… boo. Have to do everything manually. Here’s what I remember. Let me know if I forgot something, or its wrong.(very likely)

Install cvsup:

# cd /usr/ports/net/cvsup-without-gui/
# make install

install fastest cvsup:


# cd /usr/ports/sysutils/fastest_cvsup/
# make install
# fastest_cvsup -c u

copy the default supfile to our own before editing.


# cp /usr/share/examples/cvsup/stable-supfile /etc/stable-supfile
# cp /usr/share/examples/cvsup/ports-supfile /etc/ports-supfile

edit both of them and change the


*default host=

to the fastest cvsup server from the “fastest cvsup”

then update the ports


# cvsup -L2 -g /etc/ports-supfile
# cvsup -L2 -g /etc/stable-supfile

Then i guess we try to build the world. see if something breaky.


# cd /usr/src
# make buildworld

Recompiled kernel. I have my own kernel called “MYSPARC2″. Yours might just be “GENERIC”


# cd /usr/src
# make buildkernel KERNCONF=MYSPARC2
# make installkernel KERNCONF=MYSPARC2

rebooted into single user mode then:

# mount -u /
# mount -a -t ufs
# swapon -a

Now you are ready to install the new world.

# cd /usr/src
# make installworld

After that was done, mergemaster to update your configs:

mergemaster -v

Then used portmaster to upgrade all of the ports.

# portmaster -a

Basically everything i know about BSD comes from or stems from something I’ve read at freebsdmadeeasy.com

source: http://www.freebsdmadeeasy.com/tutorials/freebsd/updating-freebsd-with-cvsup.php

script to update wordpress

Why? Because i’m lazy. I’ll update this to see if it works
#!/bin/sh
#your current site will be backed up to your home folder with the date in the name
#change this to whatever you want
BACKUPNAME="wordpress_site_b4_update"
BACKUPDATE=`date +%y%m%d`
#this is the path to your wordpress site's root
SITEROOT="/usr/local/www/"
#here she goez...
cd ~
tar -pczf "$BACKUPNAME""$BACKUPDATE".tar.gz "$SITEROOT"
cd /usr/local
fetch http://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
rm latest.tar.gz
cp -R wordpress/* "$SITEROOT"/
rm -R wordpress
chown -R www "$SITEROOT"

FreeBSD time updates with ntpdate and ntpd

So FreeBSD’s time is out of wack. Two options:

1. ntpdate. This is manual. To run a time sync manually, just run

ntpdate -b pool.ntp.org

You can replace pool.ntp.org with whatever you want. To tell it to run whenever the system is booted, add this to /etc/rc.conf:

ntpdate_enable="YES"
ntpdate_hosts="[your ntp server]"

This works, but if you don’t reboot often, could be unreliable.

2. ntdp. ntpd just runs all the time and keeps you nsync with internet time servers. You would want to use this for servers that you don’t reboot all the time. for this:

create an /etc/ntpd.conf file:

server pool.ntp.org
driftfile /etc/ntp.drift
logfile /var/log/ntpd.log

you can start ntpd manually:

ntpd

and/or add a startup entry for it in /etc/rc.conf:

ntpd_enable="YES"

I recommend setting up both of these on servers. Ntpdate will snap your system to a good point before you begin synchronizing with ntpd. ntpd by itself will take a lot longer to get you synced up.

 

Switch to our mobile site