ks.cfg 示例 KVM

通过 anaconda-ks.cfg 拷贝了一份ks.cfg

自定义密码
[root@localhost ~]# echo "123456" | openssl passwd -1 -stdin
$1$3XUYSXOl$XVnQlSddcSJsAQHTXyOL5/
[root@localhost ~]# 

打开复制的ks.cfg

#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password  **注意:将生成的密码放到此处**
rootpw --iscrypted $1$3XUYSXOl$XVnQlSddcSJsAQHTXyOL5/
# 系统语言
#lang zh_CN.UTF-8
lang en_US

# System authorization information
auth  --useshadow  --passalgo=sha512
# Use CDROM installation media
#cdrom

# Use text mode install
# 使用字符界面安装操作系统
text

# Do not configure the X Window System
# 不配置图形界面系统
skipx

# SELinux configuration
selinux --disabled

# Firewall configuration
firewall --disabled

# 设置动态获取 IP
network  --bootproto=dhcp --device=eth0 --onboot=on
network  --hostname=HOSNAME

# 设置静态 IP
# network  --bootproto=static --device=eth0 --gateway=192.168.122.1 --ip=192.168.122.100 --nameserver=192.168.122.1 --netmask=255.255.255.0 --activate

# 系统安装完成后 重启系统
#halt
reboot

# System timezone 系统时区
timezone Asia/Shanghai

# System services  系统启动时候自动启动的服务
services --enable="chronyd"

# System bootloader configuration
#系统启动引导方式 vda 是kvm 虚拟机时候的第块磁盘名称
bootloader --location=mbr --boot-drive=vda

# 清除主引导记录
zerombr

# 删除原来的分区和磁盘标签
clearpart --all --initlabel

# 磁盘分区信息,这里采用的是 lvm 自动分区
autopart --type=lvm

# 下面是自定义分区
#part /boot --fstype="xfs" --ondisk=vda --size=200
#part / --fstype="xfs" --ondisk=vda --size=10040
#part /var --fstype="xfs" --ondisk=vda --size=2048
#part /home --fstype="xfs" --ondisk=vda --size=2048

# 安装软件
%packages
@^minimal
@core
chrony
%end

# 禁用 kdump
%addon com_redhat_kdump --disable --reserve-mb='auto'

%end

# 安装系统完成后执行的命令脚本
%post --interpreter=/bin/bash
yum install -y epel-release bash-completion vim-enhanced wget
yum group install "Development Tools" -y
%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


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值