6-3pxe應用入門

172.18.253.208
yum install dhcp tftp-server tftp syslinux vsftpd---配置成一個dhcp server
此時還須要一個kickstart文件,視頻中是從服務器獲取
centos 6改IP地址使用setup命令192.168.10.16 255.255.255.0 網關192.168.10.1
service network restart
ifconfig---查看ip地址有沒有配置上去
ssh root@192.168.10.16
vim /etc/ssh/sshd_config
UseDNS no---這裏改成no
service sshd reloadlinux

先配置dhcp服務
cd /etc/dhcp
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample ./dhcpd.conf
vim dhcpd.conf
option domain-name "mageedu.com";
option domain-name-servers 172.18.0.1;vim

default-lease-time 600;
max-lease-time 7200;centos

log-facility local7;服務器

subnet 192.168.10.0 netmask 255.255.255.224 {
range 192.168.10.151 192.168.10.160;
filename "pxelinux.0";
next-server 192.168.10.16;
}app

service dhcpd configtest
service dhcpd start
ss -unl---67端口
chkconfig dhcpd on---開機自動啓動

接下來準備tftp服務
chkconfig tftp on,也能夠編輯配置文件
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 = yes---這裏改成no
per_source = 11
cps = 100 2
flags = IPv4
}
service xinetd restart
chkconfig xinetd on
ss -unl---69號端口
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cd /tmp
tftp 192.168.10.16---這裏是測試tftp服務是否正常
get pxelinux.0

接下來就該複製光盤中的文件了,虛擬機掛載的是物理機中的光盤
mkdir /media/cdrom
mount -r /dev/cdrom /media/cdrom
ls /media/cdrom
cp /media/cdrom/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/
cp /media/cdrom/isolinux/{boot.msg,vesamenu.c32,splash.jpg} /var/lib/tftpboot
mkdir /var/lib/tftpboot/pxelinux.cfg/
cp /media/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
chmod +w /var/lib/tftpboot/pxelinux.cfg/default
vim /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32dom

timeout 600ssh

display boot.msgsocket

menu background splash.jpg
menu title Welcom to CentOS 6.7!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #fffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #00000000
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000ide

label zutoinst
menu label ^Auto Install CentOS---^表示ctrl,表示一個控制符,表示按A快速定位
menu default
kernel vmlinuz
append initrd=initrd.img
label linux
menu label ^Install or upgrade an existing system
kernel vmlinuz
append initrd=initrd.img
label vesa
menu lebel Install system with ^basic video driver
kernel vmlinuz
append initrd=initrd.img nomodeset---不作模式設定,啓動時使用600×480的基本顯卡驅動
label rescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue
label local
menu label Boot from ^local drive
localboot 0xffff
label memtest86
menu label ^Memory test
kernel memtest
append ~

接下來須要準備yum倉庫
mkdir /var/ftp/pub/centos
mount --bind /media/cdrom/ /var/ftp/pub/cnetos---這是綁定的方式
vim centos6.cfg---kickstart文件
firewall --disabledpost

install

url --url="ftp://192.168.10.16/pub/centos"

rootpw --iscrypted $1$iRHppr42$VMesh73wBqhUTjKp60Y0D.

auth --useshadow --passalgo=sha512

text
firstboot --disable

keyboard us

lang en_US

selinux --disabled

reboot

timezone Asia/Shanghai

bootloader --append="rhgb crashkernel=auto quiet" --location=mbr --driveorder="sda"

zerombr

clearpart --all

part /boot --fstype="ext4" --size=200
part pv.008 --size=61440

volgroup vg0 --pesize=8192 pv.008
logvol / --fstype=ext4 --name=root --vgname=vg0 --size=20480

----------------------------------#####如下沒用,只是示例
repo --name="Fedora EPEL" --baseurl=http://172.16.0.1/fedora-epel/6/x86_64/ --cost=1000

%post
echo -e 'Mage Education Learning Services\nhttp://www.magedu.com\n' >> /etc/issue

sed -i '1,$s@id:[0-9]:initdefault:@id:3:initdefault:@g' /etc/inittab

[ ! -d /root/.ssh ] && mkdir /root/.ssh && chmod og=--- /root.ssh

cat >> /root/.ssh/authorized_keys << EOF
ssh-rsa AAAAB3NzaC1y2EEA
f9w== root@server.magelinux.com
EOF

sed -i 's@certmaster = .*@certmaster = 172.16.0.1@g' /etc/certmaster/minion.conf
/sbin/chkconfig funcd off

ClientName=ifconfig eht0 | awk '/inet addr:/{print $2}' | awk -F. '{print $NF}'
sed -i "s@HOSTNAME=.*@HOSTNAME=client$ClientName.magelinux.com@g" /etc/sysconfig/networks

sed -i '/[main]/a server=server.magelinux.com' /etc/puppet/puppet.conf
/sbin/chkconfig puppet off

echo '172.16.0.1 server.magelinux.com server' >> /etc/hosts

%end

%packagesbr/>@base
@basic-desktopbr/>@chinese-support
@client-mgmt-tools
-------------------------------####以上沒用

cp centos6.cfg /var/ftp/pub/
service vsftpd start
ss -tnl---21號端口
lftp 192.168.10.16---測試一下

cd /var/lib/tftpboot/pxelinux.cfg/
vim default
default vesamenu.c32

timeout 600

display boot.msg

menu background splash.jpg
menu title Welcom to CentOS 6.7!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #fffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #00000000
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000

label zutoinstmenu label ^Auto Install CentOS---^表示ctrl,表示一個控制符,表示按A快速定位menu defaultkernel vmlinuzappend initrd=initrd.img ks=ftp://192.168.10.16/pub/centos6.cfg---添加ks文件label linuxmenu label ^Install or upgrade an existing systemkernel vmlinuzappend initrd=initrd.imglabel vesamenu lebel Install system with ^basic video driverkernel vmlinuzappend initrd=initrd.img nomodeset---不作模式設定,啓動時使用600×480的基本顯卡驅動label rescuemenu label ^Rescue installed systemkernel vmlinuzappend initrd=initrd.img rescuelabel localmenu label Boot from ^local drivelocalboot 0xfffflabel memtest86menu label ^Memory testkernel memtestappend ~

相關文章
相關標籤/搜索