2020-09-13

一. 使用 kickstart 半自动化安装CentOS系统
(1)安装并使用systemd-config-kickstart生成kickstart文件(此方法centos8不支持 )或修改当前系统安装过程中生成的kickstart文件/root/anaconda-ks.cfg生成新的kickstart文件

#version=DEVEL
install
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
url --url=http://10.0.0.8/centos/7/x86_64/
reboot
# Use graphical install
#graphical
# Run the Setup Agent on first boot
#firstboot --enable
#ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp --device=eth0 --ipv6=auto --activate
network  --hostname=centos7

# Root password
rootpw --iscrypted 123
# System services
services --enabled="chronyd"
# System timezone
timezone America/New_York --isUtc
user --name=rc --password=$6$XTqSWSOPbhJ73M.V$DET94VIaVy8a.9r.Zs1Obw5t/LjesDGKWMfVytxhoMbjWTQ7bpioHN9RR6OWxO7puDanKToZB6cLth4Ri5I491 --iscrypted --gecos="RC"
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part / --fstype="xfs" --ondisk=sda --size=102400
part /boot --fstype="xfs" --ondisk=sda --size=1024
part swap --fstype="swap" --ondisk=sda --size=2048
part /data --fstype="xfs" --ondisk=sda --size=51200

%packages
@^minimal
@core
chrony
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

(2)开启主机光盘启动,按ESC进去boot:输入linux ks=http://10.0.0.8/ksdir/ks7.cfg回车开始安装
二.实现pxe安装双系统centos6、centos7
(1)现在一台主机上配置dhcp服务器、tftp服务器、http服务
dhcp服务器

option domain-name "RC.org";
option domain-name-servers 180.76.76.76,223.5.5.5; 

default-lease-time 86400;
max-lease-time 7200;
log-facility local7;
subnet 10.0.0.0 netmask 255.255.255.0 {
	range 10.0.0.50 10.0.0.200;
	option routers 10.0.0.2; 
	next-server 10.0.0.8;
	filename "pxelinux.0";
}


tftp服务器

[15:22:11 root@centos8 tftpboot ]#tree .
.
├── centos6
│   ├── initrd.img
│   └── vmlinuz
├── centos7
│   ├── initrd.img
│   └── vmlinuz
├── centos8
│   ├── initrd.img
│   └── vmlinuz
├── ldlinux.c32
├── libcom32.c32
├── libutil.c32
├── menu.c32
├── pxelinux.0
└── pxelinux.cfg
    └── default

http

/dev/sr2         3897932 3897932         0 100% /var/www/html/centos/6/x86_64
/dev/sr1         6967726 6967726         0 100% /var/www/html/centos/8/x86_64
/dev/sr0         1059254 1059254         0 100% /var/www/html/centos/7/x86_64


[15:26:40 root@centos8 ksdir ]#ll
total 12
-rw-r--r-- 1 root root  941 Sep 13 13:02 ks6.cfg
-rw-r--r-- 1 root root 1553 Sep 13 14:41 ks7.cfg
-rw-r--r-- 1 root root 1438 Sep 13 12:17 ks8.cfg

菜单文件

default menu.c32
timeout 60
menu title CentOS Linux 

label linux8
  menu label ^Auto Install CentOS Linux 8
  kernel centos8/vmlinuz
  append initrd=centos8/initrd.img ks=http://10.0.0.8/ksdir/ks8.cfg 

label linux7
  menu label ^Auto Install CentOS Linux 7
  kernel centos7/vmlinuz
  append initrd=centos7/initrd.img text ks=http://10.0.0.8/ksdir/ks7.cfg

label linux6
  menu label ^Auto Install CentOS Linux 6
  kernel centos6/vmlinuz
  append initrd=centos6/initrd.img ks=http://10.0.0.8/ksdir/ks6.cfg

label rescue
  menu label ^Rescue a CentOS Linux system
  kernel vmlinuz
  append initrd=centos8/initrd.img  inst.repo=http://10.0.0.8/centos/8/x86_64/ rescue quiet

bel local
  menu default
  menu label Boot from ^local drive
    localboot 0xffff

(2)开启新的主机选择linux版本开始安装
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值