1.1 环境说明

  1. [root@test ~]# cat /etc/redhat-release
  2. CentOS release 6.9 (Final)
  3.  
  4. [root@test ~]# uname -r
  5. 2.6.32-696.el6.x86_64
  6.  
  7. [root@test ~]# getenforce
  8. Disabled
  9.  
  10. [root@test ~]# /etc/init.d/iptables status
  11. iptables: Firewall is not running.
  12.  
  13. [root@test ~]# ifconfig eth0|awk -F "[ :]+" 'NR==2 {print $4}'
  14. 10.0.0.250
  15.  
  16. [root@test ~]# hostname
  17. test

1.2 配置DHCP

1.2.1 安装dhcp

  1. yum -y install dhcp
  2. rpm -ql dhcp |grep "dhcpd.conf"

1.2.2 编写配置文件

  1. [root@test ~]# cat /etc/dhcp/dhcpd.conf
  2. #
  3. # DHCP Server Configuration file.
  4. # see /usr/share/doc/dhcp*/dhcpd.conf.sample
  5. # see 'man 5 dhcpd.conf'
  6. #
  7. subnet 10.0.0.0 netmask 255.255.255.0 {
  8.  
  9. range 10.0.0.100 10.0.0.200;
  10.  
  11. option subnet-mask 255.255.255.0;
  12.  
  13. default-lease-time 21600;
  14.  
  15. max-lease-time 43200;
  16.  
  17. next-server 10.0.0.250;
  18.  
  19. filename "/pxelinux.0";
  20.  
  21. }

----------------------------------------------------------------

# 注释

range 10.0.0.100 10.0.0.200;         # 可分配的起始IP-结束IP

option subnet-mask 255.255.255.0;    # 设定netmask

default-lease-time 21600;            # 设置默认的IP租用期限

max-lease-time 43200;                # 设置最大的IP租用期限

next-server 10.0.0.250;                # 告知客户端TFTP服务器的ip

filename "/pxelinux.0";              # 告知客户端从TFTP根目录下载pxelinux.0文件

1.2.3 启动服务

  1. [root@test ~]# /etc/init.d/dhcpd start
  2. Starting dhcpd: [ OK ]
  3. [root@test ~]# netstat -tunlp|grep dhcp
  4. udp 0 0 0.0.0.0:67 0.0.0.0:* 4578/dhcpd

1.3 安装TFTP服务

1.3.1 安装tftp服务

  1. [root@linux-node1 ~]# yum -y install tftp-server

1.3.2 编写xindetd下的配置文件

  1. [root@linux-node1 ~]# vim /etc/xinetd.d/tftp
  2. # default: off
  3. # description: The tftp server serves files using the trivial file transfer \
  4. # protocol. The tftp protocol is often used to boot diskless \
  5. # workstations, download configuration files to network-aware printers, \
  6. # and to start the installation process for some operating systems.
  7. service tftp
  8. {
  9. socket_type = dgram
  10. protocol = udp
  11. wait = yes
  12. user = root
  13. server = /usr/sbin/in.tftpd
  14. server_args = -s /var/lib/tftpboot # 指定目录,保持默认,不用修改
  15. disable = no # 由原来的yes改为no
  16. per_source = 11
  17. cps = 100 2
  18. flags = IPv4
  19. }

1.3.3 启动服务,让xinetd 管理

  1. [root@linux-node1 ~]# /etc/init.d/xinetd restart
  2. Stopping xinetd: [FAILED]
  3. Starting xinetd: [ OK ]

1.3.4 检查端口

  1. [root@linux-node1 ~]# netstat -tunlp|grep 69
  2. udp 0 0 0.0.0.0:69 0.0.0.0:* 1106/xinetd

1.4 配置HTTP服务

1.4.1 安装nginx的依赖包(pcre-devel openssl-devel)

  1. yum install -y pcre-devel openssl-devel

1.4.2 下载nginx软件

  1. wget http://nginx.org/download/nginx-1.10.3.tar.gz

解压软件

  1. tar xf nginx-1.10.3.tar.gz

1.4.3 创建管理用户 www

  1. useradd -M -s /sbin/nologin www

1.4.4  nginx软件编译安装过程

1、配置软件,在软件的解压目录中

  1. [root@web01 nginx-1.10.3]# ./configure --prefix=/application/nginx-1.10.3 --user=www --group=www --with-http_stub_status_module --with-http_ssl_module

通过软件编译过程中的返回值是否正确,确认配置是否正确

  1. [root@web01 nginx-1.10.3]# echo $?
  2. 0

2、编译软件

  1. [root@web01 nginx-1.10.3]# make

3、编译安装

  1. [root@web01 nginx-1.10.3]# make install

1.4.5 创建软连接

  1. [root@web01 application]# ln -s /application/nginx-1.10.3/ /application/nginx

1.4.6 修改nginx配置文件

添加一行配置,作用是显示目录里的所文件

  1. [root@test html]# vim ../conf/nginx.conf
  2. worker_processes 1;
  3. events {
  4. worker_connections 1024;
  5. }
  6. http {
  7. include mime.types;
  8. default_type application/octet-stream;
  9. sendfile on;
  10. keepalive_timeout 65;
  11. server {
  12. listen 80;
  13. server_name localhost;
  14. location / {
  15. autoindex on;
  16. root html;
  17. index index.html index.htm;
  18. }
  19. error_page 500 502 503 504 /50x.html;
  20. location = /50x.html {
  21. root html;
  22. }
  23. }
  24. }

1.4.7 启动程序

  1. [root@web01 application]# /application/nginx/sbin/nginx
  2. [root@web01 application]#

检查是否启动

  1. [root@web01 application]# ps -ef |grep nginx
  2. root 26548 1 0 20:13 ? 00:00:00 nginx: master process /application/nginx/sbin/nginx
  3. www 26549 26548 0 20:13 ? 00:00:00 nginx: worker process
  4. root 26551 23431 3 20:13 pts/0 00:00:00 grep --color=auto nginx

检查端口信息

  1. [root@web01 application]# netstat -lntup |grep 80
  2. tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 26548/nginx

1.5 挂载光盘

1.5.1 删除默认的主页文件,创建挂载目录

  1. cd /application/nginx-1.10.3/html && \rm *.html
  2. mkdir -p /application/nginx-1.10.3/html/ios

1.5.2 挂载光盘

  1. mount /dev/cdrom /application/nginx-1.10.3/html/ios/

1.5.3 检查挂载信息

  1. [root@test html]# df -h
  2. Filesystem Size Used Avail Use% Mounted on
  3. /dev/sda3 19G 1.8G 16G 10% /
  4. tmpfs 238M 0 238M 0% /dev/shm
  5. /dev/sda1 190M 40M 141M 22% /boot
  6. /dev/sr0 3.7G 3.7G 0 100% /application/nginx-1.10.3/html/ios/

1.6 配置支持PXE的启动程序

安装syslinux

  1. yum -y install syslinux

复制启动菜单程序文件

  1. [root@test ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
  2. [root@test ~]# cp -a /application/nginx-1.10.3/html/isolinux/* /var/lib/tftpboot/
  3. [root@test ~]# ls /var/lib/tftpboot/
  4. boot.cat grub.conf isolinux.bin memtest splash.jpg vesamenu.c32
  5. boot.msg initrd.img isolinux.cfg pxelinux.0 TRANS.TBL vmlinuz

新建一个pxelinux.cfg目录,存放客户端的配置文件。

  1. mkdir -p /var/lib/tftpboot/pxelinux.cfg
  2. cp -a /application/nginx-1.10.3/html/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

1.11 整合编辑default配置文件

  1.  
  1. [root@test ks_config]# cat /var/lib/tftpboot/pxelinux.cfg/default
  2. default ks
  3. prompt 0
  4. timeout 600
  5.  
  6. display boot.msg
  7.  
  8. menu background splash.jpg
  9. menu title Welcome to CentOS 6.9!
  10. menu color border 0 #ffffffff #00000000
  11. menu color sel 7 #ffffffff #ff000000
  12. menu color title 0 #ffffffff #00000000
  13. menu color tabmsg 0 #ffffffff #00000000
  14. menu color unsel 0 #ffffffff #00000000
  15. menu color hotsel 0 #ff000000 #ffffffff
  16. menu color hotkey 7 #ffffffff #ff000000
  17. menu color scrollbar 0 #ffffffff #00000000
  18.  
  19. label linux
  20. menu label ^Install or upgrade an existing system
  21. menu default
  22. kernel vmlinuz
  23. append initrd=initrd.img
  24. label vesa
  25. menu label Install system with ^basic video driver
  26. kernel vmlinuz
  27. append initrd=initrd.img nomodeset
  28. label rescue
  29. menu label ^Rescue installed system
  30. kernel vmlinuz
  31. append initrd=initrd.img rescue
  32. label local
  33. menu label Boot from ^local drive
  34. localboot 0xffff
  35. label memtest86
  36. menu label ^Memory test
  37. kernel memtest
  38. append -
  39. label ks
  40. kernel vmlinuz
  41. append initrd=initrd.img ks=http://10.0.0.250/ks_config/CentOS-6.9-ks.cfg
  1.  

1.9.1 编写ks文件

  1.  
  1. [root@test ~]# grub-crypt
  2. Password: 123456
  3. Retype password: 123465
  4. $6$OH3zrKw7ruG5mtIh$8bV2RhvoB72VCIXYY.2ROFi8AOLdI3lHGB.rkGDEhlqxTZduPE3VoJW2OIZRA1y9Gw4Zka461IBZ9VuIIaNqK.
  1.  

创建ks文件存放目录

  1.  
  1. [root@test ~]# mkdir /application/nginx-1.10.3/html/ks_config -p
  1.  

ks文件内容

  1.  
  1. [root@test ks_config]# cat /application/nginx-1.10.3/html/ks_config/CentOS-6.9-ks.cfg
  2. # Kickstart Configurator for CentOS 6.9 by hou zhaoshun
  3. install
  4. url --url="http://10.0.0.250/ios/"
  5. text
  6. lang en_US.UTF-8
  7. keyboard us
  8. zerombr
  9. bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
  10. network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS6
  11. timezone --utc Asia/Shanghai
  12. authconfig --enableshadow --passalgo=sha512
  13. rootpw --iscrypted $6$X20eRtuZhkHznTb4$dK0BJByOSAWSDD8jccLVFz0CscijS9ldMWwpoCw/ZEjYw2BTQYGWlgKsn945fFTjRC658UXjuocwJbAjVI5D6/
  14. clearpart --all --initlabel
  15. part /boot --fstype=ext4 --asprimary --size=200
  16. part swap --size=768
  17. part / --fstype=ext4 --grow --asprimary --size=200
  18. firstboot --disable
  19. selinux --disabled
  20. firewall --disabled
  21. logging --level=info
  22. reboot
  23. %packages
  24. @base
  25. @compat-libraries
  26. @debugging
  27. @development
  28. tree
  29. nmap
  30. sysstat
  31. lrzsz
  32. dos2unix
  33. telnet
  34. %post
  35. wget -O /tmp/optimization.sh http://10.0.0.250/ks_config/optimization.sh &>/dev/null
  36. /bin/sh /tmp/optimization.sh
  37. %end
  1.  

1.10 编写开机优化脚本

  1.  
  1. [root@test ks_config]# cat /application/nginx-1.10.3/html/ks_config/optimization.sh
  2. #!/bin/bash
  3. ##############################################################
  4. # File Name: /var/www/html/ks_config/optimization.sh
  5. # Version: V1.0
  6. # Author: houzhaoshun
  7. # Organization: blog.znix.top
  8. # Created Time : 2017-10-23
  9. # Description: Linux system initialization
  10. ##############################################################
  11. . /etc/init.d/functions
  12. Ip=10.0.0.250
  13. Port=80
  14. ConfigDir=ks_config
  15. # Judge Http server is ok?
  16. PortNum=`nmap $Ip -p $Port 2>/dev/null|grep open|wc -l`
  17. [ $PortNum -lt 1 ] && {
  18. echo "Http server is bad!"
  19. exit 1
  20. }
  21. # Defined result function
  22. function Msg(){
  23. if [ $? -eq 0 ];then
  24. action "$1" /bin/true
  25. else
  26. action "$1" /bin/false
  27. fi
  28. }
  29. # Defined IP function
  30. function ConfigIP(){
  31. Suffix=`ifconfig eth0|awk -F "[ .]+" 'NR==2 {print $6}'`
  32. cat >/etc/sysconfig/network-scripts/ifcfg-eth0 <<-END
  33. DEVICE=eth0
  34. TYPE=Ethernet
  35. ONBOOT=yes
  36. NM_CONTROLLED=yes
  37. BOOTPROTO=none
  38. IPADDR=10.0.0.$Suffix
  39. PREFIX=24
  40. GATEWAY=10.0.0.254
  41. DNS1=223.5.5.5
  42. DEFROUTE=yes
  43. IPV4_FAILURE_FATAL=yes
  44. IPV6INIT=no
  45. NAME="System eth0"
  46. END
  47. Msg "config eth0"
  48. }
  49. # Defined Yum source Functions
  50. function yum(){
  51. YumDir=/etc/yum.repos.d
  52. [ -f "$YumDir/CentOS-Base.repo" ] && cp $YumDir/CentOS-Base.repo{,.ori}
  53. wget -O $YumDir/CentOS-Base.repo http://$Ip:$Port/$ConfigDir/CentOS-Base.repo &>/dev/null &&\
  54. wget -O $YumDir/epel.repo http://$Ip:$Port/$ConfigDir/epel.repo &>/dev/null &&\
  55. Msg "YUM source"
  56. }
  57. # Defined Hide the system version number Functions
  58. function HideVersion(){
  59. [ -f "/etc/issue" ] && >/etc/issue
  60. Msg "Hide issue"
  61. [ -f "/etc/issue.net" ] && > /etc/issue.net
  62. Msg "Hide issue.net"
  63. }
  64. # Defined OPEN FILES Functions
  65. function openfiles(){
  66. [ -f "/etc/security/limits.conf" ] && {
  67. echo '* - nofile 65535' >> /etc/security/limits.conf
  68. Msg "open files"
  69. }
  70. }
  71. # Defined Kernel parameters Functions
  72. function kernel(){
  73. KernelDir=/etc
  74. [ -f "$KernelDir/sysctl.conf" ] && /bin/mv $KernelDir/sysctl.conf{,.ori}
  75. wget -O $KernelDir/sysctl.conf http://$Ip:$Port/$ConfigDir/sysctl.conf &>/dev/null
  76. Msg "Kernel config"
  77. }
  78. # Defined System Startup Services Functions
  79. function boot(){
  80. for oldboy in `chkconfig --list|grep "3:on"|awk '{print $1}'|grep -vE "crond|network|rsyslog|sshd|sysstat"`
  81. do
  82. chkconfig $oldboy off
  83. done
  84. Msg "BOOT config"
  85. }
  86. # Defined Time Synchronization Functions
  87. function Time(){
  88. echo "#time sync by houzhaoshun at $(date +%F)" >>/var/spool/cron/root
  89. echo '*/5 * * * * /usr/sbin/ntpdate time.nist.gov &>/dev/null' >>/var/spool/cron/root
  90. Msg "Time Synchronization"
  91. }
  92. # Defined main Functions
  93. function main(){
  94. ConfigIP
  95. yum
  96. HideVersion
  97. openfiles
  98. kernel
  99. boot
  100. Time
  101. }
  102. main
  103. # rz上传CentOS-Base.repo、epel.repo、sysctl.conf
  1.  
 

kickstart安装步骤的更多相关文章

  1. 基于Centos6.x定制化安装步骤

    1.获取安装界面代码      挂载image/install.img:mount image/install.img /mnt/5 -o loop      复制挂载后的代码至self_intall ...

  2. 架构师成长之路2.2-PXE+Kickstart安装部署

    点击返回架构师成长之路 架构师成长之路2.2-PXE+Kickstart安装部署 系统测试环境: 实验环境:VMware Workstation 12 系统平台:CentOS Linux releas ...

  3. cobbler+kickstart安装笔记

    cobbler+kickstart安装笔记 本文参考老男孩配置:https://blog.oldboyedu.com/autoinstall-cobbler/ centos7:开机如果不启动网卡,需要 ...

  4. 如何搭建SVN服务器,详细安装步骤。

    SVN服务器端安装 下载: VisualSVN是一款图形化svn服务器.官网 http://www.visualsvn.com/server/ 下载地址: http://www.visualsvn.c ...

  5. arcgis10.2.2桌面版具体的安装步骤过程

    先声明一下,这里的截图虽说是ArcGIS10.1版本的,但是安装步骤是对的,本人用ArcGIS10.2.2软件测试成功安装上 一.ArcGIS许可证管理器安装 1.在软件包文件夹license man ...

  6. LoadRunner 11 安装步骤

    loadrunner 安装步骤: LoadRunner11下载:  在网上可以搜索到,在这个就不提供了. LoadRunner11原理: 破解方法和以前版本相同,我用的是LR8.0的破解文件,同样实用 ...

  7. MySQL安装步骤

    MySQL安装步骤 1. 下载MySQL Community Server 5.6.21,注意选择系统类型(32位/64位) 2. 解压MySQL压缩包 将以下载的MySQL压缩包解压到自定义目录下. ...

  8. Java开发工具安装步骤内容如下

    Java开发工具安装步骤内容如下 安装 开发工具 STS 链接下载网址 eclipse 链接下载网址 JDK安装 jdk链接下载地址 Marven环境 marven链接下载地址 Tomcat tomc ...

  9. PhantomJS linux系统下安装步骤及使用方法(网页截屏功能)

    PhantomJS 是一个基于 WebKit 的服务器端 JavaScript API.它全面支持web而不需浏览器支持,其快速,原生支持各种Web标准: DOM 处理, CSS 选择器, JSON, ...

随机推荐

  1. JQuery EasyUI 动态改变表单项的验证守则

    //JQuery EasyUI 动态改变表单项的验证规则 $(document).ready(function(){ $('#FILE_QUALITY').combobox({ onChange:fu ...

  2. STL - Predicate - Binary Predicate(双参判断式)

    Binary Predicate(双参判断式)的用途是:比较两个参数的特定属性 我们先建一个领域模型类: Person.h #ifndef _Domain_Models_Person_H_ #defi ...

  3. KineticJS教程(5)

    KineticJS教程(5) 作者: ysm  5.事件响应 5.1.图形的事件响应 图形对象对事件的响应处理可以使用 on() 方法绑定事件类型和相应方法. On() 方法需要一个事件类型参数和相应 ...

  4. poj 3311 Hie with the Pie dp+状压

    Hie with the Pie Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4671   Accepted: 2471 ...

  5. SQL SERVER: 合并相关操作(Union,Except,Intersect)

    SQL SERVER: 合并相关操作(Union,Except,Intersect) use tempdb create table tempTable1 (id int primary key id ...

  6. $.post以后就取不到$(this)节点解决方法【转】

    在作用域开头最好把以后要用的this指针存起来 a.click(function(){ var $this=$(this); $.get("/a").always( $this.v ...

  7. Oracle 角色、权限

    Oracle 角色管理 一.何为角色     角色:角色是一组权限的集合,将角色赋给一个用户,这个用户就拥有了这个角色中的所有权限.二.系统预定义角色 预定义角色是在数据库安装后,系统自动创建的一些常 ...

  8. Quartz+SpringMVC实现web定时管理任务

    代码地址如下:http://www.demodashi.com/demo/13978.html 使用背景 相信大家在工作过程中,肯定会遇到很多任务定时执行,修改定时任务的时间,执行一次定时任务等等.下 ...

  9. C# 非顶端窗口截图 - 用于查找指定窗口并截图

    原文地址:http://blog.csdn.net/u013096568/article/details/53400389 panel上可以通过DrawToBitmap截图,不管是否在屏幕外是否有遮挡 ...

  10. storm trident merger

    import java.util.List; import backtype.storm.Config; import backtype.storm.LocalCluster; import back ...