Friday, December 28, 2012

Upgrading FreeBSD 8.2 to STABLE

After for a long time not posting blogspot. In my spare time making documentation for upgrading FreeBSD release to stable. This is old topic and so many documentation around but it's still important who is consider for upgrading FreeBSD to Stable one.

So whats the different between Current and Stable? Well, I think you should read this link :)

http://www.freebsd.org/doc/en/books/handbook/current-stable.html

This is my email server.

mail# uname -a
FreeBSD mail.myserver.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Tue Dec 25 00:22:30 WIT 2012     root@mail.myserver.com:/usr/obj/usr/src/sys/PAE-PF-ALTQ  i386
mail#

As we can see, is using FreeBSD 8.2-RELEASE, and I need to upgrade to STABLE one.

First, install cvsup using ports.
/usr/ports/net/cvsup
mail#make install clean
 ....
cp `cat ../M3TARGET`/cvpasswd.1 /usr/local/man/man1/cvpasswd.1
chmod 644 /usr/local/man/man1/cvpasswd.1
===>   Compressing manual pages for cvsup-without-gui-16.1h_4
===>   Registering installation for cvsup-without-gui-16.1h_4
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/sbin/cvsupd
/usr/local/bin/cvsup
/usr/local/bin/cvpasswd

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://www.cvsup.org/
mail#

After everything is OK, copy the default configuration of stable supfile in :
mail# cp /usr/share/examples/cvsup/stable-supfile /root/

Edit stable-supfile.

Here is for example :

*default host=CHANGE.TO.NEAREST.SERVER
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=RELENG_8
*default delete use-rel-suffix

# If you seem to be limited by CPU rather than network or disk bandwidth, try
# commenting out the following line.  (Normally, today's CPUs are fast enough
# that you want to run compression.)
*default compress

## Main Source Tree.
#
# The easiest way to get the main source tree is to use the "src-all"
# mega-collection.  It includes all of the individual "src-*" collections.
# Please note:  If you want to track -STABLE, leave this uncommented.
src-all

mail# cvsup -g -L 2 stable-supfile &
Checkout src/usr.sbin/zzz/Makefile
Checkout src/usr.sbin/zzz/zzz.8
Checkout src/usr.sbin/zzz/zzz.sh
Shutting down connection to server
Finished successfully

[1]    Done                          cvsup -g -L 2 stable-supfile

Remove OLD obj in directory /usr/obj if needed.

Now is time to buildworld, because I custimize my kernel options, so I have to build kernel too.
You can skip this, if using default kernel options.

mail#cd /usr/src
mail# make buildworld
mail# make buildkernel KERNCONF=MYKERNEL

After for awhile, compile kernel is complete

text    data     bss     dec     hex filename
8465186  752516  608536 9826238  95efbe kernel.debug
objcopy --only-keep-debug kernel.debug kernel.symbols
objcopy --strip-debug --add-gnu-debuglink=kernel.symbols kernel.debug kernel
--------------------------------------------------------------
>>> Kernel build for MYKERNEL completed on Fri Dec 28 06:49:32 WIT 2012
--------------------------------------------------------------

mail# make installkernel KERNCONF=MYKERNELmail# make installworld
mail# reboot

Check server using this command below.

mail# uname -a
FreeBSD mail.myserver.com 8.3-STABLE FreeBSD 8.3-STABLE #0: Fri Dec 28 06:49:27 WIT 2012     root@mail.myserver.com:/usr/obj/usr/src/sys/PAE-PF-ALTQ  i386
mail#

Done.


Tuesday, December 25, 2012

Simple command and very useful in Windows

I use this command for administering My server, Microsft Windows 2003 Enterprise.


xcopy /c /e /f /h /i /a /s /v /D /z /Y Z:\ E:\share

FORFILES /P D:\Backup /S /M *.bak /D 01/06/2012 /C "cmd /c xcopy @file F:\DB1011\2011 /Y"

FORFILES /P %backupgl% /S /M *.bak /D -366 /C "cmd /c del @file"

Robocopy X:\*.* C:\temp /E /Z /SEC /MIR /R:1 /LOG:%log%

Robocopy command you can download it from microsoft website.

Saturday, December 1, 2012

viperbsd# uname -a
FreeBSD viperbsd.org 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sat Jun 7 01:50:54 WIT 2008 root@viperbsd.org:/usr/src/sys/i386/compile/viperbsd i386
viperbsd#

#cd /usr/src
# make buildworld
# make buildkernel KERNCONF=ROUTER
# make installkernel KERNCONF= ROUTER
# make installworld
# reboot

DTrace on FreeBSD

DTrace, also known as Dynamic Tracing, was developed by Sun™ as a tool for locating performance bottlenecks in production and pre-production systems. It is not, in any way, a debugging tool, but a tool for real time system analysis to locate performance and other issues. (http://www.freebsd.org/doc/en/books/handbook/dtrace.html)

Well, I am trying to install on my old machine, FreeBSD 7.1

Add this following options to your configuration kernel.

options KDTRACE_HOOKS # Kernel DTrace hooks
options DDB_CTF

Compile your kernel with this options WITH_CTF=1

This articel is out of date. Not open my blog for long time, still in draft.