kickstart安裝
參考文檔:http://blog.oldboyedu.com/autoinstall-kickstart/
centos下載地址
http://mirror.symnds.com/distributions/CentOS-vault/6.5/isos/x86_64/ http://vault.centos.org/6.5/isos/
centos 6.5 minimal 下載地址:
http://101.110.118.69/mirror.symnds.com/distributions/CentOS-vault/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso
centos 6.5 bin(完整版)下載地址:
http://101.110.118.70/mirror.symnds.com/distributions/CentOS-vault/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso
1、環境準備
1、系統版本
cat /etc/redhat-release
2、內核版本
uname -r
3、seliunx(建議:disable)
getenforce
4、防火牆(建議:關閉)
service iptables status
5、IP
ifconfig eth0|awk -F "[ :]+" 'NR==2 {print $4}'
6、hostname
2、掛載ISO鏡像
mkdir -p /mnt/cdrom mount -o loop CentOS-6.5-x86_64-minimal.iso /mnt/cdrom/
3、搭建httpd服務
安裝:
yum -y install httpd
配置:
sed -i "277i ServerName 127.0.0.1:80" /etc/httpd/conf/httpd.conf
啓動:
/etc/init.d/httpd start
以下步驟爲測試:
mkdir /var/www/html/CentOS-6.5 cp -a /mnt/cdrom/* /var/www/html/CentOS-6.5/
訪問:http://192.168.2.35/CentOS-6.5/
顯示光盤內容
3、DHCP服務安裝(未完)
rpm包下載地址:
ftp://195.220.108.108/linux/opensuse/update/leap/42.1/oss/x86_64/dhcp-4.3.3-4.1.x86_64.rpm
1、安裝
yum -y install dhcp
2、配置文件
vim /etc/dhcp/dhcp.conf
subnet 192.168.2.0 netmask 255.255.255.0 { # 所屬網段及掩碼
range dynamic-bootp 192.168.2.201 192.168.2.230; # IP地址池範圍
option routers 192.168.2.254; # 路由器IP(網關)
next-server 192.168.2.35; # 服務器IP地址(本機)
filename="pxelinux.0"; # PXE獲得IP後的引導文件
#option domain-name #設置域名
}
/etc/init.d/dhcpd start
netstat -tunlp|grep dhcp
5、搭建TFTP服務
yum -y install tftp yum -y install tftp-server
編輯配置文件
vim /etc/xinetd.d/tftp service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /usr/local/src/tftpboot -c ###tftp的根目錄 disable = no ### per_source = 11 cps = 100 2 flags = IPv4 }
啓動服務
/etc/init.d/xinetd restart
查看監聽端口:
netstat -tunlp | grep 69
進入TFTP操作:
connect:連接到遠程tftp服務器
mode:文件傳輸模式
put:上傳文件
get:下載文件
quit:退出
verbose:顯示詳細的處理信息
tarce:顯示包路徑
status:顯示當前狀態信息
binary:二進制傳輸模式
ascii:ascii 傳送模式
rexmt:設置包傳輸的超時時間
timeout:設置重傳的超時時間
help:幫助信息
? :幫助信息
6、PXE引導配置
1、如果沒有pxeliunx.0可以安裝
yum -y install syslinux
2、複製啓動菜單程序文件pxelinux.0至/tftpboot:
cp /usr/share/syslinux/pxelinux.0 /usr/local/src/tftpboot/ /var/lib/tftpboot/爲tftp的根目錄
3、如果tftp的根目錄不存在需要創建
mkdir -p /usr/local/src/tftpboot
創建的目錄要給權限:chmod -R 777 /usr/local/src/tftpboot
4、把DVD光盤中的/image/pxeboot/中的vmlinuz和initrd.img 複製到tftp的根目錄
光盤路徑:/mnt/cdrom/(ISO鏡像掛載的路徑)
cp /image/pxeboot/vmlinuz /usr/local/src/tftpboot/ cp /image/pxeboot/initrd.img /usr/local/src/tftpboot/
5、複製DVD光盤上的isoliunx/下的所有文件到tftp的根目錄下
cp /mnt/cdrom/isolinux/* /usr/local/src/tftpboot
6、在tftp根目錄中建一個pxeliunx.cfg目錄
mkdir pxelinux.cfg
7、將isoliunx目錄中的isoliunx.cfg複製到pxeliunx.cfg目錄中,同事更改文件名爲default
cp /mnt/cdrom/isolinux/isolinux.cfg /usr/local/src/tftpboot/pxeliunx.cfg/default
7、安裝配置kickstart
yum -y install system-config-kickstart
mkdir /var/www/html/ks_config
vim /var/www/html/ks_config/CentOS-6.5-ks.cfg
install #全新安裝
url --url="http://192.168.2.35/CentOS-6.5/" #通過http安裝
text
lang en_US.UTF-8 #語言
keyboard us #鍵盤格式
zerombr #清除mbr引導信息
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw --iscrypted $6$ks14Kgl.IwZRtIh1$mUoTMkrttRx3FnEK77CNuhoKg/UtCuWA5HB5n40Qw5IXBsA2/AGirJePpJERBH7LKySv0Sl9rKtkJED3zh62u.
clearpart --all --initlabel
part /boot --fstype=ext4 --asprimary --size=500
part swap --size=2048
part / --fstype=ext4 --grow --asprimary --size=200
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot
%packages
@base
@compat-libraries
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
%end
精簡版default
vim /var/lib/tftpboot/pxelinux.cfg/default
default ks
prompt 0
label ks
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.2.35/ks_config/CentOS-6.7-ks.cfg # 告訴安裝程序ks.cfg文件在哪裏
圖形界面模式:
輸入以下命令進入
system-config-kickstart
圖形界面下配置(一般流程)
基本配置:
默認語言:中文簡體
時區:Asia/Shanghai
跟口令:(liunx系統root賬戶密碼)
安裝方法:
FTP
FTP服務器
FTP目錄
分區信息:
清除主引導記錄
刪除所有現存分區
佈局(磁盤分區)
建議:
/boot 200-1000M
swap 內存的兩倍
/ 剩下所有空間
網絡配置
添加網絡設備: etho
防火牆配置
liunx安全增強版:禁用
軟件包配置:(自定義)