一.使用system-config-kickstart命令一個圖形界面配置。
在centos7中需要安裝這個命令。yum -y install system-config-kickstart
我在本地配置了一個http,用光盤啟動之后按ECS進入boot啟動命令行
輸入 linux ks=url url為kick start的地址
記錄下kickstart文件的格式
1 #platform=x86, AMD64, or Intel EM64T 2 #version=DEVEL 3 # Install OS instead of upgrade 4 install
5 # Keyboard layouts 6 keyboard 'us'
7 # Root password 8 rootpw --plaintext centos 9 # System language 10 lang en_US 11 # System authorization information 12 auth --useshadow --passalgo=sha512 13 # Use text mode install
14 text 15 firstboot --disable 16 # SELinux configuration 17 selinux --disabled 18 # Do not configure the X Window System 19 skipx 20
21
22 # Firewall configuration 23 firewall --disabled 24 # Network information 25 network --bootproto=dhcp --device=eth0 26 # Reboot after installation 27 reboot 28 # System timezone 29 timezone Asia/Shanghai 30 # Use network installation 31 url --url="http://192.168.56.8/centos7/os/x86_64/"
32 # System bootloader configuration 33 bootloader --append="net.ifnames=0" --location=mbr 34 # Clear the Master Boot Record 35 zerombr 36 # Partition clearing information 37 clearpart --all --initlabel 38 # Disk partitioning information 39 part / --fstype="xfs" --size=20000
40 part /boot --fstype="xfs" --size=1024
41 part swap --fstype="swap" --size=4096
42 part /data --fstype="xfs" --size=50000
43
44 %post 45 useradd xiaoming 46 echo "centos" | passwd --stdin xiaoming 47 touch /etc/yum.repos.d/epel.repo 48 cat > /etc/yum.repos.d/epel.repo <<EOF 49 [epel] 50 baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
51 gpgcheck=1
52 gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7
53 enabled=1
54 EOF 55 %end
此文只為留下一個kickstart文件格式的參考。