Для начала установим нужные пакеты и службы:
DHCP – предоставляет сетевые реквизиты,
TFTP – предоставляет доступ к файлам по сети,
Syslinux – содержит загрузчик,
NFS – предоставление доступа к файловой системе по сети
DHCP
#yum –y install dhcp
#chkconfig dhcpd on
#vim /etc/dhcpd.conf
#service dhcpd restart
Заполняем файл /etc/dhcpd.conf. У меня он такой.
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim;
ignore client-updates;
subnet 192.168.162.0 netmask 255.255.255.0 {
option routers 192.168.162.2;
option subnet-mask 255.255.255.0;
option domain-name "mydomain.ua";
option domain-name-servers 192.168.162.2;
default-lease-time 21600;
max-lease-time 43200;
#Might not include
Allow bootp;
Allow booting;
# Destination server
host CentOSSecond {
#MAC address of new server
hardware ethernet 00:0c:29:65:3c:76;
#new server
fixed-address 192.168.162.130;
filename "pxelinux.0";
option subnet-mask 255.255.255.0;
option routers 192.168.162.2;
option domain-name "mydomain.ua";
option host-name "CentOSSecond";
next-server 192.168.162.129;
}
}
TFTP
#yum –y intall tftp-server
#vim /etc/xinetd.d/tftp - меняем на disable = no
#service xinetd start
#netstat –nlpgrep :69 - проверяем что запущен
Syslinux
#cp $(rpm –ql syslinux grep menu.c32) /tftpboot/
#cp $(rpm –ql syslinux grep pxelinux.0) /tftpboot/
NFS
#chkconfig nfs on
#echo “/var/install_server/ *(ro,no_root_squash)” >> /etc/exports
#service nfs start
#exportfs
Наполняем TFTP-server
#mkdir -p /tftpboot/{pxelinux.cfg,centos54_x86}
#mkdir -p /var/install-server/centos54_x86
#mount /dev/cdrom /mnt
#cp –r /mnt/* /var/install-server/centos54_x86/
#cp /var/install-server/centos54_x86/images/pxeboot/* /tftpboot/centos54_x86/
#vim /tftpboot/pxelinux.cfg/default
Содержимое /tftpboot/pxelinux.cfg/default
default menu.c32
menu title Linux Install Server. Please choose OS to install.
prompt 0
timeout 100
label CentOS 5.4 x86 Autoinstall
kernel /centos54_x86/vmlinuz
append initrd=/centos54_x86/initrd.img ks=nfs:192.168.162.129:/var/install-server/centos54_x86/centos54_x86_ks.cfg
label Quit
localboot 0
192.168.162.129 – install server
192.168.162.130 – new server
Как видим в файле выше, нам нужно составить еще один файл /var/install-server/centos54_x86/centos54_x86_ks.cfg которого пока у нас нет. Или мы его ручками делаем или вариант для начинающих (типа меня):
#system-config-kickstart - Если есть графический интерфейс.
Клацаем мышкой и готовим параметры сервера. Незабыть, если делаем файл руками, подправить IP адрес сервера.
То что я наклацал в /var/install-server/centos54_x86/centos54_x86_ks.cfg:
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.162.129 --dir=/var/install-server/centos54_x86
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$s61qy13G$g25FAwkqKodFH7ydUEfyS/
# SELinux configuration
selinux --enforcing
# System timezone
timezone Europe/Kiev
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=8 --resolution=640x480
# Disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --size=300
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part /home --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
part /var --bytes-per-inode=4096 --fstype="ext3" --size=4096
part /tmp --bytes-per-inode=4096 --fstype="ext3" --size=100
part /usr --bytes-per-inode=4096 --fstype="ext3" --size=2048
part /opt --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=300
%packages
@java-development
@web-server
@russian-support
@ukrainian-support