cobbler的安裝配置,搭建環境centos7.4
1.檢查當前環境的selinux和iptables是否關閉,相關命令getenforce、setenforce、systemctl ?status firewalld。
2.安裝配置cobbler需要連接外網,需首先配置yum源,保證能從互聯網上下載安裝包。
3.安裝cobbler、dhcp、tftp和http,因為有些安裝包和cobbler有依賴性,所以會自動安裝上,執行命令yun install -y cobbler dhcp。
4.使用rpm -ql cobbler查看cobbler相關的服務,cobbler的服務名叫cobblerd。
5.把相關的服務設為開機啟動,systemctl enable cobblerd dhcpd httpd tftp。
6.把服務都啟動起來,systemctl start cobblerd httpd tftp,dhcp服務因為沒有配置而無法啟動,使用ss -ntl查看相關端口已經開啟。
6.執行cobbler check,進行檢查當前環境缺少哪些東西
1) : The ‘server’ field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
修改/etc/cobbler/settings文件中的server地址,修改這個地址為本機的IP地址
2) : For PXE to be functional, the ‘next_server’ field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
修改/etc/cobbler/settings文件中的next_server地址,修改這個地址為本機的IP地址
3) : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:https://github.com/cobbler/cobbler/wiki/Selinux
本機的selinux是關閉的不用管這一項
4) : change ‘disable’ to ‘no’ in /etc/xinetd.d/tftp
這一項是說把tftp的服務啟動起來,由于開始就啟動了,所以這一項也不用管
5) : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run ‘cobbler get-loaders’ to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The ‘cobbler get-loaders’ command is the easiest way to resolve these requirements.
執行cobbler get-loaders命令,把需要的東西下載到/var/lib/cobbler/loaders/文件夾下,然后再執行命令cobbler sync命令,把文件拷貝到/var/lib/tftpboot文件夾下
6) : enable and start rsyncd.service with systemctl
和當前的服務關系不大,可以不用理會
7) : debmirror package is not installed, it will be required to manage debian deployments and repositories
缺少安裝包,但是不是在centos環境中,所以這個也不用管
8 ): The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to ‘cobbler’ and should be changed, try: “openssl passwd -1 -salt ‘random-phrase-here’ ‘your-password-here'” to generate new one
在/etc/cobbler/settings中有一項default_password_crypted默認密碼是cobbler,需要手工創建密碼,并且把加密后的密碼再放到這個地方,使用工具openssl passwd -1,
9) : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
不需要做這一項,和電源和集群有關
7.通過cobbler管理dhcp服務,啟動dhcp服務,在/etc/cobbler/settings中找到manage_dhcp這一項,默認為零改為1
8.把上面的都做完之后重啟服務,systemctl restart cobblerd
9.修改dhcp的配置模板,通過這個模板會自動生成dhcp的配置文件,vim /etc/cobbler/dhcp.template(和dhcp的配置文件格式相似,按照之前的修改就行)
10.修改完以后就可以同步一下cobbler sync,使用ss -ntl查看dhcp的服務器端口67是否啟動。
11.準備把光盤掛載上去,可以同時掛載幾個盤,并重啟服務systemctl restart cobblerd。
12.把光盤中的內容導入系統,新建/mnt/cdrom0和/mnt/cdrom1分別把光盤掛載上去,執行命令cobbler import –path=/mnt/cdrom1 –name=centos-6.9-x86_64(系統盤的名稱) –arch=x86_64(基于的架構) cobbler import –path=/mnt/cdrom0 –name=centos-7.4-x86_64 –arch=x86_64,導入的光盤都放到/var/www/cobbler/ks_mirror目錄下,導入以后系統默認生成的有最小化安裝的應答文件
==========================================================================
至此,就可以實現安裝了,新開個虛擬機網絡安裝就可以了,默認是采用邏輯卷分區安裝,如果不設置密碼的的話,默認的密碼是cobbler
==========================================================================cobbler的相關命令
cobbler check檢查配置環境
cobbler distro list 查看導入的系統信息
cobbler distro remove –name=”使用list查看的名稱”
cobbler profile list 查看應答文件的信息
cobbler profile remove –name=”使用應答文件查看的名稱” 相當于刪除菜單中的對應項。注意:要先刪除profile再刪除distro
cobbler profile report –name=”使用profile list查看的名稱” 了解菜單項的詳細信息
=============================
在cobbler上綁定自己的應答文件
=============================
菜單上的設置有可能不是我們所要的,所以要綁定自己的菜單上去
把應答文件上傳到/var/lib/cobbler/kickstarts/文件夾中
把應答文件的–url=改為–url=$tree
執行命令cobbler profile add –name=centos-6.9-x86_64_Mini –distro=centos-6.9-x86_64 –kickstart=/var/lib/cobbler/kickstarts/ks6_mini.cfg
====================
實現cobbler的web界面
====================
1.安裝cobbler-web軟件包,yum install cobbler-web -y
2.重新啟動http服務,systemctl restart httpd
3.使用瀏覽器輸入https://192.168.30.27/cobbler_web/就可以訪問web界面了,但是需要輸入賬號和密碼,需要后臺創建賬號和密碼,在文件/etc/cobbler/modules.conf中查看調用的模塊是authn_configfile,這個模塊用/etc/cobbler/users.digest文件定義了賬號和密碼
4.使用命令生成賬號和密碼,htdigest -c /etc/cobbler/users.digest Cobbler test1回車后輸入兩遍密碼就可以了
5.還可以使用pam模塊驗證,在/etc/cobbler/modules.conf文件中修改驗證模塊為module=authn_pam,pam模塊調用了/etc/cobbler/users.conf文件,新建linxu用戶useradd -s /sbin/nologin test2;echo magedu | passwd –stdin test2,然后把test2添加到/etc/cobbler/users.conf文件的管理員處,然后在重啟cobbler服務,systemctl restart cobblerd
本文來自投稿,不代表Linux運維部落立場,如若轉載,請注明出處:http://www.www58058.com/99616