码迷,mamicode.com
首页 > 其他好文 > 详细

在CentOS7中 部署cobbler自动装机

时间:2018-05-17 00:59:57      阅读:692      评论:0      收藏:0      [点我收藏+]

标签:cobbler自动装机centos7   cobbler web登录   在CentOS7中 部署cobbler   

Cobbler是一个Linux安装服务器,它允许快速安装网络安装环境。它聚合并自动化了许多相关的Linux任务,因此在部署新系统时,不必在许多不同的命令和应用程序之间跳跃,在某些情况下,还需要更改现有的系统。Cobbler可以帮助配置、管理DNS和DHCP、包更新、电源管理、配置管理业务流程等等。

 实验需要的安装包:
    cobbler(linux安装服务器)     
    cobbler-web(前端界面管理  可以通过网页形式进行管理)   dhcp(自动分配IP)  
    tftp-server (文件传输协议    用于放压缩内核和引导文件)
    pykickstart(用于阅读和编写kickstart文件)  
     rsync(数据镜像备份工具,远程同步管理和支持本地复制)  
    xinetd(网络守护进程服务程序   用于管理rsync 和 tftp)
    httpd  (这里用于检查cobbler文件安装 和web管理)

.

实验的系统环境
 虚拟机:centos7系统  (网卡选用NET模式   选定dhcp     可以实现访问网络)
 # vim /etc/sysconfig/network-scripts/ifcfg-ens33  //编辑网卡
        ONBOOT=yes   (修改成yes)
    # systemctl restart network.service  //重启网络服务

    # mount.cifs //192.168.198.128/gx /opt/   //挂载共享文件到/opt
    # rpm -ivh /opt/epel-release-latest-7.noarch.rpm  //安装epel-release-latest-7.noarch.rpm
    # mount /dev/sr0 /mnt  //挂载cdrom
    # yum list   //加载yum  (直接下载安装包)

.

1:安装  配置cobber
# yum install cobbler cobbler-web dhcp tftp-server pykickstart httpd rsync xinetd -y
//安装cobbler cobbler-web dhcp tftp-server pykickstart httpd rsync xinetd
#vim /etc/cobbler/settings  //编辑cobbler主配置文件
    next_server: 192.168.235.129          //指定PXE位置
    server: 192.168.235.129
    manage_dhcp: 1                 //管理dhcp启动

技术分享图片

2:重启服务关闭防火墙
    # systemctl restart httpd.service        //重启httpd服务
    # systemctl start cobblerd.service     //开启cobbler服务
    # systemctl stop firewalld.service      //关闭防火墙
    # setenforce 0                          //关闭增强安全功能
    # cobbler check    //cobble 检测
------------------------提示内容:需要优化-------------------------- 
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.

.

    3:设置装机后的根密码
     # openssl passwd -1 -salt ‘123456‘ ‘123456‘    //给密码123456 盐值加密
     $1$123456$wOSEtcyiP2N/IfIl15W6Z0   (复制生成的密码的加密代码)
     # vim /etc/cobbler/settings       //修改配置文件
     default_password_crypted: " $1$123456$wOSEtcyiP2N/IfIl15W6Z0 ."    //粘贴上面复制代码

技术分享图片

     4:下载引导操作系统文件、 启动rsncd服务 、编辑tftp 
         # cobbler get-loaders                //下载引导操作系统文件
         # systemctl start rsyncd.service      //启动服务
         #  vim /etc/xinetd.d/tftp          //编辑tftp
                 disable   = no     //启用
         # systemctl restart xinetd.service      //重启服务

技术分享图片

         5:配置dhcp
         # vim /etc/cobbler/dhcp.template       //cobbler控制的dhcp服务模板
                 subnet 192.168.198.0 netmask 255.255.255.0 {
                 option routers             192.168.198.1;     //修改网关
                 option domain-name-servers 192.168.198.2;     //修改DNS
                 option subnet-mask         255.255.255.0;
                 range dynamic-bootp        192.168.198.100 192.168.198.200;   //修改地址池
            # cobbler sync       //帮助同步生成DHCP配置文件
            # systemctl restart dhcpd.service    //启动dhcpd服务

技术分享图片

        6:使用cobbler check再次检查
         # cobbler check //cobble 检测
         下面三条可以忽略不去处理

技术分享图片

            7:导入镜像
            # cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64  //导入iso镜像
            # cobbler list     //查看导入结果
            # cobbler distro list   //查看发行版本
            # yum install tree -y //安装tree
            # tree /var/lib/tftpboot/images   //查看内核和初始化文件在tftp server 共享目录

            8:服务全重启一遍
                    # systemctl restart cobblerd.service
                    # systemctl restart dhcpd.service
                    # systemctl restart xinetd.service
                    # systemctl restart httpd.service
                    # cobbler profile report         //查看cobbler概要报告      

.

            9:新建虚拟机测试安装
            选择稍后安装
            虚拟机为centos 64位       
            网络选择和服务器一样的NAT网卡 
            内存2G   硬盘40G
            然后开启虚拟机 进入安装

技术分享图片
技术分享图片技术分享图片技术分享图片技术分享图片技术分享图片

        10:选择Centos-7-x86_64  进入自动安装    
         安装完成

技术分享图片
技术分享图片

        11:进入web管理cobbler
        # htdigest -c /etc/cobbler/users.digest Cobbler cbadmin
        //创建Cobbler类型的用户cbadmin  写到users.digest文件中
        输入两次确认密码 例如:123456

        # systemctl restart cobblerd.service   //重启cobbler  服务
        # systemctl restart httpd.service        //重启 httpd 服务

        在宿主机浏览器打开 https://192.168.198.128/cobbler_web
        输入 账户为 cbadmin  密码为 123456

技术分享图片
技术分享图片

     12:通过pam认证 进入web管理cobbler
         # vim /etc/cobbler/modules.conf 
            [authentication]
            module = authn_pam    //修改pam认证
            [authorization]
            module = authz_ownership    //在users.conf指定访问权限

技术分享图片

useradd webuser //创建用户webuser

            # passwd webuser   //设置密码123456

            # vim /etc/cobbler/users.conf //编辑user.conf
            [admins]
            admin = ""
            cobbler = ""
            webuser = ""     //添加该行

技术分享图片

systemctl restart cobblerd.service //重启cobbler 服务

            # systemctl restart httpd.service        //重启 httpd 服务

         在宿主机浏览器打开 https://192.168.198.128/cobbler_web
        输入 账户为 webuser  密码为 123456

技术分享图片
技术分享图片

在CentOS7中 部署cobbler自动装机

标签:cobbler自动装机centos7   cobbler web登录   在CentOS7中 部署cobbler   

原文地址:http://blog.51cto.com/13630803/2117236

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!