Wednesday, April 21, 2010

How To Rsync at Freebsd Using ssh.

Before rsync,your have to make sure your BSD box already insttaled rsync. If you don't have it please to do so and please to install both of your server.

You can install rsync using ports (Please to csup your ports 1st to get the new packages)

#cd /usr/ports/net/rsync/
#make config
#make && make install

Start to rsync.

i am only rsync forder usr/src.
#rsync -av -e "ssh -l admin" root@servername:/usr/src/ /usr/src/

After finish do not reboot, please re-compile.
** I recommended to csup the stable_supfile 1st before your compile your kernel.

#cd /usr/src
#make cleanworld && make cleandir
#make buildworld
#make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
#make installworld
#make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).

Then start to rsync other folder.
Your can exclude any folder that you think not necessary.
I am rsync some folder such as boot or usr/src.

#rsync -av --exclude=/boot --exclude=/usr/src -e "ssh -l admin" root@servername:/ /

password will be prompted. Then enter password. wait until finish the rsync.

After finish

change ip address,hostname and vhost.

To change hostname.
#ee /etc/hosts

To change ip address
#ee /etc/rc.conf

to change vhost ** If you use it.
# ee /usr/local/etc/apache22/extra/httpd-vhosts.conf

then reboot your server