COBBLER无人值守安装-----已用真实服务器测试
已用真實(shí)服務(wù)器測試安裝,只要按照步驟做就可以正常使用。
后面主要是KS文件的編寫。centos7默認(rèn)是xfs系統(tǒng),默認(rèn)的ks文件,安裝包是292個,用ISO裝系統(tǒng),選最小化安裝是297個,基本一致。
只要修改時(shí)區(qū)及分區(qū),就可以了。
裝完系統(tǒng)會自動進(jìn)系統(tǒng),不會重復(fù),網(wǎng)卡如果不修改,會是ifcfg-em1
Cobbler介紹
Cobbler是一個Linux服務(wù)器安裝的服務(wù),可以通過網(wǎng)絡(luò)啟動(PXE)的方式來快速安裝、重裝物理服務(wù)器和虛擬機(jī),同時(shí)還可以管理DHCP,DNS等。
Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),還提供了API接口,可以方便二次開發(fā)使用。
Cobbler是較早前的kickstart的升級版,優(yōu)點(diǎn)是比較容易配置,還自帶web界面比較易于管理。
Cobbler內(nèi)置了一個輕量級配置管理系統(tǒng),但它也支持和其它配置管理系統(tǒng)集成,如Puppet,暫時(shí)不支持SaltStack。
Cobbler官網(wǎng)
1.1 Cobbler集成的服務(wù)
- PXE服務(wù)支持
- DHCP服務(wù)管理
- DNS服務(wù)管理(可選bind,dnsmasq)
- 電源管理
- Kickstart服務(wù)支持
- YUM倉庫管理
- TFTP(PXE啟動時(shí)需要)
- Apache(提供kickstart的安裝源,并提供定制化的kickstart配置)
1.2 系統(tǒng)環(huán)境準(zhǔn)備
- [root@linux-node1 ~]#?cat /etc/redhat-release
- CentOS release 6.7 (Final)
- [root@linux-node1 ~]#?uname -r
- 2.6.32-573.el6.x86_64
- [root@linux-node1 ~]#?getenforce
- Disabled
- [root@linux-node1 ~]#?/etc/init.d/iptables status
- iptables: Firewall is not running.
- [root@linux-node1 ~]#?ifconfig eth0|awk -F "[ :]+" 'NR==2 {print $4}'
- 10.0.0.7
- [root@linux-node1 ~]#?hostname
- linux-node1.example.com
- # 配置阿里云的epel源
- [root@linux-node1 ~]#?wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
注意:
- 虛擬機(jī)網(wǎng)卡采用NAT模式,不要使用橋接模式,因?yàn)樯院笪覀儠罱―HCP服務(wù)器,在同一局域網(wǎng)多個DHCP服務(wù)會有沖突。
- VMware的NAT模式的dhcp服務(wù)也關(guān)閉,避免干擾。
2. Cobbler安裝配置
2.1 安裝Cobbler
- [root@linux-node1 ~]#?yum -y install?cobbler cobbler-web dhcp tftp-server pykickstart httpd
- [root@linux-node1 ~]#?rpm -ql cobbler?# 查看安裝的文件,下面列出部分。
- /etc/cobbler # 配置文件目錄
- /etc/cobbler/settings # cobbler主配置文件,這個文件是YAML格式,Cobbler是python寫的程序。
- /etc/cobbler/dhcp.template # DHCP服務(wù)的配置模板
- /etc/cobbler/tftpd.template # tftp服務(wù)的配置模板
- /etc/cobbler/rsync.template # rsync服務(wù)的配置模板
- /etc/cobbler/iso # iso模板配置文件目錄
- /etc/cobbler/pxe # pxe模板文件目錄
- /etc/cobbler/power # 電源的配置文件目錄
- /etc/cobbler/users.conf # Web服務(wù)授權(quán)配置文件
- /etc/cobbler/users.digest # 用于web訪問的用戶名密碼配置文件
- /etc/cobbler/dnsmasq.template # DNS服務(wù)的配置模板
- /etc/cobbler/modules.conf # Cobbler模塊配置文件
- /var/lib/cobbler # Cobbler數(shù)據(jù)目錄
- /var/lib/cobbler/config # 配置文件
- /var/lib/cobbler/kickstarts # 默認(rèn)存放kickstart文件
- /var/lib/cobbler/loaders # 存放的各種引導(dǎo)程序
- /var/www/cobbler # 系統(tǒng)安裝鏡像目錄
- /var/www/cobbler/ks_mirror # 導(dǎo)入的系統(tǒng)鏡像列表
- /var/www/cobbler/images # 導(dǎo)入的系統(tǒng)鏡像啟動文件
- /var/www/cobbler/repo_mirror # yum源存儲目錄
- /var/log/cobbler # 日志目錄
- /var/log/cobbler/install.log # 客戶端系統(tǒng)安裝日志
- /var/log/cobbler/cobbler.log # cobbler日志
2.2 配置Cobbler
- [root@linux-node1 ~]#?/etc/init.d/httpd restart
- 停止 httpd: [失敗]
- 正在啟動 httpd: [確定]
- [root@linux-node1 ~]#?/etc/init.d/cobblerd start
- Starting cobbler daemon: [確定]
- [root@linux-node1 ~]#?cobbler check?# 檢查Cobbler的配置,如果看不到下面的結(jié)果,再次執(zhí)行/etc/init.d/cobblerd restart
- The following are potential configuration items that you may want to fix:
- 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.
- 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.
- 3 : 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.
- 4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
- 5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
- 6 : 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
- 7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
- Restart cobblerd and then run 'cobbler sync' to apply changes.
- # 看著上面的結(jié)果,一個一個解決。
- # 第1、2、6個問題,順便修改其他功能
- [root@linux-node1 ~]#?cp /etc/cobbler/settings{,.ori}?# 備份
- # server,Cobbler服務(wù)器的IP。
-?sed -i 's/server: 127.0.0.1/server:?10.0.0.7/' /etc/cobbler/settings
- # next_server,如果用Cobbler管理DHCP,修改本項(xiàng),作用不解釋,看kickstart。
-?sed -i 's/next_server: 127.0.0.1/next_server:?10.0.0.7/' /etc/cobbler/settings
- # 用Cobbler管理DHCP
-?sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
- # 防止循環(huán)裝系統(tǒng),適用于服務(wù)器第一啟動項(xiàng)是PXE啟動。
-?sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
- #?設(shè)置新裝系統(tǒng)的默認(rèn)root密碼123456。下面的命令來源于提示6。random-phrase-here為干擾碼,可以自行設(shè)定。
- [root@linux-node1?~]#?openssl?passwd?-1?-salt?'root'?'123456'
-?$1$root$j0bp.KLPyr.u9kgQ428D10
- [root@linux-node1 ~]#?vim /etc/cobbler/settings
- default_password_crypted: "$1$root$j0bp.KLPyr.u9kgQ428D10"
- # 第3個問題
- [root@linux-node1 ~]#?cobbler get-loaders?# 會自動從官網(wǎng)下載
- [root@linux-node1 ~]#?cd /var/lib/cobbler/loaders/?# 下載的內(nèi)容
- [root@linux-node1 loaders]#?ls
- COPYING.elilo COPYING.yaboot grub-x86_64.efi menu.c32 README
- COPYING.syslinux elilo-ia64.efi grub-x86.efi pxelinux.0 yaboot
- # 第4個問題
- [root@linux-node1 ~]#?vim /etc/xinetd.d/rsync
-?disable = no
- [root@linux-node1 ~]#?/etc/init.d/xinetd restart
- 停止 xinetd: [確定]
- 正在啟動 xinetd: [確定]
- [root@linux-node1 ~]#?/etc/init.d/cobblerd restart
- Stopping cobbler daemon: [確定]
- Starting cobbler daemon: [確定]
- [root@linux-node1 ~]#?cobbler check
- The following are potential configuration items that you may want to fix:
- 1 : debmirror package is not installed, it will be required to manage debian deployments and repositories # 和debian系統(tǒng)相關(guān),不需要
- 2 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them # fence設(shè)備相關(guān),不需要
- Restart cobblerd and then run 'cobbler sync' to apply changes.
2.3 配置DHCP
- # 修改cobbler的dhcp模版,不要直接修改dhcp本身的配置文件,因?yàn)閏obbler會覆蓋。
- [root@linux-node1 ~]#?vim /etc/cobbler/dhcp.template
- # 僅列出修改過的字段
subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.2;
option domain-name-servers 10.0.0.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.0.0.100 10.0.0.200;
2.4 同步cobbler配置
- # 同步最新cobbler配置,它會根據(jù)配置自動修改dhcp等服務(wù)。
- [root@linux-node1 ~]#?cobbler sync?# 同步所有配置,可以仔細(xì)看一下sync做了什么。
- task started: 2015-12-03_204822_sync
- task started (id=Sync, time=Thu Dec 3 20:48:22 2015)
- running pre-sync triggers
- cleaning trees
- removing: /var/lib/tftpboot/pxelinux.cfg/default
- removing: /var/lib/tftpboot/grub/images
- copying bootloaders
- trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
- copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
- trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
- trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
- trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
- trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
- trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
- copying distros to tftpboot
- copying images
- generating PXE configuration files
- generating PXE menu structure
- rendering DHCP files
- generating /etc/dhcp/dhcpd.conf
- rendering TFTPD files
- generating /etc/xinetd.d/tftp
- cleaning link caches
- running post-sync triggers
- running python triggers from /var/lib/cobbler/triggers/sync/post/*
- running python trigger cobbler.modules.sync_post_restart_services
- running: dhcpd -t -q
- received on stdout:
- received on stderr:
- running: service dhcpd restart
- received on stdout: 關(guān)閉 dhcpd:[確定]
- 正在啟動 dhcpd:[確定]
- received on stderr:
- running shell triggers from /var/lib/cobbler/triggers/sync/post/*
- running python triggers from /var/lib/cobbler/triggers/change/*
- running python trigger cobbler.modules.scm_track
- running shell triggers from /var/lib/cobbler/triggers/change/*
- *** TASK COMPLETE ***
- # 再看一下dhcp的配置文件。
- [root@linux-node1 ~]#?less /etc/dhcp/dhcpd.conf
- # ******************************************************************
- # Cobbler managed dhcpd.conf file
- # generated from cobbler dhcp.conf template (Thu Dec 3 12:48:23 2015)
- # Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
- # in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
- # overwritten.
- # ******************************************************************
- ddns-update-style interim;
- …………
2.5 開機(jī)啟動
- #?啟動相關(guān)服務(wù)并設(shè)置開機(jī)啟(可選)?與第二種方法二選一
chkconfig httpd on
chkconfig xinetd on
chkconfig cobblerd on
chkconfig dhcpd on
/etc/init.d/httpd restart
/etc/init.d/xinetd restart
/etc/init.d/cobblerd restart
/etc/init.d/dhcpd restart
- # 編寫Cobbler相關(guān)服務(wù)啟動腳本(可選)
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | cat?>>/etc/init.d/cobbler<<EOF #!/bin/bash #?chkconfig:?345?80?90 #?description:cobbler case?\$1?in start) /etc/init.d/httpd?start /etc/init.d/xinetd?start /etc/init.d/dhcpd?start /etc/init.d/cobblerd?start ?;; stop) /etc/init.d/httpd?stop /etc/init.d/xinetd?stop /etc/init.d/dhcpd?stop /etc/init.d/cobblerd?stop ;; restart) /etc/init.d/httpd?restart /etc/init.d/xinetd?restart /etc/init.d/dhcpd?restart /etc/init.d/cobblerd?restart ;; status) /etc/init.d/httpd?status /etc/init.d/xinetd?status /etc/init.d/dhcpd?status /etc/init.d/cobblerd?status ;; sync) cobbler?sync ;; *) echo?"Input?error,please?in?put?'start|stop|restart|status|sync'!" exit?2 ;; esac EOF |
#?chmod +x /etc/init.d/cobbler
#?chkconfig cobbler on
# 啟動相關(guān)服務(wù)并設(shè)置開機(jī)啟動(可選) 與第二種方法二選一
| 1 2 3 4 5 6 7 8 | chkconfig?httpd?on chkconfig?xinetd?on chkconfig?cobblerd?on chkconfig?dhcpd?on /etc/init.d/httpd?restart /etc/init.d/xinetd?restart /etc/init.d/cobblerd?restart /etc/init.d/dhcpd?restart |
# 編寫Cobbler相關(guān)服務(wù)啟動腳本(可選)
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | cat?>>/etc/init.d/cobbler<<EOF #!/bin/bash #?chkconfig:?345?80?90 #?description:cobbler case?\$1?in start) /etc/init.d/httpd?start /etc/init.d/xinetd?start /etc/init.d/dhcpd?start /etc/init.d/cobblerd stop) /etc/init.d/httpd?stop /etc/init.d/xinetd?stop /etc/init.d/dhcpd?stop /etc/init.d/cobblerd?stop ;; restart) /etc/init.d/httpd?restart /etc/init.d/xinetd?restart /etc/init.d/dhcpd?restart /etc/init.d/cobblerd?restart ;; status) /etc/init.d/httpd?status /etc/init.d/xinetd?status /etc/init.d/dhcpd?status /etc/init.d/cobblerd?status ;; sync) cobbler?sync ;; *) echo?"Input?error,please?in?put?'start|stop|restart|status|sync'!" exit?2 ;; esac EOF |
- #?chmod +x /etc/init.d/cobbler
- #?chkconfig cobbler on
3. Cobbler的命令行管理
3.1 查看命令幫助
- [root@linux-node1 ~]#?cobbler
- usage
- =====
- cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ...
- [add|edit|copy|getks*|list|remove|rename|report] [options|--help]
- cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version|signature|get-loaders|hardlink> [options|--help]
- [root@linux-node1 ~]#?cobbler import --help?# 導(dǎo)入鏡像
- Usage: cobbler [options]
- Options:
- -h, --help show this help message and exit
- --arch=ARCH OS architecture being imported
- --breed=BREED the breed being imported
- --os-version=OS_VERSION
- the version being imported
- --path=PATH local path or rsync location
- --name=NAME name, ex 'RHEL-5'
- --available-as=AVAILABLE_AS
- tree is here, don't mirror
- --kickstart=KICKSTART_FILE
- assign this kickstart file
- --rsync-flags=RSYNC_FLAGS
- pass additional flags to rsync
- cobbler check 核對當(dāng)前設(shè)置是否有問題
- cobbler list 列出所有的cobbler元素
- cobbler report 列出元素的詳細(xì)信息
- cobbler sync 同步配置到數(shù)據(jù)目錄,更改配置最好都要執(zhí)行下
- cobbler reposync 同步y(tǒng)um倉庫
- cobbler distro 查看導(dǎo)入的發(fā)行版系統(tǒng)信息
- cobbler system 查看添加的系統(tǒng)信息
- cobbler profile 查看配置信息
3.2 導(dǎo)入鏡像
- [root@linux-node1 ~]#?mount /dev/cdrom /mnt/?# 掛載CentOS7的系統(tǒng)鏡像。
- # 導(dǎo)入系統(tǒng)鏡像
- [root@linux-node1 ~]#?cobbler import --path=/mnt/ --name=CentOS-7.1-x86_64 --arch=x86_64
- # --path 鏡像路徑
- # --name 為安裝源定義一個名字
- # --arch 指定安裝源是32位、64位、ia64, 目前支持的選項(xiàng)有: x86│x86_64│ia64
- # 安裝源的唯一標(biāo)示就是根據(jù)name參數(shù)來定義,本例導(dǎo)入成功后,安裝源的唯一標(biāo)示就是:CentOS-7.1-x86_64,如果重復(fù),系統(tǒng)會提示導(dǎo)入失敗。
- [root@linux-node1 ~]#?cobbler distro list?# 查看鏡像列表
- CentOS-7.1-x86_64
- # 鏡像存放目錄,cobbler會將鏡像中的所有安裝文件拷貝到本地一份,放在/var/www/cobbler/ks_mirror下的CentOS-7.1-x86_64目錄下。因此/var/www/cobbler目錄必須具有足夠容納安裝文件的空間。
- [root@linux-node1 ~]#?cd /var/www/cobbler/ks_mirror/
- [root@linux-node1 ks_mirror]# ls
-?CentOS-7.1-x86_64 config
- [root@linux-node1 ks_mirror]# ls CentOS-7.1-x86_64/
- CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
- EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
- EULA isolinux repodata TRANS.TBL
3.3 指定ks.cfg文件及調(diào)整內(nèi)核參數(shù)
- # Cobbler的ks.cfg文件存放位置
- [root@linux-node1 ks_mirror]#?cd /var/lib/cobbler/kickstarts/
- [root@linux-node1 kickstarts]#?ls?# 自帶很多
- default.ks install_profiles sample_autoyast.xml sample_esxi4.ks sample_old.seed
- esxi4-ks.cfg legacy.ks?sample_end.ks(默認(rèn)使用的ks文件) sample_esxi5.ks sample.seed
- esxi5-ks.cfg pxerescue.ks sample_esx4.ks sample.ks
- [root@linux-node1 kickstarts]# rz # 上傳準(zhǔn)備好的ks文件
- rz waiting to receive.
- Starting zmodem transfer. Press Ctrl+C to cancel.
- Transferring Cobbler-CentOS-7.1-x86_64.cfg...
- 100% 1 KB 1 KB/sec 00:00:01 0 Errors
- [root@linux-node1 kickstarts]#?mv Cobbler-CentOS-7.1-x86_64.cfg CentOS-7.1-x86_64.cfg
- # 在第一次導(dǎo)入系統(tǒng)鏡像后,Cobbler會給鏡像指定一個默認(rèn)的kickstart自動安裝文件在/var/lib/cobbler/kickstarts下的sample_end.ks。
- [root@linux-node1 ~]#?cobbler list
- distros:
- CentOS-7.1-x86_64
- profiles:
- CentOS-7.1-x86_64
- systems:
- repos:
- images:
- mgmtclasses:
- packages:
- files:
- # 查看安裝鏡像文件信息
- [root@linux-node1 ~]#?cobbler distro report --name=CentOS-7.1-x86_64
- Name : CentOS-7.1-x86_64
- Architecture : x86_64
- TFTP Boot Files : {}
- Breed : redhat
- Comment :
- Fetchable Files : {}
- Initrd : /var/www/cobbler/ks_mirror/CentOS-7.1-x86_64/images/pxeboot/initrd.img
- Kernel : /var/www/cobbler/ks_mirror/CentOS-7.1-x86_64/images/pxeboot/vmlinuz
- Kernel Options : {}
- Kernel Options (Post Install) : {}
- Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS-7.1-x86_64'}
- Management Classes : []
- OS Version : rhel7
- Owners : ['admin']
- Red Hat Management Key : <<inherit>>
- Red Hat Management Server : <<inherit>>
- Template Files : {}
- # 查看所有的profile設(shè)置
- [root@linux-node1 ~]#?cobbler profile report
- # 查看指定的profile設(shè)置
- [root@linux-node1 ~]#?cobbler profile report --name=CentOS-7.1-x86_64
- Name : CentOS-7.1-x86_64
- TFTP Boot Files : {}
- Comment :
- DHCP Tag : default
- Distribution : CentOS-7.1-x86_64
- Enable gPXE? : 0
- Enable PXE Menu? : 1
- Fetchable Files : {}
- Kernel Options : {}
- Kernel Options (Post Install) : {}
-?Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks?-->默認(rèn)ks文件
- Kickstart Metadata : {}
- Management Classes : []
- Management Parameters : <<inherit>>
- Name Servers : []
- Name Servers Search Path : []
- Owners : ['admin']
- Parent Profile :
- Internal proxy :
- Red Hat Management Key : <<inherit>>
- Red Hat Management Server : <<inherit>>
- Repos : []
- Server Override : <<inherit>>
- Template Files : {}
- Virt Auto Boot : 1
- Virt Bridge : xenbr0
- Virt CPUs : 1
- Virt Disk Driver Type : raw
- Virt File Size(GB) : 5
- Virt Path :
- Virt RAM (MB) : 512
- Virt Type : kvm
- # 編輯profile,修改關(guān)聯(lián)的ks文件
- [root@linux-node1 ~]#?cobbler profile edit --name=CentOS-7.1-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.1-x86_64.cfg
- # 修改安裝系統(tǒng)的內(nèi)核參數(shù),在CentOS7系統(tǒng)有一個地方變了,就是網(wǎng)卡名變成eno16777736這種形式,但是為了運(yùn)維標(biāo)準(zhǔn)化,我們需要將它變成我們常用的eth0,因此使用下面的參數(shù)。但要注意是CentOS7才需要下面的步驟,CentOS6不需要。
- [root@linux-node1 ~]#?cobbler profile edit --name=CentOS-7.1-x86_64 --kopts='net.ifnames=0 biosdevname=0'
- [root@linux-node1 ~]#?cobbler profile report CentOS-7.1-x86_64
- Name : CentOS-7.1-x86_64
- TFTP Boot Files : {}
- Comment :
- DHCP Tag : default
- Distribution : CentOS-7.1-x86_64
- Enable gPXE? : 0
- Enable PXE Menu? : 1
- Fetchable Files : {}
- Kernel Options : {'biosdevname': '0', 'net.ifnames': '0'}
- Kernel Options (Post Install) : {}
- Kickstart : /var/lib/cobbler/kickstarts/CentOS-7.1-x86_64.cfg
- Kickstart Metadata : {}
- Management Classes : []
- Management Parameters : <<inherit>>
- Name Servers : []
- Name Servers Search Path : []
- Owners : ['admin']
- Parent Profile :
- Internal proxy :
- Red Hat Management Key : <<inherit>>
- Red Hat Management Server : <<inherit>>
- Repos : []
- Server Override : <<inherit>>
- Template Files : {}
- Virt Auto Boot : 1
- Virt Bridge : xenbr0
- Virt CPUs : 1
- Virt Disk Driver Type : raw
- Virt File Size(GB) : 5
- Virt Path :
- Virt RAM (MB) : 512
- Virt Type : kvm
- # 每次修改完都要同步一次
- [root@linux-node1 ~]#?cobbler sync
3.4 安裝系統(tǒng)
可以很愉快的告訴你到這里就可以安裝系統(tǒng)了!
新建一臺虛擬機(jī),不解釋,開機(jī)就可以看到下面的圖片了!
有沒有發(fā)現(xiàn)不美觀的地方?
網(wǎng)址不是我的!改!
- #修改Cobbler提示
- [root@linux-node1 ~]#?vim /etc/cobbler/pxe/pxedefault.template
- MENU TITLE Cobbler | http://www.zyops.com
- [root@linux-node1 ~]#?cobbler sync?# 修改配置都要同步
OK,現(xiàn)在好看多了。選擇第二項(xiàng)就可以繼續(xù)裝機(jī)了。你可以讓系統(tǒng)飛著,然后接著看下文!!
4. ks.cfg文件簡析
文件大部分參數(shù)含義見kickstart文章,此處只講一些不同的地方。同時(shí)可以參考模板文件。
- [root@linux-node1 kickstarts]#?cat CentOS-7.1-x86_64.cfg
- # Cobbler for Kickstart Configurator for CentOS 7.1 by yao zhang
- install
- url --url=$tree? # 這些$開頭的變量都是調(diào)用配置文件里的值。
- text
- lang en_US.UTF-8
- keyboard us
- zerombr
- bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
- # Network information
- $SNIPPET('network_config')
- timezone --utc Asia/Shanghai
- authconfig --enableshadow --passalgo=sha512
- rootpw? --iscrypted $default_password_crypted
- clearpart --all --initlabel
- part /boot --fstype xfs --size 1024 # CentOS7系統(tǒng)磁盤默認(rèn)格式xfs
- part swap --size 1024
- part / --fstype xfs --size 1 --grow
- firstboot --disable
- selinux --disabled
- firewall --disabled
- logging --level=info
- reboot
- %pre
- $SNIPPET('log_ks_pre')
- $SNIPPET('kickstart_start')
- $SNIPPET('pre_install_network_config')
- # Enable installation monitoring
- $SNIPPET('pre_anamon')
- %end
- %packages
- @base
@compat-libraries
- @debugging
- @development
- tree
- nmap
- sysstat
- lrzsz
- dos2unix
- telnet
- iptraf
- ncurses-devel
- openssl-devel
- zlib-devel
- OpenIPMI-tools
- screen
- %end
- %post
- systemctl disable postfix.service
- %end
5. 定制化安裝
可能從學(xué)習(xí)kickstart開始就有人想怎樣能夠指定某臺服務(wù)器使用指定ks文件,kickstart實(shí)現(xiàn)這功能可能比較復(fù)雜,但是Cobbler就很簡單了。
區(qū)分一臺服務(wù)器的最簡單的方法就是物理MAC地址。
物理服務(wù)器的MAC地址在服務(wù)器上的標(biāo)簽上寫了。
虛擬機(jī)的MAC查看
-?cobbler system add --name=oldboy --mac=00:0C:29:7F:2F:A1 --profile=CentOS-7.1-x86_64 --ip-address=10.0.0.111 --subnet=255.255.255.0 --gateway=10.0.0.2 --interface=eth0 --static=1 --hostname=oldboy.example.com --name-servers="114.114.114.114 8.8.8.8"
- # --name 自定義,但不能重復(fù)
- # 查看定義的列表
- [root@linux-node1 ~]#?cobbler system list
- oldboy
- [root@linux-node1 ~]#?cobbler sync
再次開機(jī)安裝就不再詢問選擇了,直接安裝。
6. Cobbler的Web管理界面的安裝與配置
已經(jīng)安裝cobbler-web軟件。
訪問網(wǎng)址:http://10.0.0.7/cobbler_web和https://10.0.0.7/cobbler_web
默認(rèn)用戶名:cobbler
默認(rèn)密碼 :cobbler
- /etc/cobbler/users.conf # Web服務(wù)授權(quán)配置文件
- /etc/cobbler/users.digest # 用于web訪問的用戶名密碼配置文件
- [root@linux-node1 ~]#?cat /etc/cobbler/users.digest
- cobbler:Cobbler:a2d6bae81669d707b72c0bd9806e01f3
- # 設(shè)置Cobbler web用戶登陸密碼
- # 在Cobbler組添加cobbler用戶,提示輸入2遍密碼確認(rèn)
- [root@linux-node1 ~]#?htdigest /etc/cobbler/users.digest "Cobbler" cobbler
- Changing password for user cobbler in realm Cobbler
- New password: 123456
- Re-type new password:123456
- [root@linux-node1 ~]#?cobbler sync
- [root@linux-node1 ~]#?/etc/init.d/httpd restart
- 停止 httpd: [確定]
- 正在啟動 httpd: [確定]
- [root@linux-node1 ~]#?/etc/init.d/cobblerd restart
- Stopping cobbler daemon: [確定]
- Starting cobbler daemon: [確定]
以后就需要用123456這個密碼登錄了。
本文轉(zhuǎn)自 295631788 51CTO博客,原文鏈接:http://blog.51cto.com/hequan/1770950,如需轉(zhuǎn)載請自行聯(lián)系原作者 創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎
總結(jié)
以上是生活随笔為你收集整理的COBBLER无人值守安装-----已用真实服务器测试的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用友BQ商业智能平台——图表功能
- 下一篇: V-3-3 在没有vCenter的情况下