Difference between revisions of "FreeBSD"

From wiki.linuxonlinehelp.eu
Jump to navigation Jump to search
(No difference)

Revision as of 16:28, 13 May 2016

FreeBSD Update / Upgrade Release

The freebsd-update(8) utility supports binary upgrades of i386 and amd64 systems running earlier FreeBSD releases. Systems running 7.[012]-RELEASE, 8.0-BETA[1234], or 8.0-RC[123] can upgrade as follows:

 freebsd-update upgrade -r 8.0-RELEASE

During this process, FreeBSD Update may ask the user to help by merging some configuration files or by confirming that the automatically performed merging was done correctly.

freebsd-update install

The system must be rebooted with the newly installed kernel before continuing.

shutdown -r now

After rebooting, freebsd-update needs to be run again to install the new userland components:

freebsd-update install

At this point, users of systems being upgraded from FreeBSD 8.0-BETA2 or earlier will be prompted by freebsd-update to rebuild all third-party applications (e.g., ports installed from the ports tree) due to updates in system libraries. See:

http://www.daemonology.net/blog/2009-07-11-freebsd-update-to-8.0-beta1.html

for more details. After updating installed third-party applications (and again, only if freebsd-update printed a message indicating that this was necessary), run freebsd-update again so that it can delete the old (no longer used) system libraries:

freebsd-update install

Finally, reboot into 8.0-RELEASE:

shutdown -r now

Rebuild the complete Server

These concerns have led to the following recommended sequence. Note that the detailed sequence for particular updates may require additional steps, but this core process should remain unchanged for some time:

make buildworld

This first compiles the new compiler and a few related tools, then uses the new compiler to compile the rest of the new world. The result ends up in /usr/obj.

make buildkernel

Unlike the older approach, using config(8) and make(1), this uses the new compiler residing in /usr/obj. This protects you against compiler-kernel mismatches.

make installkernel

Place the new kernel and kernel modules onto the disk, making it possible to boot with the newly updated kernel.

Reboot into single user mode.

Single user mode minimizes problems from updating software that's already running. It also minimizes any problems from running the old world on a new kernel.

mergemaster -p

This does some initial configuration file updates in preparation for the new world. For instance it may add new user groups to the system, or new user names to the password database. This is often necessary when new groups or special system-user accounts have been added since the last update, so that the installworld step will be able to use the newly installed system user or system group names without problems.

make installworld

Copies the world from /usr/obj. You now have a new kernel and new world on disk.

mergemaster -FiU

Now you can update the remaining configuration files, since you have a installed new world on disk (FreeBSD Basic Operation System Files).

Reboot.


Ports Update / Additional Apps

Download a local Copy of the Ports Database and Files to /usr/ports tree

portsnap fetch 

Extract the Ports Database and Files to /usr/ports

portsnap extract

Install a useful Port Manager for easy handling

pkg_add -r portmanager

Update the local Ports Database and Files at /usr/ports tree (Portmanager looks for installed ports and recompile and install them)

portmanager -u


Ports Tree Cleanup

(Remark portmaster isn't a builtin tool, it's external tool of ports tree!)

first backup /usr/ports

tar -cvzf /backups/ports-tree.tgz /usr/ports

now cleanup

cd /usr/ports
portmaster --check-depends 
portmaster --check-port-dbdir 
portmaster -s 
portmaster -y --clean-distfiles

Sources Tree Cleanup

first backup /usr/src

tar -cvzf /backups/src-tree.tgz /usr/src

now cleanup

rm -rf /usr/src/*

Objects Tree Cleanup

do

cd /usr/obj
chflags -R noschg *
rm -rf *

This should save much Space on your Server! Perhaps move the Backups to external Disk!

Raid1 gmirror

set Kernel Flags for gmirror

sysctl kern.geom.debugflags=17

create mirror database of mirror named gm0

gmirror label -vb round-robin gm0 /dev/disk0 

load mirror Kernel module into active Kernel

gmirror load

Set gmirror module to load on boot

echo 'geom_mirror_load="YES"' >> /boot/loader.conf

change /etc/fstab

/dev/XXX to /dev/mirror/gm0diskpartitions

reboot..

gmirror error Handling

if

gmirror status   

shows old raid data then delete the disk with Live CD

dd if=/dev/null of=/dev/disk count=1

or try gmirror remove gm0 disk,

gmirror remove gm0 /dev/ad0
gmirror remove gm0 /dev/ad2

change mount points at /etc/fstab from /dev/gmirror/xxxx to /dev/disk0

after this reboot and reinstall gmirror new!

Customize FreeBSD

KERNEL CUSTOM BUILD

Make.conf

Auto fsck on every boot Check disk and Auto Repair Filesystem after hard Server Crash