系統CentOS7.2
要學習CentOS6.5系統的可以看一下這個前輩的鏈接,這裏不再介紹
http://blog.chinaunix.net/uid-16728139-id-4174109.html
其實centos6.5跟7.2的話,也就是centos6.5多了一個rsync,而centos7.2不需要配置rsync,其他操作均相同
下面把多的那一部分截圖放出來
還有就是裝centos6.5的系統(我採用的是VMware Workstation虛擬的方式) 會提示一個
這裏需要大家敲一下回車
下面開始centos7.2上的操作
1.關閉selinux
sed -in 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config setenforce 0
2.關閉防火牆
systemctl disable firewalld.service systemctl stop firewalld.service systemctl is-enabled firewalld.service
3.安裝epel-release、163源
yum -y install epel-release cd /etc/yum.repos.d/ ; wget http://mirrors.163.com/.help/CentOS7-Base-163.repo ; cd
4.查看cobbler包
yum search all cobbler
5.安裝cobbler
yum -y install cobbler cobbler-web
6.安裝dhcp httpd xinetd
yum -y install dhcp httpd xinetd
7.將cobbler httpd dhcp xinetd添加到開機自啓
chkconfig cobblerd on chkconfig httpd on chkconfig dhcpd on chkconfig xinetd on
8.配置環境
先備份一個配置文件 以防不時之需
cp /etc/cobbler/settings{,.bak}
next_server: 10.0.0.103
server: 10.0.0.103
manage_dhcp: 0 #設置爲1時,開啓cobbler的dhcp管理器 這裏不開啓,因爲之前測試開不開啓並沒有什麼用 都得再配置dhcpd的配置文件
manage_rsync: 1 #設置爲1時,開啓cobbler的rsync管理器
9.生成密碼串(這個密碼就是安裝完系統之後的root密碼)
格式:
openssl passwd -1 -salt "任意字符" “密碼”
openssl passwd -1 -salt "cobbler" "centos"
$1$cobbler$DWL2fHTHaRTa2hj5VEuZk.
vim /etc/cobbler/settings
default_password_crypted: "$1$cobbler$DWL2fHTHaRTa2hj5VEuZk."
10.啓用xinetd
將disable的值改爲“no”
systemctl start xinetd.service
11.啓用dhcp服務
按以下配置dhcp的話,分配到ip地址後可以直接上網(只要你的上網環境沒有問題)
subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.1;
option domain-name-servers 114.114.114.114;
option subnet-mask 255.255.255.0;
default-lease-time 21600;
max-lease-time 43200;
range 10.0.0.200 10.0.0.210;
next-server 10.0.0.103;
filename "pxelinux.0";
}
systemctl start dhcpd.service
12.依次啓動httpd cobbler 然後檢查cobbler 然後根據提示操作
systemctl start httpd.service systemctl start cobblerd.service cobbler check cobbler get-loaders systemctl enable rsyncd.service yum -y install pykickstart yum -y install fence-agents cobbler sync
最後剩下一個 是用來安裝debian系統的 我不需要 我就不安裝了
13.修改cobbler的web密碼(此步驟可以省略)
htdigest /etc/cobbler/users.digest "Cobbler" cobbler
systemctl restart httpd.service systemctl restart cobblerd.service
注意這裏的http訪問協議是“https” 注意 使用http不可訪問
https://10.0.0.103/cobbler_web
14.掛載磁盤,導入系統鏡像,這裏導入的是centos7.2的系統
cobbler import --path=/mnt/ --name=centos7.2
遇到問題就用cobbler check 檢查一下 ,可以加快你排錯的時間
上述所採用的ks文件爲默認 當然安裝的系統也是最小化的
做完這些操作之後你就可以裝系統了,而且不需要人爲去幹預
這裏提示一下
有時可能需要批量安裝某一種系統 可以將LABEL後的名稱複製放到引導文件第一行DEFAULT 的後邊 如下圖
引導程序的位置在
/var/lib/tftpboot/pxelinux.cfg/default
這裏解釋一下:
DEFAULT menu #指定默認引導入口名稱(假如指定的是)
PROMPT 0 #是否等待用戶選擇(1表示等待 0表示不等待)就像下圖這樣
LABEL 。。。 #啓動項