Changes

Jump to navigation Jump to search
5,219 bytes added ,  16:28, 13 May 2016
m
== 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:
<pre>
freebsd-update upgrade -r 8.0-RELEASE
</pre>
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.
<pre>
freebsd-update install
</pre>
The system must be rebooted with the newly installed kernel before continuing.
<pre>
shutdown -r now
</pre>
After rebooting, freebsd-update needs to be run again to install the new userland components:
<pre>
freebsd-update install
</pre>
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:
<pre>
freebsd-update install
</pre>
Finally, reboot into 8.0-RELEASE:
<pre>
shutdown -r now
</pre>

==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:
<pre>
make buildworld
</pre>
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.
<pre>
make buildkernel
</pre>
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.
<pre>
make installkernel
</pre>
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.
<pre>
mergemaster -p
</pre>
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.
<pre>
make installworld
</pre>
Copies the world from /usr/obj. You now have a new kernel and new world on disk.
<pre>
mergemaster -FiU
</pre>
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
<pre>
portsnap fetch
</pre>
Extract the Ports Database and Files to /usr/ports
<pre>
portsnap extract
</pre>
Install a useful Port Manager for easy handling
<pre>
pkg_add -r portmanager
</pre>
Update the local Ports Database and Files at /usr/ports tree (Portmanager looks for installed ports and recompile and install them)
<pre>
portmanager -u
</pre>


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

first backup /usr/ports
<pre>
tar -cvzf /backups/ports-tree.tgz /usr/ports
</pre>
now cleanup
<pre>
cd /usr/ports
portmaster --check-depends
portmaster --check-port-dbdir
portmaster -s
portmaster -y --clean-distfiles
</pre>

== Sources Tree Cleanup ==
first backup /usr/src
<pre>
tar -cvzf /backups/src-tree.tgz /usr/src
</pre>
now cleanup
<pre>
rm -rf /usr/src/*
</pre>

== Objects Tree Cleanup ==
do
<pre>
cd /usr/obj
chflags -R noschg *
rm -rf *
</pre>

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

== Raid1 gmirror ==

set Kernel Flags for gmirror
<pre>
sysctl kern.geom.debugflags=17
</pre>
create mirror database of mirror named gm0
<pre>
gmirror label -vb round-robin gm0 /dev/disk0
</pre>
load mirror Kernel module into active Kernel
<pre>
gmirror load
</pre>
Set gmirror module to load on boot
<pre>
echo 'geom_mirror_load="YES"' >> /boot/loader.conf
</pre>
change /etc/fstab
<pre>
/dev/XXX to /dev/mirror/gm0diskpartitions
</pre>
reboot..

== gmirror error Handling ==

if
<pre>
gmirror status
</pre>
shows old raid data then delete the disk with Live CD
<pre>
dd if=/dev/null of=/dev/disk count=1
</pre>
or try gmirror remove gm0 disk,
<pre>
gmirror remove gm0 /dev/ad0
gmirror remove gm0 /dev/ad2
</pre>

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]]

Navigation menu