Kickstart同时部署多个操作系统

RHEL7 Kickstart同时部署多个操作系统

#在日常企业运维环境中,难免会遇到使用多个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进行安装系统

时间: 2024-08-07 08:37:11

Kickstart同时部署多个操作系统的相关文章

kickstart自动部署centos

kickstart自动部署centos 工作中,我们有时候需要安装几十上百台服务器,这种情况下用u盘或者光驱逐台安装,太花时间与人力,显然不现实,所以应该选择自动化部署操作系统的方式,自动化部署操作系统的工具有很多,这里我用的是kickstart这个工具. kickstart原理: kickStart是一种无人职守安装方式.KickStart的工作原理是通过记录典型的安装过程中所需人工干预填写的各种参数,并生成一个名为ks.cfg的文件:在其后的安装过程中(不只局限于生成KickStart安装文

Redhat 7 配置Kickstart自动化部署多种系统

使用kickstart自动化部署多种系统,我想到的有两种场景,一种适合于日常运维,当机房上架个别新增的服务器时,根据不同的用途需求,通过一个多系统的启动菜单,输入相应的操作系统名称,即可自动化部署对应的操作系统.例如我在网上看到如下图这样的方案: 但是在第二种场景即系统集成项目中,如果同时要安装50台.100台的话,每台都要去输入,那也真是令人蛋疼了.系统集成项目通常会遇到服务器数量较多.且不同的项目对操作系统的需求不同的情况,如果准备一台Kickstart一次只是推送一种操作系统的自动化部署,

安装部署Ubuntu Server操作系统

1. 如何部署Ubuntu Server操作系统 *本教程演示了如何按照Ubuntu 18.04操作系统.相同的说明适用于Ubuntu 16.04和任何基于Ubuntu的发行版. 先决条件* 1.1 下载Ubuntu Server 18.04 LTS 下载地址:http://cdimage.ubuntu.com/releases/18.04/release/ 1.2 创建DVD 以安装Ubuntu 以Windows操作系统标准功能创建安装引导光盘,请参阅以下内容. [1] 在DVD驱动器中插入空

自动化运维之kickstart自动化部署安装操作系统

第1章 简介 1.1 PXE简介 q  PXE是预启动执行环境,全名是Pre-boot Execution Environment q  通过网络接口启动计算机,不需要依赖本地存储设备或本地已安装的操作系统 q  由Intel和Systemsoft公司于1999年9月20日公布的技术 q  C/S的工作模式 q  PXE客户端会调用网际协议(IP).用户数据协议(UDP).动态主机分配协议(DHCP).小型文件传输协议(TFTP)等网络协议 1.2 kickstart简介 kickstart是一

PXE+kickstart一键部署操作系统

简介: 作为中小公司的运维,经常会遇到一些机械式的重复工作,例如:有时公司同时上线几十甚至上百台服务器,而且需要我们在短时间内完成系统安装. 常规的办法有什么?     光盘安装系统===>一个服务器DVD内置光驱百千块,百台服务器都配光驱就浪费了,因为一台服务器也就开始装系统能用的上,以后用的机会屈指可数.用USB外置光驱,插来插去也醉了. U盘安装系统===>还是同样的问题,要一台一台服务器插U盘. 网络安装系统(ftp,http,nfs) ===>这个方法不错,只要服务器能联网就可

Linux中级:PXE + Kickstart 安装CentOS 6.x 操作系统

一.前言 本文很大部分都是参考:http://www.cnblogs.com/mchina/p/centos-pxe-kickstart-auto-install-os.html 主要用于学习. 1.1 什么是pxe PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用

SCCM TP4部署Windows 10操作系统

SCCM服务器中一个重要的功能就是部署操作系统.SCCM提供了操作系统批量部署方案中的一个重要解决方案:零接触安装.总所周知,披露部署微软操作系统时有四种解决方案,标准镜像部署,定制镜像部署,轻接触部署,零接触部署.其中轻接触部署指的是把WDS和MDT接合起来进行操作系统部署,零接触部署就是SCCM结合WDS了.其实SCCM和MDT相比,基本功能大同小异,无法是任务序列等组件控制得可以更细腻一些.有MDT基础的朋友,实现SCCM部署操作系统并不困难.下面我们将通过一个例子为大家介绍,如何利用SC

DELL服务器PowerEdge系列部署Windows Server操作系统(官荐)

如果Windows是受支持的操作系统,推荐使用LifeCycle Controller完成部署. 在启动过程中按下F10以进入LCC 在左侧菜单中选择OS Deployment(操作系统部署) 单击Deploy OS(部署操作系统) 选择Configure RAID First(首先配置RAID)或Go Directly to OS Deployment(直接转到操作系统部署),具体取决于您是否已设置RAID 如果适用,根据需求按照向导的指示设置RAID磁盘 根据需求选择手动或自动安装 插入操作

如何将.Net Core应用程序部署在Linux操作系统上运行

.Net Core简介 跨平台: 可以在 Windows.macOS 和 Linux 操作系统上运行. 跨体系结构保持一致: 在多个体系结构(包括 x64.x86 和 ARM)上以相同的行为运行代码. 命令行工具: 包括可用于本地开发和持续集成方案中的易于使用的命令行工具. 部署灵活: 可以包含在应用或已安装的并行(用户或系统范围安装)中. 可搭配 Docker 容器使用. 兼容性: .NET Core 通过 .NET Standard与 .NET Framework.Xamarin 和 Mon