基于cobbler 2.8.x制作部署机手册

2018-06-06  本文已影响0人  孙广宁

背景知识

实验部署机物理配置

项目 参数
操作系统 Centos-7-x86_64-DVD-1511.iso
CPU 4核
RAM 16G
硬盘 100G
推送所使用的镜像 Centos-7-x86_64-DVD-1511.iso

基于CLI版的cobbler部署及简单实用

setenforce 0
sed -i "s/^SELINUX\=.*$/SELINUX\=disabled/g" /etc/selinux/config
http://cobbler.github.io/manuals/2.8.0/4/2_-_SELinux.html
# yum install python-netaddr python-simplejson PyYAML python-cheetah httpd mod_wsgi
# yum install git make python-devel pyflakes python-pep8 python-sphinx rpm-build
yum install cobbler
# git clone https://github.com/cobbler/cobbler.git
# cd cobbler
# make install
修改cobbler的/etc/cobbler/settings配置
 * 使用openssl生成密码并回归到配置文件
$ openssl passwd -1
default_password_crypted: "$1$bfI7WLZz$PxXetL97LkScqJFxnW7KS1"
# default, localhost
server: 127.0.0.1
# default, localhost
next_server: 127.0.0.1
# default, don't manage
manage_dhcp: 0
$ vi /etc/cobbler/dhcp.template
subnet 192.168.1.0 netmask 255.255.255.0 {
     option routers             192.168.1.1;
     option domain-name-servers 192.168.1.210,192.168.1.211;
     option subnet-mask         255.255.255.0;
     filename                   "/pxelinux.0";
     default-lease-time         2.8.0;
     max-lease-time             43200;
     next-server                $next_server;
}
cobbler所需要的本地存储
http://cobbler.github.io/manuals/2.8.0/2/5_-_Relocating_Your_Installation.html
启动cobbler
$ systemctl start cobblerd.service
$ systemctl enable cobblerd.service
$ systemctl status cobblerd.service
$ cobbler check
The following are potential configuration items that you may want to fix:
1. ...
2. ...
Restart cobblerd and then run 'cobbler sync' to apply changes.
cobbler sync
$ mount -t iso9660 -o loop,ro /path/to/isos/Fedora-Server-dvd-x86_64-28-1.1.iso /mnt
$ cobbler import --name=fedora28 --arch=x86_64 --path=/mnt
$ cobbler distro list
$ cobbler profile list
$ cobbler distro report --name=fedora28-x86_64
Name                           : fedora28-x86_64
Architecture                   : x86_64
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        :
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/ks_mirror/fedora28-x86_64/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/fedora28-x86_64/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/fedora28-x86_64'}
Management Classes             : []
OS Version                     : fedora28
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}
$ cobbler system add --name=test --profile=fedora28-x86_64
$ cobbler system list
test
$ cobbler system report --name=test
Name                           : test
TFTP Boot Files                : {}
Comment                        :
Enable gPXE?                   : 0
Fetchable Files                : {}
Gateway                        :
Hostname                       :
Image                          :
IPv6 Autoconfiguration         : False
IPv6 Default Device            :
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : <<inherit>>
Kickstart Metadata             : {}
LDAP Enabled                   : False
LDAP Management Type           : authconfig
Management Classes             : []
Management Parameters          : <<inherit>>
Monit Enabled                  : False
Name Servers                   : []
Name Servers Search Path       : []
Netboot Enabled                : True
Owners                         : ['admin']
Power Management Address       :
Power Management ID            :
Power Management Password      :
Power Management Type          : ipmitool
Power Management Username      :
Profile                        : fedora28-x86_64
Proxy                          : <<inherit>>
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos Enabled                  : False
Server Override                : <<inherit>>
Status                         : production
Template Files                 : {}
Virt Auto Boot                 : <<inherit>>
Virt CPUs                      : <<inherit>>
Virt Disk Driver Type          : <<inherit>>
Virt File Size(GB)             : <<inherit>>
Virt Path                      : <<inherit>>
Virt RAM (MB)                  : <<inherit>>
Virt Type                      : <<inherit>>
$ cobbler system edit --name=test --interface=eth0 --mac=00:11:22:AA:BB:CC --ip-address=192.168.1.100 --netmask=255.255.255.0 --static=1 --dns-name=test.mydomain.com
$ cobbler system edit --name=test --gateway=192.168.1.1 --hostname=test.mydomain.com

kickstart编写

$ cobbler profile report --name=cntos7-x86_64
/var/lib/cobbler/kickstarts/sample_end.ks
part biosboot --fstype=biosboot --size=1
part /boot --size=500
part swap --size=16384
part / --size=20480(需要方法将剩余磁盘全数分给根盘)
%packages
tree
net-tools
%end
$ cobbler system edit --name=foo --interface=eth0 --mac=AA:BB:CC:DD:EE:F0 --interface-type=bond_slave --interface-master=bond0
$ cobbler system edit --name=foo --interface=eth1 --mac=AA:BB:CC:DD:EE:F1 --interface-type=bond_slave --interface-master=bond0
$ cobbler system edit --name=foo --interface=bond0 --interface-type=bond --bonding-opts="miimon=100 mode=1" --ip-address=192.168.1.100 --netmask=255.255.255.0
http://cobbler.github.io/manuals/2.8.0/4/1/1_-_Bonding.html
http://cobbler.github.io/manuals/2.8.0/3/5_-_Kickstart_Templating.html
上一篇 下一篇

猜你喜欢

热点阅读