Cobbler实现自动化安装(下)(2)

[root@cobbler ~]# mount /dev/cdrom /mnt  #挂载centos7.2光驱
[root@cobbler ~]# cobbler import --name=centos-7.2-x86_6 --path=/mnt  #创建cobbler对象组,此过程较耗时
[root@cobbler ~]# cobbler distro list  #查看对应的distribution
    centos-7.2-x86_64

镜像会被自动导入到/var/www/cobbler/ks_mirror,后续通过http的方式获取安装源;

默认情况下,cobbler还会生成一个最小化安装的kickstart文件,默认是/var/lib/cobbler/kickstarts/sample_end.ks。如果我们想要自定义的kickstart文件,可进行如下操作:

[root@cobbler ~]# cp centos7.2.cfg /var/lib/cobbler/kickstarts/  #centos7.2.cfg为自定义的kickstart文件
[root@cobbler ~]# cobbler profile add --name=centos-7.2-x86_64-custom --distro=centos-7.2-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.2.cfg  #--distro要对应上一步创建的distro对象
[root@cobbler ~]# cobbler profile list
    centos-7.2-x86_64
    centos-7.2-x86_64-custom

检查httpd和tftp服务相关目录是否已经创建了相应的文件:

[root@cobbler ~]# ll /var/www/cobbler
total 0
drwxr-xr-x. 4 root root 54 Oct 17 16:06 images
drwxr-xr-x. 5 root root 67 Oct 17 16:04 ks_mirror
drwxr-xr-x. 2 root root 54 Oct 17 16:06 links
drwxr-xr-x. 2 root root  6 May 28 20:41 localmirror
drwxr-xr-x. 2 root root 37 Oct 17 10:29 misc
drwxr-xr-x. 2 root root  6 May 28 20:41 pub
drwxr-xr-x. 2 root root  6 May 28 20:41 rendered
drwxr-xr-x. 2 root root  6 May 28 20:41 repo_mirror
drwxr-xr-x. 2 root root 62 Oct 17 10:29 svc
[root@cobbler ~]# ll /var/lib/tftpboot/
total 300
drwxr-xr-x  3 root root    17 Oct 17 15:00 boot
drwxr-xr-x. 2 root root      6 May 28 20:41 etc
drwxr-xr-x. 2 root root    77 Oct 17 15:00 grub
drwxr-xr-x. 4 root root    54 Oct 17 16:06 images
drwxr-xr-x. 2 root root      6 May 28 20:41 images2
-rw-r--r--. 1 root root  26268 Mar  6  2015 memdisk
-rw-r--r--  2 root root  54964 May 10 16:49 menu.c32
drwxr-xr-x. 2 root root      6 May 28 20:41 ppc
-rw-r--r--  2 root root  16794 May 10 16:49 pxelinux.0
drwxr-xr-x. 2 root root    20 Oct 17 15:00 pxelinux.cfg
drwxr-xr-x. 2 root root    25 Oct 17 15:00 s390x
-rw-r--r--  2 root root 198236 May 10 16:49 yaboot

测试安装:(只测试了cobbler自建的kickstart,成功)

2、创建centos6.5的cobbler对象

[root@cobbler ~]# mount /dev/cdrom /mnt  #挂载centos7.2光驱
[root@cobbler ~]# cobbler import --name=centos-6.7-x86_64 --path=/mnt  #创建cobbler对象组
[root@cobbler ~]# cobbler distro list  #查看对应的distribution
    centos-6.7-x86_64
    centos-7.2-x86_64
[root@cobbler ~]# cobbler profile list
    centos-6.7-x86_64
    centos-7.2-x86_64
    centos-7.2-x86_64-custom

测试安装6.5:成功

Cobbler实现自动化安装(下)

Cobbler实现自动化安装(下)

4)cobbler的web管理界面

[root@cobbler ~]# yum -y install cobbler-web
[root@cobbler ~]# vim /etc/cobbler/modules.conf
    ...
    [authentication]
    module = authn_pam  #使用authn_pam,本地用户认证模块
    ...
[root@cobbler ~]# useradd cbadmin
[root@cobbler ~]# echo 123456|passwd --stdin cbadmin
    ...
[root@cobbler ~]# vim /etc/cobbler/users.conf
    ...
    [admins]
    admin = "cbadmin"
[root@cobbler ~]# systemctl restart cobblerd

客户端测试:(注意是https)

Cobbler实现自动化安装(下)

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/12415.html