Nginx dhcp tftp Kickstart build Automatic Installation System
Previously, we used Cobbler to build an automatic installation system. Recently, the Cobbler website was http://www.cobblerd.org/lawless. We executed the command "Cobbler get-loaders" to download the file required for PXE startup 404. Even if the download was successful, the server installation system gets stuck after the IP address is automatically obtained. You have to find a solution and use Nginx dhcp tftp Kickstart to build an automatic installation system. Nginx is easy to install and configure, instead of Apache used in Cobbler.
Virtual Environment
Network Segment: 192.168.200.0
Mask: 255.255.255.0
Gateway: 192.168.200.2
Automatic Installation System address: 192.168.200.10
DHCP allocation address range: 192.168.200.11-192.168.200.254
1. install and configure Nginx
Download, compile, and install Nginx
Cd/App/src
Wget http://nginx.org/download/nginx-1.8.0.tar.gz
Tar zxf nginx-1.8.0.tar.gz
Cd nginx-1.8.0
./Configure \
-- Prefix =/App/nginx \
Without-http_access_module \
Without-http_auth_basic_module \
Without-http_browser_module \
Without-http_empty_gif_module \
Without-http_fastcgi_module \
Without-http_geo_module \
Without-http_limit_conn_module \
Without-http_limit_req_module \
Without-http_map_module \
Without-http_memcached_module \
Without-http_proxy_module \
Without-http_referer_module \
Without-http_rewrite_module \
Without-http_scgi_module \
Without-http_split_clients_module \
Without-http_ssi_module \
Without-http_upstream_hash_module \
Without-http_upstream_ip_hash_module \
Without-http_upstream_keepalive_module \
Without-http_upstream_least_conn_module \
Without-http_userid_module \
Without-http_uwsgi_module \
Without-mail_imap_module \
Without-mail_pop3_module \
Without-mail_smtp_module \
-- Without-pcre \
Without-poll_module \
Without-select_module
Make & make install
Modify the Nginx configuration file/App/nginx/conf/nginx. conf
User nginx;
Worker_processes auto;
Error_log logs/error. log error;
Pid logs/nginx. pid;
Worker_rlimit_nofile 65536;
Events
{
Use epoll;
Accept_mutex off;
Worker_connections 65536;
}
Http
{
Include mime. types;
Default_type text/html;
Charset UTF-8;
Server_names_hash_bucket_size 128;
Client_header_buffer_size 4 k;
Large_client_header_buffers 4 32 k;
Client_max_body_size 8 m;
Open_file_cache max = 65536 inactive = 60 s;
Open_file_cache_valid 80 s;
Open_file_cache_min_uses 1;
Log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request "'
'$ Status $ body_bytes_sent "$ http_referer "'
'"$ Http_user_agent" "$ http_x_forwarded_for "';
Access_log logs/access. log main;
Sendfile on;
Server_tokens off;
Keepalive_timeout 60;
Gzip on;
Gzip_min_length 1 k;
Gzip_buffers 4 64 k;
Gzip_http_version 1.1;
Gzip_comp_level 2;
Gzip_types text/plain text/css application/json application/javascript application/xml;
Server
{
Listen 80;
Server_name localhost;
Index index.html;
Root/App/web;
Autoindex on;
}
}
Create an Nginx running account and a Web directory
Useradd-s/bin/false-M nginx
Mkdir-p/App/web
Download the CentOS image iso file and import the Web directory
Cd/App/src
Wget http://mirrors.aliyun.com/centos/6.6/isos/x86_64/CentOS-6.6-x86_64-bin-DVD1.iso
CentOS-6.6-x86_64-bin-DVD1.iso/mnt
Rsync-avP/mnt // App/web/CentOS-6.6-x86_64
Start Nginx
/App/nginx/sbin/nginx
Ii. install and configure DHCP
Install dhcp server in Yum
Yum-y install dhcp
Modify the configuration dhcp file/etc/dhcp/dhcpd. conf
Allow booting;
Allow bootp;
Subnet 192.168.200.0 netmask 255.255.255.0 {
Option routers 192.168.200.2;
Option domain-name-servers 223.5.5.5, 223.6.6.6;
Option subnet-mask limit 255.0;
Range dynamic-bootp 192.168.200.11 192.168.200.254;
Filename "/pxelinux.0 ";
Default-lease-time 21600;
Max-lease-time 43200;
Next-server 192.168.200.10;
}
Start dhcp Service
/Etc/init. d/dhcpd start
3. install and configure TFTP
Install tftp server in Yum
Yum-y install tftp-server
Modify tftp configuration and start the xinetd service
Sed-I '/disable/s/yes/no/'/etc/xinetd. d/tftp
/Etc/init. d/xinetd start
Install the syslinux boot loader in Yum and copy the relevant files to the tftp root directory.
Yum-y install syslinux
Cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/
Cd/App/web/CentOS-6.6-x86_64/isolinux/
Cp vesamenu. c32 boot. msg splash.jpg vmlinuz initrd. img memtest/var/lib/tftpboot/
Mkdir-p/var/lib/tftpboot/pxelinux. cfg
Cp isolinux. cfg/var/lib/tftpboot/pxelinux. cfg/default
Modify the Startup Menu/var/lib/tftpboot/pxelinux. cfg/default. Note that the menu default configuration determines which option is enabled by default. In label linux, once the server is restarted, all partitions will be deleted and formatted, which is very dangerous, you must modify this item.
Default vesamenu. c32
Prompt 0
Timeout 60
Display boot. msg
Menu background splash.jpg
Menu title Welcome to CentOS 6.6!
Menu color border 0 # ffffffff #00000000
Menu color sel 7 # ffffffff # ff000000
Menu color title 0 # ffffffff #00000000
Menu color tabmsg 0 # ffffffff #00000000
Menu color unsel 0 # ffffffff #00000000
Menu color hotsel 0 # ff000000 # ffffffff
Menu color hotkey 7 # ffffffff # ff000000
Menu color scrollbar 0 # ffffffff #00000000
Label linux
Menu label ^ Install or upgrade an existing system
Kernel vmlinuz
Append initrd = initrd. img ks = http: // 192.168.200.10/CentOS-6.6-x86_64/ks. cfg ksdevice = em1
Label vesa
Menu label Install system with ^ basic video driver
Kernel vmlinuz
Append initrd = initrd. img xdriver = vesa nomodeset
Label rescue
Menu label ^ Rescue installed system
Kernel vmlinuz
Append initrd = initrd. img rescue
Label local
Menu label Boot from ^ local drive
Menu default
Localboot 0 xffff
Label memtest86
Menu label ^ Memory test
Kernel memtest
Append-
4. Add Kickstart Configuration
Add kickstart configuration file/App/Web/CentOS-6.6-x86_64/ks. cfg in the web directory
Install
Keyboard us
Lang zh_CN
Url -- url = http: // 192.168.200.10/CentOS-6.6-x86_64/
Network -- onboot yes -- device eth0 -- bootproto dhcp -- noipv6
Rootpw -- iscrypted $6 $ y0UTGMGnCEgUJmUB $ IPcaQ8ipx24V8lAq. decrypt
Auth -- useshadow -- passalgo = sha512
Reboot
Firewall -- disabled
Firstboot -- disable
Selinux -- disabled
Logging -- level = info
Timezone Asia/Shanghai
Bootloader -- location = mbr
Zerombr yes
Clearpart -- all -- initlabel
Part/boot -- fstype ext4-size = 200
Part swap -- size = 2048
Part/-- fstype ext4 -- size = 200 -- grow
% Packages
@ Chinese-support
@ Core
@ Server-policy
@ Workstation-policy
% End
% Post
ServiceList = 'chkconfig -- list | grep '0' | awk '{print $1}' | grep-Ev 'sshd | network | crond | syslog''
For Service in $ ServiceList
Do
/Etc/init. d/$ Service stop
Chkconfig -- level 0123456 $ Service off
Done
Cat>/etc/sysctl. conf <EOF
Vm. swappiness = 0
Net. core. rmem_default = 262144
Net. core. rmem_max = 16777216
Net. core. wmem_default = 262144
Net. core. wmem_max = 16777216
Net. core. somaxconn = 262144
Net. core. netdev_max_backlog = 262144
Net. ipv4.tcp _ max_orphans = 262144
Net. ipv4.tcp _ max_syn_backlog = 262144
Net. ipv4.tcp _ max_tw_buckets = 10000
Net. ipv4.ip _ local_port_range = 1024 65500
Net. ipv4.tcp _ tw_recycle = 1
Net. ipv4.tcp _ tw_reuse = 1
Net. ipv4.tcp _ syncookies = 1
Net. ipv4.tcp _ synack_retries = 1
Net. ipv4.tcp _ syn_retries = 1
Net. ipv4.tcp _ fin_timeout = 30
Net. ipv4.tcp _ keepalive_time = 1200
Net. ipv4.tcp _ mem = 786432 1048576 1572864
Fs. aio-max-nr = 1048576
Fs. file-max = 6815744
Kernel. sem = 250 32000 100 128
Fs. inotify. max_user_watches = 1048576
EOF
Sysctl-p
Cat>/etc/security/limits. conf <EOF
*-Nofile 1048576
*-Nproc 65536
*-Stack 1024
EOF
Cat>/etc/profile <EOF
Ulimit-n 1048576
Ulimit-u 65536
Ulimit-s 1024
Alias grep = 'grep -- color = auto'
Export HISTTIMEFORMAT = "% Y-% m-% d % H: % M: % S"
EOF
Sed-I's/SELINUX = enforcing/SELINUX = disabled/'/etc/selinux/config
Setenforce 0
Sed-I's/. * UseDNS yes/UseDNS no/'/etc/ssh/sshd_config
Sed-I's/. * GSSAPIAuthentication yes/GSSAPIAuthentication no/'/etc/ssh/sshd_config
/Etc/init. d/sshd restart
Cat> $ HOME/. bash_profile <EOF
Export PATH =/App/script: \ $ PATH
EOF
Mkdir-p/App/script/App/src
Mount -- bind/dev/shm/tmp
Echo "/bin/mount -- bind/dev/shm/tmp">/etc/rc. local
5. Check the listening ports of related services
Http: 80, dhcp: 67, tftp: 69
Netstat-tunlp | grep-E '(0.0.0.0: 80 | 0.0.0.0: 67 | 0.0.0.0: 69 )'
If the service is monitored
Basic Linux Tutorial: Automatic Installation of Linux Kickstart
Use PXE + DHCP + Apache + Kickstart to install CentOS5.8 x86_64
Linux PXE unattended installation of PXE-E32: TFTP OPen timeout Solution
Use PXE and kickstart to automatically install Linux
RHCE-certified unattended Linux system installation (FTP + TFTP + DHCP + Kickstart + PXE)
PXE network installation (on-duty and unattended installation)
This article permanently updates the link address: