多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 批量安装系统-cobbler [TOC] ## 1 环境准备 ### 1.1 简介 cobbler可以理解为是kickstart的升级版,将其封装并了个web界面,可以附带管理DHCP,DNS等,提供了API接口可供二次开发. 官网:https://cobbler.github.io ### 1.2 系统信息 ``` cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) uname -r 3.10.0-693.el7.x86_64 hostname -I 10.0.0.201 172.16.1.201 ``` ### 1.3 防火墙、selinux ``` sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config setenforce 0 systemctl stop firewalld.service systemctl disable firewalld.service ``` ## 2 安装cobbler ### 2.1 安装阿里云源 ``` curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo ``` 已配置过第三方源可忽略此步骤 ### 2.2 安装和启动cobbler ``` yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd python-django systemctl start cobblerd.service systemctl start httpd.service ``` ### 2.3 配置cobbler 1) 校验命令 ``` cobbler check ``` 检查后会提示需要修改的地方,根据提示进行修改 2) 根据提示修改 ``` sed -i '/^server/ s#127.0.0.1#172.16.1.201#g' /etc/cobbler/settings sed -i '/^next_server/ s#127.0.0.1#172.16.1.201#g' /etc/cobbler/settings sed -ri 's#(.*disable.*= )yes#\1no#g' /etc/xinetd.d/tftp cobbler get-loaders ``` 3) 让cobbler管理dhcp ``` sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings sed -i.ori 's#192.168.1#172.16.1#g;22d;23d' /etc/cobbler/dhcp.template ``` 4) 防止误重装 ``` sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings ``` 5) 启动关联服务 ``` systemctl start rsyncd.service systemctl enable rsyncd.service systemctl start tftp.socket systemctl enable tftp.socket ``` 6) 提交修改 ``` cobbler sync ``` 仍然有个别提示,其中包括更改密码的要求,生成环境的话根据要求修改密码 7) 重启所有服务 ``` systemctl restart cobblerd.service httpd.service rsyncd.service tftp.socket systemctl is-active cobblerd.service httpd.service rsyncd.service tftp.socket ``` ## 3 web端操作 ### 3.1 基础配置 1) 基础信息 网址:https://10.0.0.201/cobbler_web 账号密码:cobbler cobbler 挂载光盘:mount /dev/cdrom /mnt ### 3.2 导入光盘 点击actions-->import菜单导入光盘 ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200410/232217685.png) ### 3.3 创建配置文件 ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200410/232225711.png) ### 3.4 匹配配置文件 ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200410/232234931.png) 至此,新建虚拟机,开机后通过通过网络已经可以获得选择菜单,选择版本后即可自动安装,如果还要做的开机后直接安装,不选择版本且按要求配置网络参数的话,还需要接下来这一步 ### 3.5 配置全自动安装[非必须] ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200410/232243181.png) ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200410/232252630.png) ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200410/232300123.png) ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200410/232306903.png) ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200410/232314286.png)