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

[经验分享] Kickstart同时部署多个操作系统

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-4-2 08:13:23 | 显示全部楼层 |阅读模式
#在日常企业运维环境中,难免会遇到使用多个Linux操作系统的情况,之前的Kickstart只能安装一种Linux版本的系统,如果每天都需要安装不同版本的Linux系统的话,怎么办呢?所以下面介绍如何在同一个时刻,使用Kickstart部署不同版本的Linux操作系统,实验环境同时部署RHEL6,RHEL7,Kickstart用的RHEL7系统;
#配置yum源
vim /etc/yum.repos.d/server.repo
[base]
name=rhel
baseurl=file:///mnt
enabled=1
gpgcheck=0

#挂在光盘
mount /dev/cdrom /mnt

#安装配置DHCP
yum -y install dhcp
cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf#dhcp根据实际环境配置
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.100 192.168.1.200;
  option domain-name-servers server.example.com;
  option domain-name "8.8.8.8";
  option routers 192.168.1.254;
  option broadcast-address 192.168.1.255;
  next-server 192.168.1.89;
  filename "pxelinux.0";
  default-lease-time 60000;
  max-lease-time 720000;
}

systemctl restart dhcpd.service#启动dhcp服务
systemctl enable dhcpd.service#随下次开机自动启动该服务

#安装配置tftp-server syslinux
yum -y install syslinux tftp-server
vim /etc/xinetd.d/tftp
disable=no#将yes修改no
systemctl restart xinetd.service
systemctl enable xinetd.service

#复制多系统启动文件
cd /var/lib/tftpboot
mkdir rhel6 rhel7#因为是多系统引导安装所以创建两个不同版本的文件夹,存放不同的引导文件
cd rhel7#rhel7文件夹里面存放rhel7的引导文件,需要手动挂载rhel7系统光盘拷贝引导文件
cp /mnt/isolinux/init.img .#复制到当前
cp /mnt/isolinux/vmlinuz .
cd ..#放回上一级目录
cd rhel6#rhel6文件夹里面存放rhel6的引导文件,需要手动挂载rhel6系统光盘拷贝拷贝文件
cp /mnt/isolinux/init.img .
cp /mnt/isolinux/vmlinuz .
cd ..#放回上一级目录
mkdir pxelinux.cfg
cd pxelinux.cfg
cp /mnt/isolinux/isolinux.cfg ./default#随便使用哪个系统版本的引导菜单都可以使用,复制过来修改名称为default做相应修改即可
vim default#编辑default文件
label rhel7
  kernel rhel7/vmlinuz#刚才创建了对应系统版本文件夹,所有vmlinuz前面加上rhel7
  append initrd=rhel7/initrd.img inst.ks=nfs:192.168.1.89:/rhel7/ks.cfg#initrd.img前面同样加上rhel7

label rhel6
  kernel rhel6/vmlinuz
  append initrd=rhel6/initrd.img ks=nfs:192.168.1.89:/rhel6/ks.cfg#rhel6的ks命令不一样,前面没有inst.
cd ..#返回上一级目录
vim boot.msg#创建一个安装提示文件
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++please enter rhel6 and rhel6 install system++++++

#安装配置NFS
yum -y install nfs*#系统默认没有安装则安装nfs服务
mkdir /rhel6 /rhel7#创建不同目录存放系统对应版本的安装文件
cd /rhel6
nohup cp -a /mnt/* . &#挂载rhel6光盘,在后台拷贝系统文件
cd /rhel7
nohup cp -a /mnt/* . &#挂载rhel7光盘,在后台拷贝系统文件
vim /etc/exports#nfs共享不同版本系统的文件
/rhel6192.168.1.0/24(rw,sync)
/rhel7192.168.1.0/24(rw,sync)
systemctl restart nfs-server.service
systemctl enable nfs-server.service

#配置Kickstart一键安装应答文件
yum -y install system-config-kickstgart
system-config-kickstart#图形化配置参数,也可以使用我下面生成的一键安装应答文件,rhel7.0里面没有图像化的安装包选择
#可以到/root/anaconda-ks.cfg里面进行拷贝安装图形化的命令到你自己手动创建的ks.cfg文件末行并保存
#rhel6一键安装文件
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
nfs --server=192.168.1.89 --dir=/rhel6
# Root password
rootpw --iscrypted $1$W4PTHaJU$Ru3MaEqhSmCqK6KDigdea.
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --enforcing
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone  Africa/Abidjan
# Network information
network  --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part / --fstype="ext4" --size=20000
part swap --fstype="swap" --size=2048
part /boot --fstype="ext4" --size=1024

%packages
@basic-desktop
@desktop-debugging
@desktop-platform
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@kde-desktop
@legacy-x
@remote-desktop-clients
@x11

%end
#rhel7一键安装文件
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'# Reboot after installation
reboot
# Root password
rootpw --iscrypted $1$6W4GNGL7$Cta9ZjhDcgJ3OBrd.iNSU1
# System timezone
timezone Africa/Abidjan --isUtc
# System language
lang en_US
# Firewall configuration
firewall --disabled
# Network information
network  --bootproto=dhcp --device=eth0
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --enforcing
# Use NFS installation media
nfs --server=192.168.1.89 --dir=/rhel7
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part / --fstype="xfs" --size=20000
part swap --fstype="swap" --size=4096
part /boot --fstype="xfs" --size=1024

%packages
@base
@core
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@multimedia
@print-client
@x11

%end

#复制生成的一键安装应答文件到不同版本文件夹中
cp ks.cfg /rhel6#这是rhel6系统的一键安装应答文件
cp ks.cfg /rhel7#这是rhel7系统的一键安装应答文件

#修改SELinux状态
vim /etc/sysconfig/selinux
SELINUX=permissive#默认的enforcing修改为permissive
setenforce 0#或者重启系统

#防火墙开放服务和端口号
firewall-cmd --permanent --add-port=111/tcp
firewall-cmd --permanent --add-port=111/udp
firewall-cmd --permanent --add-port=20048/tcp
firewall-cmd --permanent --add-port=20048/udp
firewall-cmd --permanent --add-port=69/udp
firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=dhcp
firewall-cmd --reload
#客户端从网络引导做安装测试,在弹出的黑色对话框里面输入rhel6或者rhel7进行安装系统


运维网声明 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-52978-1-1.html 上篇帖子: linux下DHCP服务器简单搭建 下篇帖子: DNS服务之bind编译安装详尽版 操作系统
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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