centos6.6安装cobber
时间:2015-08-19 22:40 来源:51cto.com 作者:rickyhui
Cobbler 介绍:
Cobbler 是一个系统启动服务(boot server),可以通过网络启动(PXE)的方式用来快速安装、重装物理服务器和虚拟机,支持安装不同的 Linux 发行版和 Windows。该工具使用python开发,小巧轻便(才15k行代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP,DNS,以及yum包镜像。
Cobbler 使用命令行方式管理,也提供了基于 Web 的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
Cobbler提供以下服务集成:
PXE服务支持
DHCP服务管理
DNS服务管理(可选bind,dnsmasq)
电源管理
Kickstart服务支持
yum仓库管理
TFTP (PXE启动时需要)
Apache(提供kickstart 的安装源,并提供定制化的kickstart配置)
同时,它和apache做了深度整合。通过 cobbler,可以实现对RedHat/Centos/Fedora系统的快速部署,同时也支持Suse 和Debian(Ubuntu)系统。
cobbler装机系统是较早前kickstart的升级版,优点比较容易配置,还自带web界面比较易于管理,不足在于中文资料较少。和Kickstart不同的是,使用cobbler不会因为在局域网中启动了dhcp而导致有些机器因为默认从pxe启动在重启服务器后加载tftp内容导致启动终止。
通过配置cobbler自动部署DHCP、TFTP、HTTP,在安装过程中加载kiskstart无人值守安装应答文件实现无人值守。从客户端使用PXE引导启动安装。
Cobbler的工作流程:
2.cobber 安装
rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
vim /etc/selinux/config
setenforce 0
/etc/init.d/iptables stop
yum -y install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes debmirror pykickstart fence-agents
开启tftp与rsync服务
sed -i '/disable/c disable = no' /etc/xinetd.d/tftp
sed -i -e 's/= yes/= no/g' /etc/xinetd.d/rsync
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
/etc/init.d/xientd restart
[root@localhost ~]# /etc/init.d/cobblerd start
Starting cobbler daemon: [ OK ]
[root@localhost ~]# /etc/init.d/httpd start
Starting httpd:
cobbler check(时间有点长)
Traceback (most recent call last):
File "/usr/bin/cobbler", line 36, in <module>
sys.exit(app.main())
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 655, in main
rc = cli.run(sys.argv)
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 270, in run
self.token = self.remote.login("", self.shared_secret)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
return u.close()
File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "<class 'cobbler.cexceptions.CX'>:'login failed'">
报错了
经过网上查找这样解决如下:
[root@localhost ~]# service cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
[root@localhost ~]# cobbler get-loaders
task started: 2014-10-23_131316_get_loaders
task started (id=Download Bootloader Content, time=Thu Oct 23 13:13:16 2014)
downloading http://www.cobblerd.org/loaders/README to /var/lib/cobbler/loaders/README
downloading http://www.cobblerd.org/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading http://www.cobblerd.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading http://www.cobblerd.org/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading http://www.cobblerd.org/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading http://www.cobblerd.org/loaders/yaboot-1.3.14-12 to /var/lib/cobbler/loaders/yaboot
downloading http://www.cobblerd.org/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading http://www.cobblerd.org/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading http://www.cobblerd.org/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading http://www.cobblerd.org/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***
配置检查
# cobbler check
[root@localhost ~]# cobbler check
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 : 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
4 : comment out 'dists' on /etc/debmirror.conf for proper debian support
5 : comment out 'arches' on /etc/debmirror.conf for proper debian support
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
Restart cobblerd and then run 'cobbler sync' to apply changes.
上面这段信息大意就是:
1,编辑/etc/cobbler/settings文件,找到 server选项,修改为适当的ip地址,本实例配置ip为:192.168.101.195
2,编辑/etc/cobbler/settings文件,找到 next_server选项,修改为适当的ip地址,本实例配置ip为:192.168.101.195
3,编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no
4,提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略,如果需要安装,下载地址为:
#sed -i 's/next_server: 127.0.0.1/next_server: 192.168.1.245/g' /etc/cobbler/settings
#sed -i 's/server: 127.0.0.1/server: 192.168.1.245/g' /etc/cobbler/settings
修复debian/ubuntu系统安装选项支持包
# vi /etc/debmirror.conf
说明:前提是安装debmirror pykickstart这两个包,注释掉如下两行。
#@dists="sid";
#@arches="i386";
修改cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码。生成密码命令: 其中“random-phrase-here”为干扰码
[root@localhost ~]# openssl passwd -1 -salt 'random-phrase-here' 'password'
$1$random-p$Laug2DypNYtiuFhtwuw94/
将上面的加密串加入cobbler配置文件中。
# vi /etc/cobbler/settings
# 修改为如下配置
default_password_crypted: "$1$random-p$Laug2DypNYtiuFhtwuw94/"
/etc/init.d/cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
[root@localhost ~]# cobbler check
The following are potential configuration items that you may want to fix:
1 : 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
Restart cobblerd and then run 'cobbler sync' to apply changes.
配置dhcp配置文件
# mv /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.bak
# vi /etc/cobbler/dhcp.template
# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# 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;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1..1;
option domain-name-servers 114.114.114.114;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.150 192.168.1.200;
default-lease-time 1800;
max-lease-time 1800;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
}
#for dhcp_tag in $dhcp_tags.keys():
## group could be subnet if your dhcp tags line up with your subnets
## or really any valid dhcpd.conf construct ... if you only use the
## default dhcp tag in cobbler, the group block can be deleted for a
## flat configuration
# group for Cobbler DHCP tag: $dhcp_tag
group {
}
#end for
同步配置:
cobbler sync
#wget
#wget http://mirrors.sina.cn/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1503-01.iso
#ls /iso/
CentOS-6.6-x86_64-bin-DVD.iso CentOS-7-x86_64-DVD-1503-01.iso
# cd /var/lib/cobbler/kickstarts/
vi c66_x86_64.ks
#Generated by Kickstart Configurator
#platform=x86, AMD64, Intel EM64T
#System language
#lang en_SG
lang en_US.UTF-8
#Language modules to install
#langsupport en_US --default=en_SG
#System keyboard
keyboard us
#System mouse
#mouse
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $default_password_crypted
#rootpw --iscrypted $1$5wddNvBE$WBOcZHUoR4qvSJURKtYAY.
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use http installation Media
url --url=http://192.168.1.245/cobbler/ks_mirror/CentOS6.6-x86_64
#System bootloader configuration
bootloader --append="console=tty0 console=ttyS0,115200 crashkernel=auto biosdevname=0" --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
ignoredisk --only-use=sda
#Disk partitioning information
part / --fstype ext4 --size 30000
part /data --fstype ext4 --size 1 --grow
#part /usr/local --fstype ext3 --size 100000
part /boot --fstype ext4 --size 500
#part swap --size 25000
part swap --size 16000
#part /usr/local --fstype ext3 --size 1 --grow --ondisk=sdb
auth --useshadow --enablemd5
#Network information
#network --bootproto=dhcp --device=em1 --onboot=on
network --bootproto=dhcp --onboot=on
#network --bootproto=static --ip=192.168.30.15 --netmask=255.255.255.0 --gateway=192.168.30.254 --device=eth0
#Firewall configuration
#firewall --enabled --http --ssh
firewall --disable
#SELinux configuration
selinux --disable
#XWindows configuration information
xconfig --depth=16 --resolution=800x600 --defaultdesktop=GNOME --startxonboot
#Package install information
%packages
@core
@base
@chinese-support
@compat-libraries
@development
@performance
@server-policy
@system-admin-tools
lrzsz
dstat
sysstat
iptraf
%post
sed -i 's/id:5:initdefault/id:3:initdefault/' /etc/inittab
echo -e "* soft nofile 65536\n* hard nofile 65536\n" >> /etc/security/limits.conf
sed -i '/unlimited/d' /etc/security/limits.d/90-nproc.conf ; echo '* - nproc -1' >> /etc/security/limits.d/90-nproc.conf
mv /var/log /data/;ln -s /data/log /var/
rpm -e NetworkManager NetworkManager-glib NetworkManager-tui
#%pre
#/usr/sbin/parted -s /dev/sda mklabel gpt
#%end
#cat c70_x86_64.ks
# kickstart template for Fedora 8 and later.
# (includes %end blocks)
# do not use with earlier distros
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
ignoredisk --only-use=sda
# Use text mode install
text
# Firewall configuration
firewall --disable
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US.UTF-8
# Use network installation
#url --url=$tree
url --url=http://192.168.1.245/cobbler/ks_mirror/CentOS7.0-x86_64
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
#$SNIPPET('network_config')
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
#autopart
part / --fstype xfs --size 30000
part /data --fstype xfs --size 1 --grow
part /boot --fstype xfs --size 500
part swap --size 16000
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
#$SNIPPET('func_install_if_enabled')
@core
@base
@compat-libraries
@development
@system-admin-tools
lrzsz
dstat
sysstat
iptraf
net-tools
vim
%end
%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end
%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
mv /var/log /data/;ln -s /data/log /var/
rpm -e NetworkManager NetworkManager-glib NetworkManager-tui
%end
同步配置:
cobbler sync
#mkdir /mnt/Centos6.6
mount -o loop /iso/CentOS-6.6-x86_64-bin-DVD.iso /mnt/Centos6.6/
cobbler import --path=/mnt/Centos6.6 --name=CentOS6.6-x86_64 --arch=x86_64
cobbler profile edit --name=CentOS6.6-x86_64 --distro=CentOS6.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/c66_x86_64.ks
cobbler distro list
cobbler sync
mkdir /mnt/CentOS7.0
mount -o loop /iso/CentOS-7-x86_64-DVD-1503-01.iso /mnt/CentOS7.0/
cobbler import --path=/mnt/CentOS7.0/ --name=CentOS7.0-x86_64 --arch=x86_64
cobbler profile edit --name=CentOS7.0-x86_64 --distro=CentOS7.0-x86_64 --kickstart=/var/lib/cobbler/kickstarts/c70_x86_64.ks
cobbler sync
ubuntu
Ubuntu:
mkdir /mnt/Ubuntu_14.04.1
mount -o loop /iso/ubuntu-14.04.1-server-amd64.iso /mnt/Ubuntu_14.04.1
cobbler import --name=Ubuntu-14.04.1-amd64 --path=/mnt/Ubuntu_14.04.1/ --breed=ubuntu
cobbler profile edit --name=Ubuntu-14.04.1-x86_64 --kickstart=/var/lib/cobbler/kickstarts/u14_04.seed --kopts="netcfg/choose_interface=eth0"
cobbler sync
客户端安装操作系统:
开机后按F12键选择PXE网卡启动后,通过DHCP获取到IP后将出现如下界面
默认20秒时间内,未选择的话将通过本地磁盘启动,可以通过上下键选择要相应的操作系统进行安装
(责任编辑:IT)
Cobbler 介绍: Cobbler 是一个系统启动服务(boot server),可以通过网络启动(PXE)的方式用来快速安装、重装物理服务器和虚拟机,支持安装不同的 Linux 发行版和 Windows。该工具使用python开发,小巧轻便(才15k行代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP,DNS,以及yum包镜像。 Cobbler 使用命令行方式管理,也提供了基于 Web 的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。 Cobbler提供以下服务集成: PXE服务支持 DHCP服务管理 DNS服务管理(可选bind,dnsmasq) 电源管理 Kickstart服务支持 yum仓库管理 TFTP (PXE启动时需要) Apache(提供kickstart 的安装源,并提供定制化的kickstart配置) 同时,它和apache做了深度整合。通过 cobbler,可以实现对RedHat/Centos/Fedora系统的快速部署,同时也支持Suse 和Debian(Ubuntu)系统。 cobbler装机系统是较早前kickstart的升级版,优点比较容易配置,还自带web界面比较易于管理,不足在于中文资料较少。和Kickstart不同的是,使用cobbler不会因为在局域网中启动了dhcp而导致有些机器因为默认从pxe启动在重启服务器后加载tftp内容导致启动终止。 通过配置cobbler自动部署DHCP、TFTP、HTTP,在安装过程中加载kiskstart无人值守安装应答文件实现无人值守。从客户端使用PXE引导启动安装。 Cobbler的工作流程: 2.cobber 安装 rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm vim /etc/selinux/config setenforce 0 /etc/init.d/iptables stop yum -y install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes debmirror pykickstart fence-agents 开启tftp与rsync服务 sed -i '/disable/c disable = no' /etc/xinetd.d/tftp sed -i -e 's/= yes/= no/g' /etc/xinetd.d/rsync sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings /etc/init.d/xientd restart [root@localhost ~]# /etc/init.d/cobblerd start Starting cobbler daemon: [ OK ] [root@localhost ~]# /etc/init.d/httpd start Starting httpd: cobbler check(时间有点长) Traceback (most recent call last): File "/usr/bin/cobbler", line 36, in <module> sys.exit(app.main()) File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 655, in main rc = cli.run(sys.argv) File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 270, in run self.token = self.remote.login("", self.shared_secret) File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__ return self.__send(self.__name, args) File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request verbose=self.__verbose File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request return self._parse_response(h.getfile(), sock) File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response return u.close() File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 1: "<class 'cobbler.cexceptions.CX'>:'login failed'"> 报错了 经过网上查找这样解决如下: [root@localhost ~]# service cobblerd restart Stopping cobbler daemon: [ OK ] Starting cobbler daemon: [ OK ] [root@localhost ~]# cobbler get-loaders task started: 2014-10-23_131316_get_loaders task started (id=Download Bootloader Content, time=Thu Oct 23 13:13:16 2014) downloading http://www.cobblerd.org/loaders/README to /var/lib/cobbler/loaders/README downloading http://www.cobblerd.org/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo downloading http://www.cobblerd.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot downloading http://www.cobblerd.org/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux downloading http://www.cobblerd.org/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi downloading http://www.cobblerd.org/loaders/yaboot-1.3.14-12 to /var/lib/cobbler/loaders/yaboot downloading http://www.cobblerd.org/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0 downloading http://www.cobblerd.org/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32 downloading http://www.cobblerd.org/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi downloading http://www.cobblerd.org/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi *** TASK COMPLETE *** 配置检查 # cobbler check [root@localhost ~]# cobbler check 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 : 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 4 : comment out 'dists' on /etc/debmirror.conf for proper debian support 5 : comment out 'arches' on /etc/debmirror.conf for proper debian support 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 Restart cobblerd and then run 'cobbler sync' to apply changes. 上面这段信息大意就是: 1,编辑/etc/cobbler/settings文件,找到 server选项,修改为适当的ip地址,本实例配置ip为:192.168.101.195 2,编辑/etc/cobbler/settings文件,找到 next_server选项,修改为适当的ip地址,本实例配置ip为:192.168.101.195 3,编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no 4,提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略,如果需要安装,下载地址为: #sed -i 's/next_server: 127.0.0.1/next_server: 192.168.1.245/g' /etc/cobbler/settings #sed -i 's/server: 127.0.0.1/server: 192.168.1.245/g' /etc/cobbler/settings 修复debian/ubuntu系统安装选项支持包 # vi /etc/debmirror.conf 说明:前提是安装debmirror pykickstart这两个包,注释掉如下两行。 #@dists="sid"; #@arches="i386"; 修改cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码。生成密码命令: 其中“random-phrase-here”为干扰码 [root@localhost ~]# openssl passwd -1 -salt 'random-phrase-here' 'password' $1$random-p$Laug2DypNYtiuFhtwuw94/ 将上面的加密串加入cobbler配置文件中。 # vi /etc/cobbler/settings # 修改为如下配置 default_password_crypted: "$1$random-p$Laug2DypNYtiuFhtwuw94/" /etc/init.d/cobblerd restart Stopping cobbler daemon: [ OK ] Starting cobbler daemon: [ OK ] [root@localhost ~]# cobbler check The following are potential configuration items that you may want to fix: 1 : 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 Restart cobblerd and then run 'cobbler sync' to apply changes. 配置dhcp配置文件 # mv /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.bak # vi /etc/cobbler/dhcp.template # ****************************************************************** # Cobbler managed dhcpd.conf file # # generated from cobbler dhcp.conf template ($date) # 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; allow booting; allow bootp; ignore client-updates; set vendorclass = option vendor-class-identifier; option pxe-system-type code 93 = unsigned integer 16; subnet 192.168.1.0 netmask 255.255.255.0 { option routers 192.168.1..1; option domain-name-servers 114.114.114.114; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.1.150 192.168.1.200; default-lease-time 1800; max-lease-time 1800; next-server $next_server; class "pxeclients" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; if option pxe-system-type = 00:02 { filename "ia64/elilo.efi"; } else if option pxe-system-type = 00:06 { filename "grub/grub-x86.efi"; } else if option pxe-system-type = 00:07 { filename "grub/grub-x86_64.efi"; } else { filename "pxelinux.0"; } } } #for dhcp_tag in $dhcp_tags.keys(): ## group could be subnet if your dhcp tags line up with your subnets ## or really any valid dhcpd.conf construct ... if you only use the ## default dhcp tag in cobbler, the group block can be deleted for a ## flat configuration # group for Cobbler DHCP tag: $dhcp_tag group { } #end for 同步配置: cobbler sync #wget #wget http://mirrors.sina.cn/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1503-01.iso #ls /iso/ CentOS-6.6-x86_64-bin-DVD.iso CentOS-7-x86_64-DVD-1503-01.iso # cd /var/lib/cobbler/kickstarts/ vi c66_x86_64.ks #Generated by Kickstart Configurator #platform=x86, AMD64, Intel EM64T #System language #lang en_SG lang en_US.UTF-8 #Language modules to install #langsupport en_US --default=en_SG #System keyboard keyboard us #System mouse #mouse #Sytem timezone timezone Asia/Shanghai #Root password rootpw --iscrypted $default_password_crypted #rootpw --iscrypted $1$5wddNvBE$WBOcZHUoR4qvSJURKtYAY. #Reboot after installation reboot #Use text mode install text #Install OS instead of upgrade install #Use http installation Media url --url=http://192.168.1.245/cobbler/ks_mirror/CentOS6.6-x86_64 #System bootloader configuration bootloader --append="console=tty0 console=ttyS0,115200 crashkernel=auto biosdevname=0" --location=mbr #Clear the Master Boot Record zerombr yes #Partition clearing information clearpart --all --initlabel ignoredisk --only-use=sda #Disk partitioning information part / --fstype ext4 --size 30000 part /data --fstype ext4 --size 1 --grow #part /usr/local --fstype ext3 --size 100000 part /boot --fstype ext4 --size 500 #part swap --size 25000 part swap --size 16000 #part /usr/local --fstype ext3 --size 1 --grow --ondisk=sdb auth --useshadow --enablemd5 #Network information #network --bootproto=dhcp --device=em1 --onboot=on network --bootproto=dhcp --onboot=on #network --bootproto=static --ip=192.168.30.15 --netmask=255.255.255.0 --gateway=192.168.30.254 --device=eth0 #Firewall configuration #firewall --enabled --http --ssh firewall --disable #SELinux configuration selinux --disable #XWindows configuration information xconfig --depth=16 --resolution=800x600 --defaultdesktop=GNOME --startxonboot #Package install information %packages @core @base @chinese-support @compat-libraries @development @performance @server-policy @system-admin-tools lrzsz dstat sysstat iptraf %post sed -i 's/id:5:initdefault/id:3:initdefault/' /etc/inittab echo -e "* soft nofile 65536\n* hard nofile 65536\n" >> /etc/security/limits.conf sed -i '/unlimited/d' /etc/security/limits.d/90-nproc.conf ; echo '* - nproc -1' >> /etc/security/limits.d/90-nproc.conf mv /var/log /data/;ln -s /data/log /var/ rpm -e NetworkManager NetworkManager-glib NetworkManager-tui #%pre #/usr/sbin/parted -s /dev/sda mklabel gpt #%end #cat c70_x86_64.ks # kickstart template for Fedora 8 and later. # (includes %end blocks) # do not use with earlier distros #platform=x86, AMD64, or Intel EM64T # System authorization information auth --useshadow --enablemd5 # System bootloader configuration bootloader --location=mbr # Partition clearing information clearpart --all --initlabel ignoredisk --only-use=sda # Use text mode install text # Firewall configuration firewall --disable # Run the Setup Agent on first boot firstboot --disable # System keyboard keyboard us # System language lang en_US.UTF-8 # Use network installation #url --url=$tree url --url=http://192.168.1.245/cobbler/ks_mirror/CentOS7.0-x86_64 # If any cobbler repo definitions were referenced in the kickstart profile, include them here. $yum_repo_stanza # Network information #$SNIPPET('network_config') network --bootproto=dhcp --device=eth0 --onboot=on # Reboot after installation reboot #Root password rootpw --iscrypted $default_password_crypted # SELinux configuration selinux --disabled # Do not configure the X Window System skipx # System timezone timezone Asia/Shanghai # Install OS instead of upgrade install # Clear the Master Boot Record zerombr # Allow anaconda to partition the system as needed #autopart part / --fstype xfs --size 30000 part /data --fstype xfs --size 1 --grow part /boot --fstype xfs --size 500 part swap --size 16000 %pre $SNIPPET('log_ks_pre') $SNIPPET('kickstart_start') $SNIPPET('pre_install_network_config') # Enable installation monitoring $SNIPPET('pre_anamon') %end %packages #$SNIPPET('func_install_if_enabled') @core @base @compat-libraries @development @system-admin-tools lrzsz dstat sysstat iptraf net-tools vim %end %post --nochroot $SNIPPET('log_ks_post_nochroot') %end %post $SNIPPET('log_ks_post') # Start yum configuration $yum_config_stanza # End yum configuration $SNIPPET('post_install_kernel_options') $SNIPPET('post_install_network_config') $SNIPPET('func_register_if_enabled') $SNIPPET('download_config_files') $SNIPPET('koan_environment') $SNIPPET('redhat_register') $SNIPPET('cobbler_register') # Enable post-install boot notification $SNIPPET('post_anamon') # Start final steps $SNIPPET('kickstart_done') # End final steps mv /var/log /data/;ln -s /data/log /var/ rpm -e NetworkManager NetworkManager-glib NetworkManager-tui %end 同步配置: cobbler sync #mkdir /mnt/Centos6.6 mount -o loop /iso/CentOS-6.6-x86_64-bin-DVD.iso /mnt/Centos6.6/ cobbler import --path=/mnt/Centos6.6 --name=CentOS6.6-x86_64 --arch=x86_64 cobbler profile edit --name=CentOS6.6-x86_64 --distro=CentOS6.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/c66_x86_64.ks cobbler distro list cobbler sync mkdir /mnt/CentOS7.0 mount -o loop /iso/CentOS-7-x86_64-DVD-1503-01.iso /mnt/CentOS7.0/ cobbler import --path=/mnt/CentOS7.0/ --name=CentOS7.0-x86_64 --arch=x86_64 cobbler profile edit --name=CentOS7.0-x86_64 --distro=CentOS7.0-x86_64 --kickstart=/var/lib/cobbler/kickstarts/c70_x86_64.ks cobbler sync ubuntu Ubuntu: mkdir /mnt/Ubuntu_14.04.1 mount -o loop /iso/ubuntu-14.04.1-server-amd64.iso /mnt/Ubuntu_14.04.1 cobbler import --name=Ubuntu-14.04.1-amd64 --path=/mnt/Ubuntu_14.04.1/ --breed=ubuntu cobbler profile edit --name=Ubuntu-14.04.1-x86_64 --kickstart=/var/lib/cobbler/kickstarts/u14_04.seed --kopts="netcfg/choose_interface=eth0" cobbler sync 客户端安装操作系统: 开机后按F12键选择PXE网卡启动后,通过DHCP获取到IP后将出现如下界面 默认20秒时间内,未选择的话将通过本地磁盘启动,可以通过上下键选择要相应的操作系统进行安装 (责任编辑:IT) |