2013年3月24日 星期日
PXE Server安裝Centos筆記
PXE Server安裝Centos筆記:
前言:
我的LAB環境為CentOS 6.3 x86版本
DHCP預設組態檔位於/etc/dhcp目錄下
TFTP預設目錄位於/var/lib/tftpboot目錄下
vsftp預設目錄位於/etc/vsftp目錄下
以上目錄位置請依所用linux版本自行調整
一、必須套件
1.DHCP服務 提供PXE開機時配發IP
2.TFTP服務 提供PXE開機檔來源
3.FTP服務 提供網路安裝來源
使用以下指令安裝即可
yum -y install dhcp tftp-server vsftpd
二、安裝步驟
1.DHCP服務
**********修改/etc/dhcp/dhcpd.conf檔 參考以下:*********
ddns-update-style interim;
not authoritative;
allow unknown-clients;
allow booting;
allow bootp;
option domain-name "vm-lab.lab";
option domain-name-servers 172.18.32.254 ;
option subnet-mask 255.255.255.0;
subnet 172.18.32.0 netmask 255.255.255.0 {
authoritative;
range 172.18.32.10 172.18.32.20 ;
option routers 172.18.32.254 ;
next-server 172.18.32.254;
filename "pxelinux.0";
}
********************************************************
2.設定TFTP服務
***********************修改/etc/xinetd.d/tftp檔 參考以下:*****************************
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
*********************************************************************************
3.設定FTP服務,開放可匿名存取及匿名存取預設目錄。
***********************修改/etc/vsftp/vsftpd.conf檔 參考以下:**************************
anonymous_enable=YES
anon_root=/var/ftp/install/centos/x86/6.3
*********************************************************************************
4.將光碟內容拷貝至/var/ftp/install/centos/x86/6.3
執行以下指令:
mkdir /media/cdrom && mount /dev/sr0 /media/cdrom
cp -r /media/cdrom/* /var/ftp/install/centos/x86/6.3/
5.複製PXE網路開機檔案至tftpboot資料夾
執行以下指令:
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
mkdir -p /var/lib/tftpboot/images/centos/x86/6.3
cd /var/lib/tftpboot/images/centos/x86/6.3
cp /var/ftp/install/centos/x86/6.3/images/pxeboot/vmlinuz .
cp /var/ftp/install/centos/x86/6.3/images/pxeboot/initrd.img .
6.製作PXE開機選單
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot
mkdir /var/lib/tftpboot/pxelinux.cfg
7.新增選單內容
執行以下指令:
vim /var/lib/tftpboot/pxelinux.cfg/default
*******************新增以下內容*************************************************
default menu.c32
prompt 0
timeout 300
MENU TITLE PXE Menu
LABEL CentoS 6.3
MENU LABEL CentOS 6.3
KERNEL images/centos/x86/6.3/vmlinuz
append vga=normal initrd=images/centos/x86/6.3/initrd.img ramdisk_size=32768
LABEL CentoS 6.3 Kickstart
MENU LABEL CentOS 6.3 Kickstart frome ftp
KERNEL images/centos/x86/6.3/vmlinuz
append vga=normal initrd=images/centos/x86/6.3/initrd.img ramdisk_size=32768 ks=ftp://172.18.32.254/ks.cfg
*********************************************************************************
8.設定DHCP、TFTP、VSFTP服務於開機時自動啟動
執行以下指令:
chkconfig dhcpd on
chkconfig vsftpd on
9.啟動以上服務
執行以下指令:
service dhcpd restart
service xinetd restart
service vsftpd restart
10.開啟一台VM測試是否可正常執行網路安裝
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言