1.安装epel源

yum -y install epel-release

2.安装cobbler环境所需的包

yum install -y httpd dhcp xinetd tftp cobbler cobbler-web pykickstart

3.启动相关服务

systemctl enable xinetd
systemctl start xinetd
systemctl start httpd
systemctl start cobblerd
systemctl enable httpd
systemctl enable cobblerd

4.cobbler check检查和配置

cobbler check

(1)需要设置cobbler服务器IP地址

vim /etc/cobbler/settings
server: 172.25.25.12

(2)next-server地址

vim /etc/cobbler/settings
next_server: 172.25.25.12

(3)修改tftp配置,启用tftp

vim /etc/xinetd.d/tftp
disable no

(4)下载一些boot-loaders

cobbler get-loaders

(5)启动rsyncd服务并设置开机启动

systemctl start rsync
systenctl enable rsync

(6)提示如果是deb系统需要安装debmirror,这里我们是centos,可以不做
(7)修改模板里的密码
第7步提示说默认模板里密码是cobbler,这样装出来的系统默认root密码就都是cobbler了,你需要自定义一个不一样的密码。通过openssl生成一个加密的密码
这里设置密码为123456 ,并用cobbler字符填充到加密后的字符串里
-1:用MD5基于BSD的密钥算法。
-salt string:用指定的字符串填充。当从终端读取一个密钥时,则填充它。
如下

openssl passwd -1 -salt 'cobbler' '123456'
$1$cobbler$sqDDOBeLKJVmxTCZr52/11

复制加密后的字符串到cobbler配置文件中替换原来的

vim /etc/cobbler/settings
default_password_crypted: "$1$cobbler$sqDDOBeLKJVmxTCZr52/11"

5.重启cobblerd服务,看到配置已经完成了。下面1和2不用管

systemctl restart cobblerd
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
2 : 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.

6.配置cobbler管理dhcp
接下来设置dhcp,最好让cobler管理dhcp

vim /etc/cobbler/settings

这里改成1,这样cobbler才能管理dhcp配置文件

manage_dhcp: 1

修改dhcp模板文件,修改它之后,会自动生成dhcp的配置文件

vim /etc/cobbler/dhcp.template 

$next_server这里不用修改,它会调用cobbler配置文件中之前设置的next_server的地址
执行cobbler sync的时候,它会自动生成dhcp的配置,并自动帮你重启dhcp

systemctl restart cobblerd
cobbler sync

查看dhcp的配置文件,已经变化了

7.导入镜像到cobbler中

mount /dev/cdrom /mnt

导入镜像到cobbler中
先查看下cobbler默认存储系统的目录,现在是没有系统镜像的状态

ll /var/www/cobbler/ks_mirror/ 

从哪里导入,名称是什么,架构是什么

cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64

再次导入centos6.6的系统。

cobbler import --path=/mnt/ --name=CentOS-6-x86_64 --arch=x86_64

8.kickstart文件介绍

#Kickstart Configurator for cobbler by Jason Zhao
#platform=x86, AMD64, or Intel EM64T
#System language
lang en_US
#System keyboard
keyboard us
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $default_password_crypted
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
url --url=$tree
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype xfs --size 1024 --ondisk sda
part swap --size 16384 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda
#System authorization infomation
auth --useshadow --enablemd5
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=em1 --onboot=on
# Reboot after installation
reboot
#Firewall configuration
firewall --disabled
#SELinux configuration
selinux --disabled
#Do not configure XWindows
skipx
#Package install information
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end %packages
@ base
@ core
sysstat
iptraf
ntp
lrzsz
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
mysql
nmap
screen
%end %post
systemctl disable postfix.service
%end

下面挑一些重点说明下

这个就是在cobbler里面设置的密码,就是那个openssl生成的密码,它会引用
#Root password
rootpw --iscrypted $default_password_crypted url=$tree 它是cobbler内部的变量
#Use NFS installation Media
url --url=$tree bootloader安装在mbr上
#System bootloader configuration
bootloader --location=mbr 磁盘分区信息
#Disk partitioning information
part /boot --fstype xfs --size 1024 --ondisk sda
part swap --size 16384 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda

下面是一些要求安装的系统包
%packages
@ base
@ core
sysstat
iptraf
ntp
lrzsz
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
mysql
nmap
screen
%end

下面是现网使用的centos6的kickstart文件,装完之后,做了优化,关闭很多不必要的服务

#Kickstart Configurator for cobbler by Jason Zhao
#platform=x86, AMD64, or Intel EM64T
key --skip
#System language
lang en_US
#System keyboard
keyboard us
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $default_password_crypted
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
url --url=$tree
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype ext4 --size 1024 --ondisk sda
part swap --size 16384 --ondisk sda
part / --fstype ext4 --size 1 --grow --ondisk sda
#System authorization infomation
auth --useshadow --enablemd5
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=em1 --onboot=on
#Reboot after installation
reboot
#Firewall configuration
firewall --disabled
#SELinux configuration
selinux --disabled
#Do not configure XWindows
skipx
#Package install information
%packages
@ base
@ chinese-support
@ core
sysstat
iptraf
ntp
e2fsprogs-devel
keyutils-libs-devel
krb5-devel
libselinux-devel
libsepol-devel
lrzsz
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
mysql
lockdev
minicom
nmap %post
#/bin/sed -i 's/#Protocol 2,1/Protocol 2/' /etc/ssh/sshd_config
/bin/sed -i 's/^ca::ctrlaltdel:/#ca::ctrlaltdel:/' /etc/inittab
/sbin/chkconfig --level 3 diskdump off
/sbin/chkconfig --level 3 dc_server off
/sbin/chkconfig --level 3 nscd off
/sbin/chkconfig --level 3 netfs off
/sbin/chkconfig --level 3 psacct off
/sbin/chkconfig --level 3 mdmpd off
/sbin/chkconfig --level 3 netdump off
/sbin/chkconfig --level 3 readahead off
/sbin/chkconfig --level 3 wpa_supplicant off
/sbin/chkconfig --level 3 mdmonitor off
/sbin/chkconfig --level 3 microcode_ctl off
/sbin/chkconfig --level 3 xfs off
/sbin/chkconfig --level 3 lvm2-monitor off
/sbin/chkconfig --level 3 iptables off
/sbin/chkconfig --level 3 nfs off
/sbin/chkconfig --level 3 ipmi off
/sbin/chkconfig --level 3 autofs off
/sbin/chkconfig --level 3 iiim off
/sbin/chkconfig --level 3 cups off
/sbin/chkconfig --level 3 openibd off
/sbin/chkconfig --level 3 saslauthd off
/sbin/chkconfig --level 3 ypbind off
/sbin/chkconfig --level 3 auditd off
/sbin/chkconfig --level 3 rdisc off
/sbin/chkconfig --level 3 tog-pegasus off
/sbin/chkconfig --level 3 rpcgssd off
/sbin/chkconfig --level 3 kudzu off
/sbin/chkconfig --level 3 gpm off
/sbin/chkconfig --level 3 arptables_jf off
/sbin/chkconfig --level 3 dc_client off
/sbin/chkconfig --level 3 lm_sensors off
/sbin/chkconfig --level 3 apmd off
/sbin/chkconfig --level 3 sysstat off
/sbin/chkconfig --level 3 cpuspeed off
/sbin/chkconfig --level 3 rpcidmapd off
/sbin/chkconfig --level 3 rawdevices off
/sbin/chkconfig --level 3 rhnsd off
/sbin/chkconfig --level 3 nfslock off
/sbin/chkconfig --level 3 winbind off
/sbin/chkconfig --level 3 bluetooth off
/sbin/chkconfig --level 3 isdn off
/sbin/chkconfig --level 3 portmap off
/sbin/chkconfig --level 3 anacron off
/sbin/chkconfig --level 3 irda off
/sbin/chkconfig --level 3 NetworkManager off
/sbin/chkconfig --level 3 acpid off
/sbin/chkconfig --level 3 pcmcia off
/sbin/chkconfig --level 3 atd off
/sbin/chkconfig --level 3 sendmail off
/sbin/chkconfig --level 3 haldaemon off
/sbin/chkconfig --level 3 smartd off
/sbin/chkconfig --level 3 xinetd off
/sbin/chkconfig --level 3 netplugd off
/sbin/chkconfig --level 3 readahead_early off
/sbin/chkconfig --level 3 xinetd off
/sbin/chkconfig --level 3 ntpd on
/sbin/chkconfig --level 3 avahi-daemon off
/sbin/chkconfig --level 3 ip6tables off
/sbin/chkconfig --level 3 restorecond off
/sbin/chkconfig --level 3 postfix off

Cobbler 常用命令

cobbler check #检查cobbler配置
cobbler sync #同步配置到dhcp/pxe和数据目录
cobbler list #列出所有的cobbler元素
cobbler import #导入安装的系统镜像
cobbler report #列出各元素的详细信息
cobbler distro #查看导入的发行版系统信息
cobbler profile #查看配置信息
cobbler system #查看添加的系统信息
cobbler reposync #同步yum仓库到本地

查看当前配置信息

cobbler profile
usage
=====
cobbler profile add
cobbler profile copy
cobbler profile dumpvars
cobbler profile edit
cobbler profile find
cobbler profile getks
cobbler profile list
cobbler profile remove
cobbler profile rename
cobbler profile report

默认的ks文件位置,需要改成自己实际文件位置

Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks

把centos6和centos7的ks文件上传到下面目录下

/var/lib/cobbler/kickstarts/

更改centos6和centos7的ks文件位置

cobbler profile edit --name=CentOS-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7-x86_64.cfg
cobbler profile edit --name=CentOS-6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-6-x86_64.cfg

更改centos7的内核参数,让安装后网卡显示eth0
centos7 你想让网卡变成eth0 ,需要加内核参数
这里ks安装也需要加内核参数
通过看到有一行,关于设置内核参数的

cobbler profile report --name=CentOS-7-x86_64

这一行的是关于内核参数的配置

Kernel Options : {}

添加内核参数和查看

cobbler profile edit --name=CentOS-7-x86_64 --kopts='net.ifnames=0 biosdevname=0'
cobbler profile report --name=CentOS-7-x86_64

同步更改后的配置信息

可以看到它删除了/var/www下面的一些文件,然后重新生成

cobbler sync

如果你修改文件不执行sync,修改是不生效的

最新文章

  1. bzoj 1711 [Usaco2007 Open]Dining吃饭&&poj 3281 Dining
  2. 曲演杂坛--当ROW_NUMBER遇到TOP
  3. CheckBox 半选中状态
  4. Spring的注解
  5. 64位系统如何导入excel
  6. 如何给span设置高度宽度?
  7. 01.C语言关于结构体的学习笔记
  8. 【转载】NativeSQL实例
  9. Oracle 取上周一到周末日期的查询语句
  10. HTML之学习笔记(四)格式化标签和特殊字符
  11. android shape总结 和控制的风格定制
  12. C#入门经典第十章类的成员-1
  13. HBase介绍
  14. 博客 新址: https://pheromone.github.io/
  15. netty入门(一)
  16. python学习笔记--文件重命名,删除及文件夹
  17. css3之动画属性transform、transition、animation
  18. vue-update-表单形式复写方法上传图片
  19. #leetcode刷题之路18-四数之和
  20. poj1063

热门文章

  1. 如何使用github搜索需要的开源项目
  2. Vue 3自定义指令开发
  3. Android N wifi auto connect流程分析
  4. 为什么 TCP 协议有粘包问题
  5. RVA与FOA的转换
  6. Go Code Review Comments
  7. Uber三代API 生命周期管理平台实现 Uber
  8. Redis集群数据没法拆分时的搭建策略
  9. Python中单引号,双引号,三引号的区别
  10. http状态码、错误分析