Centos7.4下安装cobbler详解

官方源下:
yum install epel-release -y //安装epel源



-------------------正式部署--------------------------------------------
安装相关服务:
yum install cobbler cobbler-web dhcp tftp-server pykickstart httpd rsync xinetd -y

修改配置:
vi /etc/cobbler/settings       //修改主配置文件

next_server: 192.168.235.129   //指定PXE位置

server: 192.168.235.129        //声明服务器地址

manage_dhcp: 1                 //管理dhcp启动

-----

systemctl start httpd.service
systemctl start cobblerd.service

systemctl stop firewalld.service      //关闭防火墙
setenforce 0                          //关闭增强安全功能

-----
cobbler check    首次检查:
--------------------提示内容:需要优化------------------------------------------------------------------
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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
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
8 : 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.

-----------------------------------------------------------------------------------------------------------------

将必要的给予优化:
第一步:修改/etc/cobbler/settings文件
server:192.168.80.18
next_server:192.168.80.18
manage_dhcp:1

第二步:
cobbler get-loaders                //下载引导操作系统文件

第三步:
vi /etc/xinetd.d/tftp

disable   = no     //启用

第四步:
openssl passwd -1 -salt 'abc123' 'abc123'    //盐值加密
$1$abner$kDle2KnwbPHdm1UZEE79V.        //加密结果

继续回settings文件中

default_password_crypted: "$1$abner$kDle2KnwbPHdm1UZEE79V."    //粘贴

保存退出settings文件

-----

systemctl start rsyncd.service      

systemctl start xinetd.service     

systemctl restart cobblerd.service

-----

vi /etc/cobbler/dhcp.template       //cobbler控制的dhcp服务模板

subnet 192.168.80.0 netmask 255.255.255.0 {
     option routers             192.168.80.1;     //修改网关
     option domain-name-servers 192.168.80.2;     //修改DNS
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.235.100 192.168.235.200;   //修改地址池

cobbler sync       //帮助同步生成DHCP配置文件

systemctl restart dhcpd.service    //启动dhcpd服务
使用cobbler check 再次检查:
再次检查---------------------------------------------------------------------------------------------------
下面三条可以忽略不去处理
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
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
3 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

-----

/var/log/cobbler/cobbler.log   //日志文件所在位置

cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64  //导入iso镜像

/var/www/cobbler/ks_mirror/CentOS-7-x86_64        //默认导入存放位置

cobbler list     //查看导入结果

cobbler distro list   //查看发行版本

-----

cobbler profile report         //查看所有镜像文件参数信息
编辑profile文件,修改参数:
 ** cobbler profile edit --CentOS-7-x86_64 --跟上需要改的参数名称=内容  **               

 /var/lib/cobbler/kickstarts/sample_end.ks    //ks默认文件存放位置

vi /etc/cobbler/pxe/pxedefault.template    //修改装机界面提示

-----
重启所有服务:

systemctl restart cobblerd.service
systemctl restart httpd.service
systemctl restart dhcpd.service
systemctl restart xinetd.service
systemctl restart rsyncd.service

-----

可新建一个空虚拟机,网卡与服务器绑同一块,直接开机安装
注意:内存2G,硬盘40G  否则会报错!

客户端安装完成后只具备字符界面  登录账户  root   密码abc123

个性化定制安装:
cobbler system add --help查看可加选项
--name=centos7-1
--mac=(查看新机网卡mac地址)
--profile=CentOS-7-x86_64
--ip-address=192.168.80.10
--subnet=255.255.255.0
--gateway=192.168.80.1
--interface=ens33
--static=1
--hostname=www.aa.com
--name-servers=2.2.2.2 3.3.3.3

猜你喜欢

转载自blog.51cto.com/13490688/2135515