半自动化的安装CentOS系统

2020-01-30 16:23:39王冬梅

firstboot --disable

# System keyboard

keyboard us #选择的键盘类型为us

# System language

lang en_US #语言为英文

# SELinux configuration

selinux --disabled #关闭selinux

# Do not configure the X WindowSystem

skipx #忽略X Window System的配置

# Installation logging level

logging --level=info #启动的级别为文本

# Reboot after installation

reboot #安装完之后重启系统

# System timezone

timezone Asia/Shanghai #系统时区为亚洲/上海

# Network information

#network --bootproto=dhcp --device=eth0 --onboot=on

# System bootloaderconfiguration #表示传递能内核的参数

bootloader--append="crashkernel=auto crashkernel=auto rhgb quiet"--location=mbr --driveorder="sda

# Partition clearinginformation

clearpart --all #以下都是对磁盘进行分区操作的,这里使用的LVM

zerombr #磁盘没有分区,对磁盘进行分区

part /boot --fstype=ext4--size=200

part pv.008002 --size=61440

volgroup vg0 --pesize=8192pv.008002

logvol / --fstype=ext4--name=root --vgname=vg0 --size=20480

logvol swap --name=swap--vgname=vg0 --size=2048

logvol /usr --fstype=ext4--name=usr --vgname=vg0 --size=10240

logvol /var --fstype=ext4--name=var --vgname=vg0 --size=20480

%post #安装完之后需要执行的脚本

%end #脚本结束符

%packages #在安装过程中需要安装的程序包及程序包组

@base

@basic-desktop

@chinese-support

@client-mgmt-tools

@core

@desktop-platform

@fonts

@general-desktop

@graphical-admin-tools

@legacy-x

@network-file-system-client

@perl-runtime

@remote-desktop-clients

@x11

-ibus-table-cangjie

-ibus-table-erbi

-ibus-table-wubi

%end #程序包及程序包组结束符

(2) 安装http服务与启动

[root@node-2 ~]# yum installhttpd -y #安装httpd服务

[root@node-2 ~]# service httpdstart #启动http服务

Starting httpd: [ OK ]

[root@node-2 ~]# netstat-ntlp|grep 80 #查看启动状态,http的端口为tcp的80端口

tcp 0 0 :::80 :::* LISTEN 2008/httpd

(3) 挂载光盘镜像

  把光盘镜像放入光驱,如果使用的是虚拟机把光盘文件添加至虚拟机的光驱,并选择启用。

[root@node-2 ~]# mkdir /var/www/html/{ks,x86_64} #创建ks,x86_64目录

[root@node-2 ~]# mount -r/dev/dvd /var/www/html/x86_64/ #以只读方式挂载光盘镜像至/var/www/html/x86_64/

[root@node-2 ~]# mount|tail -1 #查看挂载情况

/dev/sr0 on/var/www/html/x86_64 type iso9660 (ro)

(4) 复制ks.cfg文件至/var/www/html/ks目录下

[root@node-2 ~]# cp/root/ks.cfg /var/www/html/ks/

[root@node-2 ~]# ls/var/www/html/ks/

ks.cfg