设为首页 收藏本站
查看: 2831|回复: 0

[经验分享] pxe和kistart的自动化安装系统

[复制链接]
累计签到:67 天
连续签到:1 天
发表于 2018-10-22 12:48:25 | 显示全部楼层 |阅读模式
本帖最后由 baodeyun 于 2018-10-22 12:51 编辑

1540183303(1).jpg 桌面安装:
本机ip:192.168.1.20
vmareworkstation 10.0Centos6.5 桌面安装
关闭selinux和防火墙
临时关闭:
service iptables stop
setenforce 0
永久关闭:
vim/etc/sysconfig/iptables
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
vim /etc/selinux/config
SELINUX=disabled
reboot  
安装完成后配置本地yum
上传 CentOS-6.5-x86_64-bin-DVD1.iso root目录下
mkdir /mnt/cdrom
vim /etc/rc.d/rc.local
/bin/mount -o loop /root/CentOS-6.5-x86_64-bin-DVD1.iso/mnt/cdrom
vim /etc/yum.ropos.d/Centos-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
yum clean all
yum makecache
                                                
安装dhcp服务
yum install -y dhcp
vim /etc/dhcp/dhcpd.conf
option domain-name "test"; #指定网站域名
option domain-name-servers 8.8.8.8,114.114.114.114;#域名服务器多个ip用逗号隔开
default-lease-time 6000;#默认租约时长时间是秒
max-lease-time 7200;#最大租约时长
subnet 192.168.1.0 netmask 255.255.255.0{ # DHCP服务器自身网段及子网掩码
range 192.168.1.100 192.168.1.200;#地址池动态分配ip地址的范围
option routers 192.168.1.1;#路由地址
next-server 192.168.1.20;#tftp服务器的ip地址
filename "pxelinux.0";#pxe启动引导文件
}
service dhcpd configtest
service dhcpd start
chkconfig--level 35 on

测试:


说明dhcp服务正常。
安装tftp服务
yum install -ytftp-server tftp xinetd  syslinux
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                 = no
       per_source              = 11
       cps                     = 100 2
       flags                   = IPv4
}
cp/mnt/cdrom/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/ #复制内核相关信息
cp /mnt/cdrom/isolinux/{boot.msg,splash,vesamenu.32}/var/lib/tftpboot/ #复制启动图像菜单相关文件
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/#复制引导文件
mkdir /var/lib/tftpboot/pxelinux.cfg
cp /mnt/cdrom//var/lib/tftpboot/pxelinux.cfg/default
vim/var/lib/ftfpboot/pxelinux.cfg/default
default vesamenu.c32 #默认加载的菜单引导程序启动图像界面不可修改
#prompt 1
timeout 600  #设置超时时间
display boot.msg #显示主菜单
menu background splash.jpg #设置菜单背景图片
menu title Welcome to CentOS 6.5! #设置菜单主题
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
menu default
kernel vmlinuz #设置内核文件位置
  append initrd=initrd.imgks=http://192.168.1.20/ks.cfg #设置启动加载的kickstart位置
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
localboot 0xffff
label memtest86
menu label ^Memory test
kernel memtest
append -
安装http服务
yum install -y httpd
mkdir /var/www/html/cdrom
mount --bind /mnt/cdrom/var/www/html/cdrom
cp /root/anaconda-ks.cfg/var/www/html/ks.cfg
vim /var/www/html/ks.cfg
# Kickstart file automatically generatedby anaconda.
#version=DEVEL
##制定安装源
install
url --url=http://192.168.1.20/cdrom
repo --name="CentOS"  --baseurl=http://192.168.1.20/cdrom  --cost=100
lang en_US.UTF-8
keyboard usauthconfig --enableshadow--passalgo=sha512
selinux --disabled
timezone --utc Asia/Shanghai
# The following is the partitioninformation you requested
# Note that any partitions you deletedare not expressed
# here so unless you clear allpartitions first, this is
# not guaranteed to work
#clearpart --none
#part /boot --fstype=ext4 --size=200
#part swap --size=2048
#part / --fstype=ext4 --grow --size=200
#软件包
%packages
# Kickstart file automatically generatedby anaconda.
#version=DEVEL
install
url --url=http://192.168.1.20/cdrom
repo --name="CentOS"  --baseurl=http://192.168.1.20/cdrom  --cost=100
lang en_US.UTF-8
keyboard us
authconfig --enableshadow--passalgo=sha512
selinux --disabled
timezone --utc Asia/Shanghai
bootloader --location=mbr--driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partitioninformation you requested
# Note that any partitions you deletedare not expressed
# here so unless you clear allpartitions first, this is
# not guaranteed to work
#clearpart --none
#part /boot --fstype=ext4 --size=200
#part swap --size=2048
#part / --fstype=ext4 --grow --size=200
#软件包
%packages
@base
@core
@debugging
@basic-desktop
@desktop-debugging
@desktop-platform
@directory-client
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-applications
@internet-browser
@java-platform
配置完成,启动httpd服务
service httpd start
chkconfig httpd on
在自动化的安装过程中,出现如下错误:
原因是设置的虚拟内存太小,将内存file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg调整大一些就可以。
全制动安装的配置:
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                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
cd /var/lib/tftp
file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image003.png

file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image004.png
每个操作系统的镜像的引导文件单独存放。
vim /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
#prompt 1
timeout 200
menu background splash.jpg
menu title Welcome to PXE memu
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 1
  menu label ^Install or updatecentos6.5_x86_64
  kernel centos6.5/vmlinuz
  appendinitrd=centos6.5/initrd.img ks=http://192.168.1.20/cs6.5.cfg
label 2
  menu label ^Install or updatecentos6.4_x86_64
  kernelcentos6.4/vmlinuz
  appendinitrd=centos6.4/initrd.img ks=http://192.168.1.20/cs6.4.cfg
label 3
  menu label ^Install or updatecentos7_x86_64
  kernel centos7/vmlinuz
  appendinitrd=centos7/initrd.img ks=http://192.168.1.20/cs7.cfg
label local
  menu label Boot from ^local drive
  localboot 0xffff
label memtest86
  menu label ^Memory test
  kernel memtest
  append -

1540183791(1).jpg
1540183802(1).jpg
1540183778(1).jpg

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-625003-1-1.html 上篇帖子: 日志轮询 下篇帖子: google的二次认证的搭建
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表