yum install -y epel-release yum install -y httpd dhcp tftp cobbler cobbler-web pykickstart xinetd #httpd dhcp tftp cobbler 程序及其依赖服务 #cobbler-web web管理 #pykickstart KS文件检查 #xinetd 守护进程 systemctl start cobblerd && systemctl enable cobblerd systemctl start httpd && systemctl enable httpd systemctl start xinetd && systemctl enable xinetd
/etc/cobbler # 配置文件目录 /etc/cobbler/settings # cobbler主配置文件 /etc/cobbler/dhcp.template # DHCP服务的配置模板 /etc/cobbler/tftpd.template # tftp服务的配置模板 /etc/cobbler/rsync.template # rsync服务的配置模板 /etc/cobbler/iso # iso模板配置文件目录 /etc/cobbler/pxe # pxe模板文件目录 /etc/cobbler/power # 电源的配置文件目录 /etc/cobbler/users.conf # Web服务受权配置文件 /etc/cobbler/users.digest # web访问的用户名密码配置文件 /etc/cobbler/dnsmasq.template # DNS服务的配置模板 /etc/cobbler/modules.conf # Cobbler模块配置文件 /var/lib/cobbler # Cobbler数据目录 /var/lib/cobbler/config # 配置文件 /var/lib/cobbler/kickstarts # 默认存放kickstart文件 /var/lib/cobbler/loaders # 存放的各类引导程序 /var/www/cobbler # 系统安装镜像目录 /var/www/cobbler/ks_mirror # 导入的系统镜像列表 /var/www/cobbler/images # 导入的系统镜像启动文件 /var/www/cobbler/repo_mirror # yum源存储目录 /var/log/cobbler # 日志目录 /var/log/cobbler/install.log # 客户端系统安装日志 /var/log/cobbler/cobbler.log # cobbler日志
/etc/cobbler/settings中几个比较重要的参数设置(根据需求设置)node
manage_dhcp:1 manage_dns:1 manage_tftpd:1 restart_dhcp:1 restart_dns:1 pxe_just_once:1 #防止安装循环配置始终从网络引导,激活此选项时机器告诉 Cobbler 安装已完成。Cobbler 将系统对象的 netboot 标志更改成 false,这会强制机器从本地磁盘引导 next_server:<服务器的 IP 地址> #用在 DHCP 配置文件中,向机器告知提供引导文件的服务器地址 server:<服务器的 IP 地址> #用于引用 Cobbler 服务器地址
systemctl restart cobblerd 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 : change 'disable' to 'no' in /etc/xinetd.d/tftp 4 : 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. 5 : enable and start rsyncd.service with systemctl 6 : debmirror package is not installed, it will be required to manage debian deployments and repositories 7 : 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
cobbler get-loaders #下载有点慢
vim /etc/xinetd.d/tftp disable = no systemctl restart xinetd
systemctl start rsyncd && systemctl enable rsyncd
openssl passwd -1 -salt 'root' 'root' #密码明文为root $1$root$9gr5KxwuEdiI80GtIzd.U0 vim /etc/cobbler/settings 101 default_password_crypted: "$1$root$9gr5KxwuEdiI80GtIzd.U0"
vim /etc/cobbler/dhcp.template #重启cobbler后,cobbler会生成一个模板文件 subnet 192.168.100.0 netmask 255.255.255.0 { option routers 192.168.100.1; option domain-name-servers 192.168.100.1; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.100.50 192.168.100.100; default-lease-time 21600; max-lease-time 43200; next-server $next_server;
[root@linux-node1 ~]# systemctl restart cobblerd [root@linux-node1 ~]# cobbler sync
mount /dev/cdrom /mnt #在光驱中加载一个完成的centos7 ISO文件 mount: /dev/sr0 is write-protected, mounting read-only cobbler import --path=/mnt/ --name=/CentOS-7-x86_64 --arch=x86_64 #使用import导入 cobbler profile list #查看镜像目录 CentOS-7-x86_64 cobbler profile report #查看cobbler系统仓库中的版本信息 Name : CentOS-7-x86_64 TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS-7-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 #这里显示此系统版本使用的是系统自带的kickstart文件
kickstart文件的制做很是简单。linux
首先安装system-config-kickstart。ios
yum install system-config-kickstart system-config-kickstart #要有桌面环境
修改默认ks文件执行system-config-kickstart启用图形界面进行配置(使用xmanager之类的链接程序)web
cd /var/lib/cobbler/kickstarts/ 上传自定义ks文件 CentOS-7-x86_64.cfg cobbler profile edit --name=CentOS-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7-x86_64.cfg #上传完成后修改为咱们本身的ks文件 cobbler profile edit --name=CentOS-7-x86_64 --kopts='net.ifnames=0 biosdevname=0' #这里咱们顺便修改一下内核文件参数,让centos7初始化网卡名为“eth” cobbler sync #更改配置后都要执行
https://192.168.100.132/cobbler_webvim
帐号密码 cobbler cobblercentos