LINUX学生会linux学习

Linux基础之自动化安装Linux系统第一篇

2017-07-23  本文已影响12人  数据革命

简介

自动化安装准备工作

开始工作

[root@localhost mnt]# ls
CentOS_BuildTag  isolinux                  RPM-GPG-KEY-CentOS-Debug-6
EFI              Packages                  RPM-GPG-KEY-CentOS-Security-6
EULA             RELEASE-NOTES-en-US.html  RPM-GPG-KEY-CentOS-Testing-6
GPL              repodata                  TRANS.TBL
images           RPM-GPG-KEY-CentOS-6
8.png
[root@linux ~]# cat ks.cfg 
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://172.16.0.1/centos/6"       <<网络源
# Root password
rootpw --plaintext 111111                 <<菜单密码
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
text                 <<  图形化和命令行界面启动方式选择
# System keyboard
keyboard us                  <<键盘布局
# System language
lang en_US
# SELinux configuration             <<禁用SELinux
selinux --disabled
# Installation logging level
logging --level=info

# System timezone
timezone  Africa/Abidjan           << 时区
# Network information
network  --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr --password="111111"   <<账号登录密码
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all  
# Disk partitioning information            << 分区项
part /boot --fstype="ext4" --size=500
part / --fstype="ext4" --size=100000     
part swap --fstype="swap" --size=4096
part /app --fstype="ext4" --size=50000

%post               <<  因为前脚本项没有填写所以没有生成,这里是后脚本项
useradd wang
echo magedu|passwd --stdin wang
rm -rf /etc/yum.repos.d/*
cat > /etc/yum.repos.d/base.repo << EOF
[bash]
name=linux
baseurl=http://172.16.0.1/centos/6
gpgcheck=0
EOF

%end

% packages      << 表示你要安装的软件包 
@base

%end
[root@linux ~]# ksvalidator ks.cfg 
File uses a deprecated option or command.

Script does not end with %end.  This syntax has been deprecated.  It may be removed from future releases, which will result in a fatal error from kickstart. 
 Please modify your kickstart file to use this updated syntax.
[root@linux ~]# cat anaconda-ks.cfg 
# Kickstart file automatically generated by anaconda.

#version=DEVEL
install
cdrom     <<光盘可参考,我这里没有参考因为我用的是网络,但是后期需要参考
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
network --onboot yes --device eth1 --bootproto dhcp --noipv6
rootpw  --iscrypted $6$Qd6ikyJKuxRyjZkN$DPT.7v1PGLjOKFJC8EK9wUxCFqHYfrfKELOZwmSo7Iv.3fnu32YJLPoZMvKo8lBTLAX1tVmmpuphcvboIM4Fj1
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing   <<参考了他的SElinux
timezone Asia/Hong_Kong   << 我参考了他的时区
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --none
#part /boot --fstype=ext4 --size=1000
#part /app --fstype=ext4 --size=100000
#part swap --size=4000
#part / --fstype=ext4 --grow --size=200
repo --name="CentOS"  --baseurl=cdrom:sr0 --cost=100
%packages  << 参考他的安装包
@base
@compat-libraries
@core
@debugging
@development
@server-policy
@workstation-policy
python-dmidecode
sgpio
device-mapper-persistent-data
systemtap-client
%end[root@linux ~]# 

[root@linux pub]# service vsftpd  status
vsftpd (pid 28714) is running...   <<表示已经启动
[root@linux pub]# service vsftpd  start        
Starting vsftpd for vsftpd:           表示启动成功 >>        [  OK  ]   
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
base.repo
上一篇 下一篇

猜你喜欢

热点阅读