English | Русский  

RSS feed

Star Family Blog

|
08/09/2014 22:57

PXE/kickstart OS installations under RedHat/CentOS/Oracle Linux 6.x

Posted by VladStar

How to set up PXE/kickstart server for automated OS installations under RedHat/CentOS/Oracle Linux 6.x.

This turned out to be a quite long and scary manual... but believe me, it only sounds harder than the actual deal is. Should take about an hour for experienced admins, and may longer for other people, depending on their skills.

You need 3 service components - DHCP/bootpc server (dynamic IP allocations), TFTP server (PXE boot environment), HTTP server (OS repository). In addition, you will need installation Kickstart scripts.


1) DHCP/bootpc server

To install dhcpd on Linux via YUM use the following command:

# yum install -y dhcp


DHCP configuration should point to your TFTP server, containing PXE boot environment, which can be on the same server as DHCP or the other server. Here is my example of /etc/dhcpd.conf:


allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.1.2; # IP address of your TFTP server, described in #2 below
filename "pxelinux.0";
}

default-lease-time 600;
max-lease-time 7200;
ddns-update-style ad-hoc;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option domain-name-servers 192.168.1.1;
option domain-name "mynetwork.com";
option subnet-mask 255.255.255.0;
range 192.168.1.200 192.168.1.254;
}


After you save the config, start dhcpd daemon:
# service dhcpd start

References:

2) TFTP server (handled by xinetd TCP wrapper)

To install it via YUM use the following command:
# yum install -y tftp-server xinetd


In "/etc/xinetd.d/tftp" file change "disable = yes" with "disable = no", then (re)start xinetd server:

# service xinetd restart


PXE OS boot files to be installed to /tftpboot folder. For the initial boot you need 3 PXELinux loader files. They can be obtained from "syslinux" package, a latest version of which you can find at http://www.kernel.org/

/tftpboot/pxelinux.0
/tftpboot/menu.c32
/tftpboot/pxelinux.cfg/default


This is the example of my /tftpboot/pxelinux.cfg/default file, where I have few OS systems to choose my installation from:

DEFAULT menu.c32
PROMPT 0
TIMEOUT 300
ONTIMEOUT local

MENU TITLE PXE Installation Menu

LABEL local
MENU LABEL Boot local hard drive
LOCALBOOT 0
MENU DEFAULT

LABEL CentOS 6.5
MENU LABEL CentOS 6.5
KERNEL menu.c32
APPEND pxelinux.cfg/CentOS6.5.cfg

LABEL CentOS 6.4
MENU LABEL CentOS 6.4
KERNEL menu.c32
APPEND pxelinux.cfg/CentOS6.4.cfg

LABEL CentOS 6.3
MENU LABEL CentOS 6.3
KERNEL menu.c32
APPEND pxelinux.cfg/CentOS6.3.cfg


Each of the configuration files mentioned above contains OS-specific installation instructions. For instance, this is a part of my "/tftpboot/pxelinux.cfg/CentOS6.5.cfg" file:


MENU TITLE PXE Installation for CentOS 6.5

LABEL Main Menu
MENU LABEL Main Menu
KERNEL menu.c32
APPEND pxelinux.cfg/default

LABEL CentOS 6.5 x64 (eth0, no kickstart)
MENU LABEL CentOS 6.5 x64 (eth0, no KS)
KERNEL CentOS-6.5/vmlinuz
APPEND initrd=CentOS-6.5/initrd.img ramdisk_size=100000 ip=dhcp url --url=http://repository_server/CentOS/6.5/os/x86_64

LABEL CentOS 6.5 x64 (eth0, RAID, KS)
MENU LABEL CentOS 6.5 x64 (eth0, KS)
KERNEL CentOS-6.5/vmlinuz
APPEND initrd=CentOS-6.5/initrd.img ramdisk_size=100000 ip=dhcp url --url=http://repository_server/CentOS/6.5/os/x86_64 ksdevice=bootif ks=http://repository_server/CentOS-6.5.cfg mpath
[...]


* Note "url" and "ks" parameters above - they point to our local repository server, described in #3.

Under /tftpboot/CentOS*/ folders, referred in the config above, I have OS-specific boot files, obtained from "isolinux" folder of OS-specific installation media (they can also be downloaded from one of the OS repository websites).


# ls -1 /tftpboot/CentOS-6.5/
boot.cat
boot.msg
general.msg
initrd.img
isolinux.bin
isolinux.cfg
memtest
options.msg
param.msg
rescue.msg
splash.lss
TRANS.TBL
vmlinuz
#


References:
- http://www.mythtv.org/wiki/Minimyth_Howto

3) HTTP OS repository server.

You need to install Apache httpd server, start it and copy the OS repository to its DocumentRoot folder. Depending on default settings, you may need to modify httpd.conf and set "Options +Indexes" to allow file listings.

# yum install httpd
# vi /etc/httpd/conf/httpd.conf
# service httpd start
# mount /dev/cdrom /mnt
# mkdir -p /var/www/html/CentOS/6.5/os/x86_64
# rsync -av /mnt/os /var/www/html/CentOS/6.5/


You repository server should be accessible via http://repository_server/CentOS/6.5/os link from your browser, and you should see the list of files.

References:
- http://www.how2centos.com/creating-a-local-yum-repository-on-centos-5x/
- https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Configuring_Yum_and_Yum_Repositories.html
- http://mirror.centos.org/
- http://public-yum.oracle.com/

4) Kickstart environment.

A very first installation you will have to perform manually, in non-automated manner (re: "no KS" line above). During this installaton, the installation program will create a script /root/anakonda-ks.cfg, which you can use later for automated installations.
All you need to do is to rename it, modify as necessary, save it to your HTTP repository server and make sure it's accessible (Re: "http://repository_server/CentOS-6.5.cfg" in the example above).

5) Your overall installation procedure will look like:
- You boot your new server from the network via PXE (choosing corresponding option from the BIOS).
- Your server obtains DHCP address and boot parameters (TFTP server address and PXELinux filename) from your DHCP server
- Your server loads pxelinux.0 file from your TFTP server, runs it, reads menu.c32 and default configuration file, containing the menu
- You choose an installation option from the menu
- Server loads the kernel (vmlinuz/initrd/etc. files) from TFTP server, passes specified kernel parameters and then performs installation, according to your specific kickstart script, and using your HTTP OS repository server to load necessary packages

References:
- http://fedoraproject.org/wiki/Anaconda/Kickstart
- http://www.oracle-base.com/articles/linux/kickstart.php

All of these certainly gives you an advantage, when you have to install a number of similar servers in your network (I'd say, makes sense for more than 3).

Comments: none (click here to reply)    Tags: How-to | Linux | Работа


Comments: (add new comment)
Name:    E-mail:
Your e-mail is required, but never shown to public, allowed tags: <b><i><u><a><img><blockquote><font>
Message:

Subscribe: No    Replies only    All comments   
Answer:

Statistics: (last 30 days / total)
Public posts: 0 / 994
Comments: 0 / 2110
Spam comments: 0 / 98

Archive:

Tags:

*Объявления* (11)
Dvd (2)
English (2)
Fundraising (1)
Halloween (1)
How-to (6)
KIA (1)
Lego (2)
Linux (5)
Mazda 6 (4)
Oracle db (1)
Outer Banks (5)
VA Beach (1)
Авто (5)
Алкоголь (1)
Америка (408)
Андрей (151)
Аська (1)
Бензин (1)
Бессонница (2)
Бизнес (1)
Бред (3)
Видео (17)
Винда (2)
Влад (159)
Воспоминания (25)
Генеалогия (3)
Годовщина (3)
Дед (5)
Документы (11)
Дом (49)
Доминикана (5)
Дороги (31)
Досуг (47)
Друзья (27)
Еда (3)
Животные (10)
Заправка (1)
Зима (2)
Знакомство (1)
Игры (24)
Интернет (62)
История (4)
Кино (4)
Книги (6)
Компьютер (3)
Компьютеры (69)
Консульство (6)
Конференция (1)
Кофе (1)
Кроссворд (1)
Кулинария (1)
Лена (44)
Лето (1)
Литература (1)
Лифты (1)
Математика (3)
Машины (73)
Медицина (12)
Мексика (1)
Мичиган (1)
Мозаика (1)
Музыка (13)
Налоги (1)
Новости (9)
Новый год (5)
Ностальгия (2)
Океан (1)
Опрос (1)
Отдых (14)
Отпуск (10)
Паспорт (7)
Полиция (1)
Праздники (91)
Природа (94)
Проблемы (7)
Программирование (7)
Псков (6)
Путешествия (56)
Работа (83)
Радио (1)
Радиоэлектроника (5)
Ремонт (6)
Рисование (1)
Робот вася (1)
Рождество (4)
Россия (38)
Русский язык (1)
Ручки (1)
Сатира (1)
Свадьба (3)
Семья (31)
Синклер (1)
Снег (7)
Сны (1)
Софт (2)
Спорт (11)
Ссылки (9)
Стихи (2)
Телевидение (3)
Телефоны (17)
Тесты (2)
Техническое (2)
Финансы (12)
Флорида (2)
Фотография (30)
Хобби (4)
Чай (1)
Часы (1)
Шахматы (4)
Школа (16)
Шопинг (3)
Электроника (5)
Юмор (39)

000002543
Server OS is powered by FreeBSD - http://www.freebsd.org/