Manual Installation FreeBSD/en

Aus EUserv Wiki

(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
K (hat „FreeBSD Installation/en“ nach „Manual Installation FreeBSD/en“ verschoben)
 
(Der Versionsvergleich bezieht 2 dazwischenliegende Versionen mit ein.)
Zeile 1: Zeile 1:
{{Languages|Manual_FreeBSD_Live_System}}
{{Languages|Manual_FreeBSD_Live_System}}
-
[[Kategorie:Operation Systems and software]]
+
[[Kategorie:Operation Systems and Software]]
'''''Installing FreeBSD on my root server '''''
'''''Installing FreeBSD on my root server '''''
__TOC__
__TOC__
Zeile 35: Zeile 35:
It's important for the installation that the system knows the existing hard drives. You can check this with the following command:
It's important for the installation that the system knows the existing hard drives. You can check this with the following command:
-
''# ls -1 /dev/ad* /dev/da* /dev/twed* /dev/aacd* | grep -E '[a-z]{2}[0-9]+$'
+
''# ls -1 /dev/ada* /dev/da* /dev/twed* /dev/aacd* | grep -E '[a-z]{2}[0-9]+$'
-
/dev/ad8
+
/dev/ada0
-
/dev/ad10''
+
/dev/ada1''
-
To get more information about the hard drives, you can use dmesg:
+
''This intstruction describes the installation of a hard drive with the designation "ada0". You have to replace this designation with the name of your hard drive.''
-
 
+
-
''# dmesg | grep ad8
+
-
ad8: 1430799MB <Seagate ST31500341AS CC1H> at ata4-master UDMA100 SATA 3Gb/s''
+
-
 
+
-
''# dmesg | grep ad10
+
-
ad10: 1430799MB <Seagate ST31500341AS CC1H> at ata5-master UDMA100 SATA 3Gb/s''
+
-
 
+
-
''Here are 2 SATA2 hard disks with 1.5 TB installed on the server. (ad8 and ad10).''
+
-
 
+
-
''This intstruction describes the installation of a hard drive with the designation "ad8". You have to replace this designation with the name of your hard drive.''
+
Zeile 55: Zeile 45:
<nowiki>#</nowiki> gpart show <br>
<nowiki>#</nowiki> gpart show <br>
-
<nowiki>#</nowiki> gpart delete -i 1 ad8<br>
+
<nowiki>#</nowiki> gpart delete -i 1 ada0<br>
-
<nowiki>#</nowiki> gpart destroy ad8<br>
+
<nowiki>#</nowiki> gpart destroy ada0<br>
-
<nowiki>#</nowiki> gpart create -s mbr ad8<br>
+
<nowiki>#</nowiki> gpart create -s mbr ada0<br>
-
<nowiki>#</nowiki> gpart add -t freebsd -i 1 ad8<br>
+
<nowiki>#</nowiki> gpart add -t freebsd -i 1 ada0<br>
   
   
Creating the partitions with bsdlabel:
Creating the partitions with bsdlabel:
-
<nowiki>#</nowiki> bsdlabel -wB /dev/ad8s1<br>
+
<nowiki>#</nowiki> bsdlabel -wB /dev/ada0s1<br>
-
<nowiki>#</nowiki> bsdlabel -e /dev/ad8s1<br>
+
<nowiki>#</nowiki> bsdlabel -e /dev/ada0s1<br>
   <nowiki>
   <nowiki>
-
# /dev/ad8s1:
+
# /dev/ada0s1:
8 partitions:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
# size offset fstype [fsize bsize bps/cpg]
Zeile 81: Zeile 71:
Create the BSD filesystem:<br>
Create the BSD filesystem:<br>
-
<nowiki>#</nowiki> newfs -U -O2 /dev/ad8s1a<br>
+
<nowiki>#</nowiki> newfs -U -O2 /dev/ada0s1a<br>
Mount the partitions:<br>
Mount the partitions:<br>
-
<nowiki>#</nowiki> mount /dev/ad8s1a /mnt<br>
+
<nowiki>#</nowiki> mount /dev/ada0s1a /mnt<br>
Zeile 92: Zeile 82:
<nowiki>#</nowiki> cd /mnt<br>
<nowiki>#</nowiki> cd /mnt<br>
-
<nowiki>#</nowiki> mkdir /mnt/install<br>
 
-
<nowiki>#</nowiki> cd install<br>
 
-
<nowiki>#</nowiki> mkdir kernels base<br>
 
-
You can freely choose your FreeBSD version. Open your browser using the following address:
 
-
ftp://ftp.de.freebsd.org/pub/FreeBSD/releases/i386/
 
-
''The 64bit versions are located in the directory /pub/FreeBSD/releases/amd64/''
 
-
 
+
=== Example FreeBSD 9.0 64bit: ===
-
Choose your desired version.
+
-
 
+
-
Now before downloading you have to choose the corresponding folder.
+
-
 
+
-
For a minimal installation you need the folders "Base" and "Kernels".
+
-
 
+
-
 
+
-
''Hint: Older versions can be found in the FreeBSD Archives under:''
+
-
ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/
+
-
Alternative: ftp.fi.freebsd.org/pub/FreeBSD/releases/i386/7.1-RELEASE/
+
-
 
+
-
 
+
-
=== Example FreeBSD 8.1: ===
+
-
 
+
-
<nowiki>#</nowiki> ftp ftp.de.freebsd.org<br>
+
   <nowiki>
   <nowiki>
-
freebsdrescue# ftp ftp.de.freebsd.org
+
fetch ftp://freebsd.autoinstall.isppro.de/releases/amd64/9.0-RELEASE/base.txz
-
Trying 213.83.42.56...
+
fetch ftp://freebsd.autoinstall.isppro.de/releases/amd64/9.0-RELEASE/kernel.txz
-
Connected to ftp.plusline.net.
+
-
220 ProFTPD 1.3.1 Server (FTP Plus.line AG) [::ffff:213.83.42.56]
+
-
Name (ftp.de.freebsd.org:root): anonymous
+
-
331 Anonymous login ok, send your complete email address as your password
+
-
Password: 1234 (an dieser Stelle ist es egal, was man hineinschreibt)
+
</nowiki>
</nowiki>
-
 
-
<nowiki>#</nowiki> cd /pub/FreeBSD/releases/i386/8.1-RELEASE/<br>
 
-
<nowiki>#</nowiki>  mget base base/<br>
 
-
''mget base/base.bh [anpqy?]? a''<br>
 
-
 
-
<nowiki>#</nowiki> mget kernels kernels/<br>
 
-
''mget kernels/kernels.bh [anpqy?]? A''<br>
 
-
 
-
<nowiki>#</nowiki> exit<br>
 
-
 
-
 
-
=== Example Free BSD 7.1: ===
 
-
 
-
<nowiki>#</nowiki> ftp ftp-archive.freebsd.org<br>
 
-
 
-
user: anonymous
 
-
 
-
<nowiki>#</nowiki> cd /pub/FreeBSD-Archive/old-releases/i386/7.1-RELEASE/<br>
 
-
 
-
<nowiki>#</nowiki> mget base base/<br>
 
-
mget base/base.bh [anpqy?]? a<br>
 
-
 
-
<nowiki>#</nowiki> mget kernels kernels/<br>
 
-
mget kernels/kernels.bh [anpqy?]? A<br>
 
-
 
-
<nowiki>#</nowiki> exit<br>
 
=== Installation of the basic system: ===
=== Installation of the basic system: ===
-
 
-
You have to set the environment variable for the installation directory, so the system can be installed on your hard drive.
 
-
 
-
<nowiki>#</nowiki> setenv DESTDIR /mnt<br>
 
Now the setup files are made executable and are executed after that:
Now the setup files are made executable and are executed after that:
-
<nowiki>#</nowiki> cd /mnt/install/base<br>
+
<nowiki>#</nowiki> cd /mnt<br>
-
 
+
<nowiki>#</nowiki>tar xjpf base.txz<br>
-
<nowiki>#</nowiki> chmod +x install.sh<br>
+
<nowiki>#</nowiki>tar xjpf kernel.txz<br>
-
 
+
-
<nowiki>#</nowiki> ./install.sh<br>
+
-
 
+
-
<nowiki>#</nowiki> cd /mnt/install/kernels<br>
+
-
<nowiki>#</nowiki> chmod +x install.sh<br>
+
-
<nowiki>#</nowiki> ./install.sh GENERIC<br>
+
-
 
+
-
 
+
-
The kernel is in the folder "GENERIC". The content of the folder must be copied to /mn/boot/kernel so the bootloader can find the kernel:
+
-
 
+
-
<nowiki>#</nowiki> mv /mnt/boot/GENERIC/* /mnt/boot/kernel/<br>
+
-
<nowiki>#</nowiki> rmdir /mnt/boot/GENERIC<br>
+
Zeile 184: Zeile 106:
Installation of the Bootloader:
Installation of the Bootloader:
-
<nowiki>#</nowiki> #boot0cfg -B /dev/ad8<br>
+
<nowiki>#</nowiki> #boot0cfg -B /dev/ada0<br>
''Hint: Make sure that you use the correct designation of your hard drives.''
''Hint: Make sure that you use the correct designation of your hard drives.''
Zeile 194: Zeile 116:
   <nowiki>
   <nowiki>
-
dev/ad8s1a / ufs rw 1 1
+
dev/ada0s1a / ufs rw 1 1
-
dev/ad8s1b none swap sw 0 0
+
dev/ada0s1b none swap sw 0 0
   </nowiki>
   </nowiki>
''Example fstab''
''Example fstab''
Zeile 305: Zeile 227:
<nowiki>#</nowiki> sysctl kern.geom.debugflags=16<br>
<nowiki>#</nowiki> sysctl kern.geom.debugflags=16<br>
-
<nowiki>#</nowiki> gmirror label -vb round-robin gm0 ad8<br>
+
<nowiki>#</nowiki> gmirror label -vb round-robin gm0 ada0<br>
<nowiki>#</nowiki> gmirror load<br>
<nowiki>#</nowiki> gmirror load<br>
-
<nowiki>#</nowiki> gmirror insert gm0 ad10<br>
+
<nowiki>#</nowiki> gmirror insert gm0 ada1<br>
   
   
Zeile 320: Zeile 242:
Name Status Components
Name Status Components
-
mirror/gm0 DEGRADED ad8
+
mirror/gm0 DEGRADED ada0
-
ad10 (0%)
+
ada1 (0%)
   </nowiki>
   </nowiki>
<div style= "color: red; font-weight:bold;">
<div style= "color: red; font-weight:bold;">
-
After all configuation steps have been finished, you have to deactivate the FreeBSD LiveSystem und wait a little (5 minutes). Now restart the server via "reboot".
+
After all configuation steps have been finished you can restart the server via "reboot".
</div>
</div>
Zeile 333: Zeile 255:
   
   
-
If that works, you can restart the Rescue System. Mount your partitions (e.g. mount /dev/ad8s1a /mnt) and check the configuration of the system.
+
If that works, you can restart the Rescue System. Mount your partitions (e.g. mount /dev/ada0s1a /mnt) and check the configuration of the system.
If your system is booting and everything works, you can delete the installation sources:
If your system is booting and everything works, you can delete the installation sources:
Zeile 348: Zeile 270:
   
   
-
<nowiki>#</nowiki> fsck -t ufs -y /dev/ad8s1a<br>
+
<nowiki>#</nowiki> fsck -t ufs -y /dev/ada0s1a<br>
-
+
-
 
+
-
Q: Can I install FreeBSD version X.Y with this instruction?
+
-
+
-
A. This instruction was tested with the versions 7.1 and 8.1. Theoretically you can install each version, which is offered by download on the FreeBSD FTP servers.
+

Aktuelle Version vom 10:44, 29. Okt. 2012

Installing FreeBSD on my root server

Inhaltsverzeichnis

Installing FreeBSD on my root server


Prerequisites

For the installation of FreeBSD you need the following software on your system:

* SSH-client (e.g. OpenSSH / PuttY)


Start FreeBSD Live System

Start the FreeBSD Live-System, see: About the FreeBSD Live-System (RescueSystem)

Log in to your server via SSH. Before starting the installation be careful that you have an updated backup of your server.

Usually all data will be deleted at the installation.

Hint: On 64bit systems the 64bit RescueSystem will always be started by default. On this system an installation in 32 and 64bit is possible.


Starting the installation

The FreeBSD installation tool Sysinstall causes some problems, so we recommend that you run the installation manually.


Preparation of the hard drives

It's important for the installation that the system knows the existing hard drives. You can check this with the following command:

# ls -1 /dev/ada* /dev/da* /dev/twed* /dev/aacd* | grep -E '[a-z]{2}[0-9]+$' /dev/ada0 /dev/ada1

This intstruction describes the installation of a hard drive with the designation "ada0". You have to replace this designation with the name of your hard drive.


Now the hard drives have to be formatted:

# gpart show
# gpart delete -i 1 ada0
# gpart destroy ada0
# gpart create -s mbr ada0
# gpart add -t freebsd -i 1 ada0


Creating the partitions with bsdlabel:

# bsdlabel -wB /dev/ada0s1
# bsdlabel -e /dev/ada0s1

  
# /dev/ada0s1:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: * 16 4.2BSD 0 0
b: 4G * swap 0 0
c: * 0 unused 0 0 # raw part, don't edit
   

Example-Label (4GB swap-Slice, rest for /):

This is the most simple kind of an example label. If you want to partitionize your hard disk otherwise, be careful that your partitions will be provided with the filesystem and mounted correctly. You have to customize your fstab accordingly.


Create the BSD filesystem:

# newfs -U -O2 /dev/ada0s1a


Mount the partitions:

# mount /dev/ada0s1a /mnt


Downloading the installation files:

# cd /mnt


Example FreeBSD 9.0 64bit:

  
fetch ftp://freebsd.autoinstall.isppro.de/releases/amd64/9.0-RELEASE/base.txz
fetch ftp://freebsd.autoinstall.isppro.de/releases/amd64/9.0-RELEASE/kernel.txz 


Installation of the basic system:

Now the setup files are made executable and are executed after that:

# cd /mnt
#tar xjpf base.txz
#tar xjpf kernel.txz


Configuration of the system:

Installation of the Bootloader:

# #boot0cfg -B /dev/ada0

Hint: Make sure that you use the correct designation of your hard drives.


The file fstab must be created in /etc, so the slices are correctly mounted during the booting process. If you want to setup a software Raid, you can skip this step!

# vi /mnt/etc/fstab

  
dev/ada0s1a / ufs rw 1 1
dev/ada0s1b none swap sw 0 0
   

Example fstab


Activate the SSH root login:

# vi /mnt/etc/ssh/sshd_config
Here the line "#PermitRootLogin no" must be edited:

  
PermitRootLogin yes
   

(Do not forget to delete the #, so this line isn't a comment anymore)


Setting the nameserver in the resolv.conf:

# vi /mnt/etc/resolv.conf

  
search blue.kundencontroller.de
nameserver 85.31.184.61
nameserver 85.31.184.60
nameserver 85.31.185.61
nameserver 85.31.185.60
   

In rc.conf the configuration of the network interface is set up and SSH is activated.


Find out of the designation of the network card:

# ifconfig

  
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSU
M,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
inet 91.143.80.107 netmask 0xffffff00 broadcast 91.143.80.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
   

In this case the network card is "re0"


# vi /mnt/etc/rc.conf

  
#!/bin/sh
ifconfig_re0="inet XXX.XXX.XXX.XXX netmask 255.255.255.0"
sshd_enable="YES"
defaultrouter="XXX.XXX.XXX.XXX"
fsck_y_enable="YES"
background_fsck="NO"
   

Replace "re0" with the designation of your network card.

Important: XXX.XXX.XXX.XXX has to be replaced with the IP address of your server.

The information for the IP address, the network mask and defaultrouter (Default-Gateway) can be found under your server data in the customer center.


Changing the root password:

# cd /mnt

# chroot .

# passwd

# exit


So the installation of your FreeBSD system is finished. If you want to set up a software raid 1, proceed with the next section. Otherwise you can now unmount your file systems.


z.B.

# cd /

# umount /mnt


Optional: Setting up a Software Raid 1

the following points are necessary, if you want to set up a software Raid:

# echo geom_mirror_load="YES" > /mnt/boot/loader.conf


# vi /mnt/etc/fstab

  
dev/mirror/gm0s1a / ufs rw 1 1
dev/mirror/gm0s1b none swap sw 0 0
proc /proc procfs rw 0 0
   

Example fstab for a Software Raid 1


# cd /

# umount /mnt


# sysctl kern.geom.debugflags=16

# gmirror label -vb round-robin gm0 ada0

# gmirror load

# gmirror insert gm0 ada1


Check the raid:

# gmirror status

  
Name Status Components

mirror/gm0 DEGRADED ada0

ada1 (0%)
   

After all configuation steps have been finished you can restart the server via "reboot".


A few minutes later your server should be reachable via SSH and you can log in with "root" and the password you have set before.


If that works, you can restart the Rescue System. Mount your partitions (e.g. mount /dev/ada0s1a /mnt) and check the configuration of the system.

If your system is booting and everything works, you can delete the installation sources:


# rm -rf /install

Frequently Asked Questions

Q: During the mounting of the partitions the error message "Operation not permitted" appears

A: Check and repair the file system:


# fsck -t ufs -y /dev/ada0s1a