Kickstart Server System: CentOS 5.10 64-bit
IP Address: 192.168.21.128
Need to install a deployed Linux system: CentOS 5.10 64-bit
Eth0 (first network card, for extranet) IP address segment: 192.168.21.160-192.168.21.200
ETH1 (second network card, for intranet) IP address segment: 10.0.0.160-10.0.0.200
Subnet Mask: 255.255.255.0
All servers support PXE network boot
to achieve the purpose: deploy Linux systems in bulk by configuring Kickstart servers
Part I: Operating in the Kickstart server system
#SELINUXTYPE =targeted #注释掉
Second, configure the firewall, open tcp:80 port, udp:69 port
Vi/etc/sysconfig/iptables #编辑
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT #http服务需要此端口
-A rh-firewall-1-input-m state--state new-m udp-p UDP--dport 69-j ACCEPT #tftp服务需要此端口
/etc/init.d/iptables Restart #最后重启防火墙使配置生效
Third, install HTTP server
Chkconfig httpd on #设置开机启动
Four, mount system installation mirroring to the HTTP Server site Directory
Upload system installation image file Centos-5.10-x86_64-bin-dvd-1of2.iso to/usr/local/src/directory
Mkdir-p/var/www/html/os #创建挂载目录
Mount-t Iso9660-o Loop/usr/local/src/centos-5.10-x86_64-bin-dvd-1of2.iso/var/www/html/os #挂载系统镜像
Vi/etc/fstab #添加以下代码. Enable automatic mount on boot
/usr/local/src/centos-5.10-x86_64-bin-dvd-1of2.iso/var/www/html/os iso9660 defaults,ro,loop 0 0
Note: iso9660 use DF-T to view device uninstall: Umount/var/www/html/os
V. Installing a TFTP server
Yum Install TFTP tftp-server #安装
Server =/USR/SBIN/IN.TFTPD
Server_args =-s/var/lib/tftpboot
Cp/var/www/html/os/images/pxeboot/vmlinuz/var/lib/tftpboot
Cp/var/www/html/os/images/pxeboot/initrd.img/var/lib/tftpboot
Mkdir-p/var/lib/tftpboot/pxelinux.cfg
Cp/var/www/html/os/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default #拷贝启动菜单
Vi/var/lib/tftpboot/pxelinux.cfg/default #编辑修改
Append initrd=initrd.img ks=http://192.168.21.128/ks.cfg ksdevice=eth0 ip=dhcp
Append initrd=initrd.img Text
Append KS initrd=initrd.img
chmod 644/var/lib/tftpboot/pxelinux.cfg/default #设置文件权限
Yum Install Syslinux #安装引导程序
cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/#拷贝引导文件到tftp服务器根目录
Vi. Installing a DHCP server
Cp/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample/etc/dhcpd.conf #复制配置文件模板
Vi/etc/dhcpd.conf #编辑配置文件
Ddns-update-style Interim; #设置DHCP服务器模式
Ignore client-updates; #禁止客户端更新
Subnet 192.168.21.0 netmask 255.255.255.0 {#设置网段
Option routers 192.168.21.2; #设置网关
Option Subnet-mask 255.255.255.0; #设置子网掩码
Option Domain-name-servers 8.8.8.8,8.8.4.4; #设置dns服务器地址
Range DYNAMIC-BOOTP 192.168.21.160 192.168.21.200; #设置dhcp服务器IP地址租用的范围
Default-lease-time 21600; #默认租约时间
Max-lease-time 43200; #最大租约时间
Next-server 192.168.21.128; #tftp服务器地址
FileName "pxelinux.0"; #tftp服务器根目录下面的文件名
VI/ETC/SYSCONFIG/DHCPD #指定DHCP服务的网络接口
Service DHCPD Start #启动dhcp服务
Chkconfig DHCPD on #设置开机启动
System Yun-wei Www.111cn.net warm reminder: qihang01 original Content © Copyright, reproduced please specify the source and the original link
Vii. Configuring Kickstart automatic installation files
Yum Install System-config-kickstart #安装工具包
# Kickstart file automatically generated by Anaconda.
URL--url=http://192.168.21.128/os/
Network--device eth0--bootproto DHCP--onboot on
#network--device eth0--bootproto static--ip 192.168.21.250--netmask 255.255.255.0--gateway 192.168.21.2--nameserver 8.8.8.8--hostname CentOS5.10
ROOTPW--iscrypted $1$qqobzz1g$rynrawi9kyleeuuq1vcrs/
Firewall--enabled--port=22:tcp
Authconfig--enableshadow--ENABLEMD5
Bootloader--LOCATION=MBR--DRIVEORDER=SDA
# The following is the partition information for you requested
# that ' any partitions ' deleted are not expressed
# Here I unless you clear all partitions the
Clearpart--all--initlabel
Part/--bytes-per-inode=4096--fstype= "ext3"--size=2048
Part/boot--bytes-per-inode=4096--fstype= "ext3"--size=128
Part swap--bytes-per-inode=4096--fstype= "swap"--size=500
Part/data--bytes-per-inode=4096--fstype= "ext3"--grow--size=1
ECHO-E "0 1 * * * root/usr/sbin/ntpdate cn.pool.ntp.org >/dev/null" >>/etc/crontab
Useradd-g Maintain user01-d/home/maintain/user01-m
echo "123456" |passwd User01--stdin
Useradd-g Maintain user02-d/home/maintain/user02-m
echo "123456" |passwd user02--stdin
Useradd-g Maintain user03-d/home/maintain/user03-m
echo "123456" |passwd user03--stdin
Useradd-g Maintain user04-d/home/maintain/user04-m
echo "123456" |passwd user04--stdin
Sed-i "s/#PermitRootLogin yes/permitrootlogin no/g" '/etc/ssh/sshd_config '
Chkconfig yum-updatesd off
Chkconfig readahead_early on
#禁止使用Ctrl +alt+del shortcut keys to restart the server
Sed-i "S/ca::ctrlaltdel:/sbin/shutdown-t3-r now/#ca:: Ctrlaltdel:/sbin/shutdown-t3-r now/g" '/etc/inittab '
Echo-e "Ulimit-c Unlimited" >>/etc/profile
Echo-e "Ulimit-s Unlimited" >>/etc/profile
Echo-e "Ulimit-shn 65535" >>/etc/profile
Sed-i "S/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g" '/etc/sysctl.conf '
Echo-e "net.core.somaxconn = 262144" >>/etc/sysctl.conf
Echo-e "Net.core.netdev_max_backlog = 262144" >>/etc/sysctl.conf
Echo-e "Net.core.wmem_default = 8388608" >>/etc/sysctl.conf
Echo-e "Net.core.rmem_default = 8388608" >>/etc/sysctl.conf
Echo-e "Net.core.rmem_max = 16777216" >>/etc/sysctl.conf
Echo-e "Net.core.wmem_max = 16777216" >>/etc/sysctl.conf
Echo-e "Net.ipv4.netfilter.ip_conntrack_max = 131072" >>/etc/sysctl.conf
Echo-e "net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180" >>/etc/sysctl.conf
Echo-e "net.ipv4.route.gc_timeout =" >>/etc/sysctl.conf
Echo-e "Net.ipv4.ip_conntrack_max = 819200" >>/etc/sysctl.conf
Echo-e "Net.ipv4.ip_local_port_range = 10024 65535" >>/etc/sysctl.conf
Echo-e "Net.ipv4.tcp_retries2 = 5" >>/etc/sysctl.conf
Echo-e "net.ipv4.tcp_fin_timeout = >>/etc/sysctl.conf"
Echo-e "net.ipv4.tcp_syn_retries = 1" >>/etc/sysctl.conf
Echo-e "net.ipv4.tcp_synack_retries = 1" >>/etc/sysctl.conf
Echo-e "net.ipv4.tcp_timestamps = 0" >>/etc/sysctl.conf
Echo-e "net.ipv4.tcp_tw_recycle = 1" >>/etc/sysctl.conf
Echo-e "Net.ipv4.tcp_tw_len = 1" >>/etc/sysctl.conf
Echo-e "Net.ipv4.tcp_tw_reuse = 1" >>/etc/sysctl.conf
Echo-e "net.ipv4.tcp_keepalive_time =/etc/sysctl.conf" >>
Echo-e "Net.ipv4.tcp_keepalive_probes = 3" >>/etc/sysctl.conf
Echo-e "NET.IPV4.TCP_KEEPALIVE_INTVL =" >>/etc/sysctl.conf
Echo-e "net.ipv4.tcp_max_tw_buckets = 36000" >>/etc/sysctl.conf
Echo-e "Net.ipv4.tcp_max_orphans = 3276800" >>/etc/sysctl.conf
Echo-e "Net.ipv4.tcp_max_syn_backlog = 262144" >>/etc/sysctl.conf
Echo-e "Net.ipv4.tcp_wmem = 8192 131072 16777216" >>/etc/sysctl.conf
Echo-e "Net.ipv4.tcp_rmem = 32768 131072 16777216" >>/etc/sysctl.conf
Echo-e "Net.ipv4.tcp_mem = 94500000 915000000 927000000" >>/etc/sysctl.conf
wget http://192.168.21.128/autoip.sh
Eight, add script, automatically set Linux system static IP address, DNS, Gateway, computer name
route=$ (route-n|grep "^0.0.0.0" |awk ' {print $} ')
broadcast=$ (/sbin/ifconfig eth0|grep-i Bcast|awk ' {print $} ' |awk-f ': ' ' {print $} ')
hwaddr=$ (/sbin/ifconfig eth0|grep-i Hwaddr|awk ' {print $} ')
ipaddr=$ (/sbin/ifconfig eth0|grep "inet addr" |awk ' {print $} ' |awk-f ":" ' {print $} ')
netmask=$ (/sbin/ifconfig eth0|grep "inet addr" |awk ' {print $} ' |awk-f ': "' {print $} ')
Cat >/etc/sysconfig/network-scripts/ifcfg-eth0<<eof
ipaddr1=$ (Echo $IPADDR |awk-f "." ' {print $} ')
Cat >/etc/sysconfig/network-scripts/ifcfg-eth1<<eof
hwaddr=$ (/sbin/ifconfig eth1|grep-i Hwaddr|awk ' {print $} ')
hostname=osyunwei_hz_$ (Echo $IPADDR |awk-f "." ' {print $} ')
Cat >/etc/sysconfig/network<<eof
echo "127.0.0.1 $HOSTNAME" >>/etc/hosts
echo "NameServer 8.8.8.8" >/etc/resolv.conf
echo "NameServer 8.8.4.4" >>/etc/resolv.conf
Part Two: Set up the server to be installed from the network boot
After powering on, the system is installed automatically as shown in the following illustration
System Yun-wei Www.111cn.net warm reminder: qihang01 original Content © Copyright, reproduced please specify the source and the original link
Note: After the system installation is completed, the first boot please set to the hard disk, otherwise the system will automatically install the system again!