C2.7.1.2 Documentación a presentar en la obra
2.7.2.7. Cámaras fijas
Fedora installation DVD ISO
Network of at least two machines
01
Install LinuxThese examples use Fedora Linux, but any Red Hat-derived distro should work. If you install to a removable medium, make sure that you have enough free space to make a copy of the installation DVD ISO. 16GB of free space is a sensible minimum.
02
Add packagesMake yourself root (type su into a terminal), then use YUM to add to extra packages with yum install dhcp tftp
tftp-server xinetd. You’re going to be
working as root, so, if you need to launch a GUI tool such as gedit, use sudo gedit (as root).
03
Set up networkThese examples use a machine with two network adaptors – one for connection to the outside world, and one to connect to the machines that need to boot from it. The second network card probably doesn’t have an IP address assigned yet, so we’ll set this via the GUI.
05
Obtain dhcpd.confDHCP assigns IP addresses and starts the boot process on clients. Visit the offi cial Fedora documentation (tinyurl.com/luad-dhcp) site to cut and paste an example DHCP confi guration for a boot server. Load the existing fi le (/etc/dhcp/dhcpd.conf) into a text editor.
08
Obtain PXELINUXPXELINUX is the Linux bootloader that works over Ethernet. To get it, install SYSLINUX with yum install syslinux. The fi le we need is pxelinux.0. Copy it to the TFTP folder with cp /usr/share/syslinux/pxelinux.0 /var/
lib/tftpboot/. Type mkdir pxelinux.cfg to
create the confi guration directory.
04
Confi gure second adaptorRight-click on the network icon and select Edit Connections…. Now locate the second adaptor, click on Edit and select the IPv4 Settings tab. Change the method from Automatic (DHCP) to Manual. Add a static IP address for your adaptor. For example, if your fi rst adaptor is on 10.0.1.1, adding the second adaptor with an address of 10.0.5.1 and a netmask of 255.255.255.0 will give you space to connect up to 255 machines to the boot server.
07
Confi gure TFTPTFPT is a basic fi le transfer protocol that the NIC fi rmware uses to fetch the bootloader. Load /etc/xinetd.d/tftp and change the line disable = yes so that it reads disable = no. TFTPD is managed by xinetd, so start with
systemctl start xinetd.service.
06
Modify dhcpf.confModify the example dhcpd.conf to match your network. The subnet for our example would be changed to 10.0.5.0, and routers is the same address as your second network adaptor. Setting range dynamic-bootp to 10.0.5.50 10.0.5.100; gives space for 50 machines. The parameter next-server should be set to the same address as your second network adaptor. Change fi lename "linux-install/
pxelinux.0"; to fi lename "pxelinux.0"; Save the fi le and then start the server with systemctl start dhcpd.service.
11
Extract the ISO imageCreate two directories: /var/www/fedora and /media/loop. Copy the Fedora DVD ISO image to the current directory and type mount
-o loop -t iso9660 [path to ISO] /media/
loop. Use rsync to copy the fi les: rsync -v -a
-H /media/loop/ /media/var/www/fedora.
14
Ready the clientsEnter the BIOS setup screen of a client PC and make sure that the boot order specifi es network booting as the priority. When carrying out the installation, you will disconnect the router/switch from the internet and connect it to the boot server instead.
10
Confi gure web serverAdd Apache 2 with the yum install
httpd command, and start it with systemctl
start httpd.service. Test that it is up
and running by navigating a web browser to http://10.0.5.1. If everything’s working, you
should see the Apache startup page.
13
Firewall
Open the Firewall confi guration application. Select persistent confi guration. Add http, https, tftp and tftpclient to the list of trusted services. Select Reload fi rewalld from the Options menu.
09
Confi gure PXELINUXType cd /var/lib/tftpboot/. Make a directory with mkdir pxelinux.cfg. Within this directory, create a text fi le called default. Add the following lines DEFAULT netinstall,
LABEL netinstall, kernel vmlinuz, append initrd=initrd.img repo=http://10.0.5.1/fedora/, implicit 1 and prompt 1 so that it looks like the
picture above. If you’re feeling adventurous, try adding prompt 0 so that clients won’t wait for user confi rmation before beginning the install. Be careful with that option!
12
Copy vmlinuz and initrd.imgEnter the directory that TFTP can see with cd /var/lib/tftpboot/. Execute
wget http://10.0.5.1/fedora/isolinux/
vmlinuz. Copying the fi le like this makes a good
test that the server is working. Now retrieve initrd.img from the same directory.
19
Confi gure Kickstart fi leYou must specify a root password using
the rootpw command to avoid a prompt. You
may want the installer to erase all partitions (or preserve some). The upgrade command causes the installer to upgrade the targets rather than carry out a fresh install.
Save your custom Kickstart fi le as /var/www/html/fedora/ks.cfg and then add ks=http://10.0.5.1/fedora/ks.cfg to the append line in your default fi le. By default, the fi nished target machines will begin in fi rst-run mode and ask the user to specify details such as username and password on the fi rst run.
16
Testing 2If the client tries but fails to load a fi le called pxlinux.0, it is communicating with DHCP, but TFTP may not be working. Try using the command tftp 10.5.0.1 -c get
pxelinux.0 on the server. If this retrieves
the fi le, try executing it again on another machine. If the installer begins to boot, can fi nd pxelinux.0, vmlinuz and initrd.img but stops at that point, try retrieving one of the fi les in /var/ www/http/fedora/ manually by using the wget
10.0.5.1/fedora/[name of file] command.
17
Make services permanentControl Fedora services with
systemctl [command] [service]. The main
commands you’ll need are start, enable
to make permanent, and restart when you make confi guration changes. This project requires running httpd.service, dhcpd.service and xinetd.service.
18
Create Kickstart fi leA Kickstart fi le supplies the installer with answers to avoid prompting the user. To begin, create a fi le called ks.cfg in /var/ www/html/fedora/. Go to the offi cial Fedora Anaconda/Kickstart page for a complete list of commands (tinyurl.com/luad-kickstart). When a Fedora system has been successfully installed, a (fully commented) Kickstart fi le is deposited in /root/anaconda-ks.cfg; this makes a good starting point for building your own. If you installed via the ISO, remove the line that sets install type to CDROM.