天天看點

kickstart無人值守,PXE+TFTP+FTP+DHCP一:環境 一台已經裝好作業系統的機子(192.168.1.5)和一台未裝作業系統的機子

Centos6.5kickstart無人值守安裝

方法:Vsftpd+TFTP+DHCP+Kickstart+PXE

一:環境 一台已經裝好作業系統的機子(192.168.1.5)和一台未裝作業系統的機子

1.未裝作業系統的機子首先做 raid,以 dell r710 為例,6 塊硬碟,一般兩塊做 raid1,

剩下四塊做 raid5。

2. 已經裝了作業系統的機子首先檢查是否安裝 vsftpd,dhcpd,tftp,若沒裝則依次安裝,關閉 iptables,selinux。

/etc/init.d/iptables stop

Chkconfig iptables off 關閉 iptables
Setenfence 0 關閉 selinux

1)挂在CD光牒鏡像到指定檔案夾,這個檔案夾可以随便指定,比如放在/opt

Cd /opt/Packages

                               Rpm -ivh vsftpd*                   安裝 vsftpd

/etc/init.d/vsftpd start 啟動 vsftpd
Chkconfig vsftpd on 開機啟動

                               Cp   -r    /opt/*   /var/ftp/pub      将 opt 下的檔案全部考到   /var/ftp/pub

                 2)   安裝 tftp 以及 tftp-server

Yum install tftp* -y

vim /etc/xinetd.d/tftp

service tftp

{

socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable                   = no 将原來的 yes 改成 no 即

per_source = 11
cps = 100 2
flags = IPv4

}

/etc/init.d/xinetd start

Lsof -i:69     檢視 tftp 是否正常啟動,正常啟動會有 tftp 程序

3)配置 PXE 注意我已經把CD光牒裡的内容拷貝到/var/ftp/pub 中,接下來需要什麼檔案可以去這個目錄去考

1.    進入tftpboot檔案夾,沒有就建一個,有了就不用建了

Cd /var/lib/tftpboot

2.    把 pxelinux.0和 vesamenu.c32拷貝到 tftpboot 如果找不到 syslinux 目錄,需要安裝 yum installsystem-config-kickstart -y

cd /usr/share/syslinux cp pxelinux.0 /var/lib/tftpboot cp vesamenu.c32/var/lib/tftpboot

3.    把 initrd.img 和 vmlinux 拷貝到 tftpboot

cp /var/ftp/pub/image/pxeboot/initrd.img /var/lib/tftpboot cp/var/ftp/pub/image/pxeboot/vmlinux /var/lib/tftpboot

4.    把 isolinux/*.msg 拷貝到 tftpboot cp /var/ftp/pub/isolinux/*.msg /var/lib/tftpboot

5.    在tftpboot下建立一個pxelinux.cfg目錄,并拷貝isolinux.cfg到 pxelinux.cfg/default

Mkdir -p /var/lib/tftpboot/pxelinux.cfg cd /var/lib/tftpboot/pxelinux.cfg

cp/var/ftp/pub/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

6.    修改 default 檔案并修改權限

Chmod 644default

Vim default label linux

menu label ^Install or upgrade an existing system menu default

4)安裝 dhcpd 服務

Yum install dhcp* -y

cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf 複制dhcp

模闆檔案,并重命名

vim/etc/dhcp/dhcpd.conf         修改配置檔案

ddns-update-styleinterim;

ignoreclient-updates;

filename "pxelinux.0"; 注意filename位置,一定不要放在subnet下面
next-server 192.168.1.5;

subnet 192.168.1.0netmask 255.255.255.0 {

            #next-server 192.168.1.5;           PXE伺服器位址

#filename"/var/lib/tftpboot/pxelinux.0";

#filename"pxelinux.0";

optiondomain-name-servers 192.168.1.5;

option routers 192.168.1.5;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.230 192.168.1.240;
default-lease-time 21600;
max-lease-time 43200;

}

5)打開終端輸入system-config-kickstart進行選擇安裝參數

firewall–disabled --ssh

# Install OSinstead of upgrade install

# Use network installation url --url="ftp://192.168.1.5/pub"

# Root password rootpw --iscrypted $1$xihmVh15$IHjFRKU4lKmEyYHgrYd0A.

# System authorization information auth --useshadow --passalgo=md5 # Usegraphical install graphical firstboot --disable # System keyboard keyboard us #System language lang en_US

# SELinux configuration selinux --disabled #Installation logging level skipx logging --level=info # Reboot afterinstallation reboot # System timezone timezone --isUtc Asia/Shanghai

# Network information

network         --bootproto=static--device=eth0 --gateway=192.168.1.5 --ip=192.168.1.230

--nameserver=192.168.1.5 --netmask=255.255.255.0--onboot=on

# System bootloader configurationbootloader --location=mbr

# Clear the Master Boot Record

Zerombr yes

# Partition clearing information clearpart --all--initlabel # Disk partitioning information part swap --fstype="swap"--size=4096 part / --asprimary --fstype="ext4" --size=8192

%packages

@basic-desktop

%end

接下來要安裝作業系統的機子可以設定為網絡引導安裝了(要在同一個區域網路中),記住安裝完成後,更改開機啟動順序,記得以後啟動不優先從網絡引導安裝。