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 [email protected]
vim /etc/ssh/sshd_config
UseDNS no---这里改为no
service sshd reload
先配置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;
default-lease-time 600;
max-lease-time 7200;
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;
}
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.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 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 --disabled
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== [email protected]
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 zutoinst
menu label ^Auto Install CentOS---^表示ctrl,表示一个控制符,表示按A快速定位
menu default
kernel vmlinuz
append initrd=initrd.img ks=ftp://192.168.10.16/pub/centos6.cfg---添加ks文件
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 ~