cobbler------安装配置

简介:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
一:配置好repo仓库,IP地址,
[root@linux-node1 yum.repos.d] # ll
total 28
-rw-r--r--. 1 root root 1664 Dec  9  2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Dec  9  2015 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Dec  9  2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  290 Dec  9  2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Dec  9  2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Dec  9  2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 Dec  9  2015 CentOS-Vault.repo
#使用阿里云的epel源
[root@linux-node1 yum.repos.d] # wget https://mirrors.aliyun.com/repo/epel-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 115.28.122.210, 112.124.140.210
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|115.28.122.210|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1084 (1.1K) [application /octet-stream ]
Saving to: ‘epel-7.repo’
100%[========================================================================================================================================================================>] 1,084       --.-K /s    in  0s      
2017-02-21 09:28:26 (82.2 MB /s ) - ‘epel-7.repo’ saved [1084 /1084 ]
[root@linux-node1 yum.repos.d] # ls
CentOS-Base.repo  CentOS-CR.repo  CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo  CentOS-Sources.repo  CentOS-Vault.repo  epel-7.repo
[root@linux-node1 yum.repos.d] # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
     link /loopback  00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet 127.0.0.1 /8  scope host lo
        valid_lft forever preferred_lft forever
     inet6 ::1 /128  scope host 
        valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
     link /ether  00:0c:29:e6:8c:cc brd ff:ff:ff:ff:ff:ff
     inet 192.168.56.11 /24  brd 192.168.56.255 scope global eth0
        valid_lft forever preferred_lft forever
     inet6 fe80::20c:29ff:fee6:8ccc /64  scope link 
        valid_lft forever preferred_lft forever

二:yum安装cobbler

1
[root@linux-node1 yum.repos.d] # yum install httpd dhcp tftp xinetd bind bind-chroot caching-nameserver cobbler cobbler-web python-ctypes

三:关闭防火墙

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@linux-node1 yum.repos.d] # systemctl stop firewalld
[root@linux-node1 yum.repos.d] # chkconfig firewalld off
Note: Forwarding request to  'systemctl disable firewalld.service' .
Removed  symlink  /etc/systemd/system/dbus-org .fedoraproject.FirewallD1.service.
Removed  symlink  /etc/systemd/system/basic .target.wants /firewalld .service.
[root@linux-node1 yum.repos.d] # getenforce 
Enforcing
[root@linux-node1 yum.repos.d] # setenforce 0 #临时生效
[root@linux-node1 yum.repos.d] # getenforce 
Permissive
[root@linux-node1 yum.repos.d] # sestatus
SELinux status:                 enabled
SELinuxfs  mount :                 /sys/fs/selinux
SELinux root directory:          /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config  file :          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28
#编辑配置文件,把SELINUX修改成disabled,永久生效,需要重启OS
[root@linux-node1 yum.repos.d] # vim /etc/sysconfig/selinux

四:启动服务并检查

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@linux-node1 yum.repos.d] # systemctl start httpd
[root@linux-node1 yum.repos.d] # systemctl start cobblerd
[root@linux-node1 yum.repos.d] # systemctl start xinetd
[root@linux-node1 yum.repos.d] # netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID /Program  name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1687 /sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2182 /master         
tcp        0      0 127.0.0.1:25151         0.0.0.0:*               LISTEN      3985 /python2        
tcp6       0      0 :::80                   :::*                    LISTEN      3956 /httpd          
tcp6       0      0 :::22                   :::*                    LISTEN      1687 /sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      2182 /master         
tcp6       0      0 :::443                  :::*                    LISTEN      3956 /httpd

五:配置cobbler,

执行cobbler check命令后,会出现提示,告知需要修改的地方,按照说明修改即可:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@linux-node1 yum.repos.d] # 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 : 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 : 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.
6 :  enable  and start rsyncd.service with systemctl
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : ksvalidator was not found,  install  pykickstart
9 : 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
10 : 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.

    5.1 下面开始对上面的步骤提示进行修改,

1、对/etc/cobbler/setting中,修改server行,改成

1
server: 192.168.56.11

2、修改‘next_server’

1
next_server: 192.168.56.11

3、关闭selinux,需要重启系统

4、修改tftp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@linux-node1 yum.repos.d] # vim /etc/xinetd.d/tftp 
 
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
         socket_type             = dgram
         protocol                = udp
         wait                    =  yes
         user                    = root
         server                  =  /usr/sbin/in .tftpd
         server_args             = -s  /var/lib/tftpboot
         disable                 = no
         per_source              = 11
         cps                     = 100 2
         flags                   = IPv4
}

5、执行命令cobbler get-loaders,他会自动下载相关的启动引导文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@linux-node1 yum.repos.d] # cobbler get-loaders
task started: 2017-02-21_101556_get_loaders
task started ( id =Download Bootloader Content,  time =Tue Feb 21 10:15:56 2017)
downloading https: //cobbler .github.io /loaders/README  to  /var/lib/cobbler/loaders/README
downloading https: //cobbler .github.io /loaders/COPYING .elilo to  /var/lib/cobbler/loaders/COPYING .elilo
downloading https: //cobbler .github.io /loaders/COPYING .yaboot to  /var/lib/cobbler/loaders/COPYING .yaboot
downloading https: //cobbler .github.io /loaders/COPYING .syslinux to  /var/lib/cobbler/loaders/COPYING .syslinux
downloading https: //cobbler .github.io /loaders/elilo-3 .8-ia64.efi to  /var/lib/cobbler/loaders/elilo-ia64 .efi
downloading https: //cobbler .github.io /loaders/yaboot-1 .3.17 to  /var/lib/cobbler/loaders/yaboot
downloading https: //cobbler .github.io /loaders/pxelinux .0-3.86 to  /var/lib/cobbler/loaders/pxelinux .0
downloading https: //cobbler .github.io /loaders/menu .c32-3.86 to  /var/lib/cobbler/loaders/menu .c32
downloading https: //cobbler .github.io /loaders/grub-0 .97-x86.efi to  /var/lib/cobbler/loaders/grub-x86 .efi
downloading https: //cobbler .github.io /loaders/grub-0 .97-x86_64.efi to  /var/lib/cobbler/loaders/grub-x86_64 .efi
*** TASK COMPLETE ***

6、启动服务rsyncd.service

1
systemctl start rsyncd

7、安装pykickstart

1
yum  install  pykickstart -y

8、生成新的密码,默认的过于简单,命令:openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'

1
2
[root@linux-node1 yum.repos.d] # openssl passwd -1 -salt '123' '123456'
$1$123$7mft0jKnzzvAdU4t0unTG1

把这个新生成的密钥,写入setting配置文件中的对应位置上

1
default_password_crypted:  "$1$123$7mft0jKnzzvAdU4t0unTG1"

9、安装fence-agents

1
yum  install  fence-agents

10、可以不用管它

当然也可以安装这个服务,安装完毕后,需要修改配置文件

1
2
3
4
5
wget 
yum localinstall debmirror-20090807-1.el5.noarch.rpm 
vim  /etc/debmirror .conf  #将23和25行注释掉
23  #@dists=”sid”;
25  #@arches=”i386″;

上面所有的步骤操作完毕后,重启cobbler,然后执行“cobbler sync”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
[root@linux-node1 ~] # systemctl restart cobblerd
[root@linux-node1 ~]
[root@linux-node1 ~]
[root@linux-node1 ~] # cobbler sync
task started: 2017-02-21_104452_sync
task started ( id =Sync,  time =Tue Feb 21 10:44:52 2017)
running pre- sync  triggers
cleaning trees
removing:  /var/lib/tftpboot/pxelinux .cfg /default
removing:  /var/lib/tftpboot/grub/images
removing:  /var/lib/tftpboot/grub/grub-x86 .efi
removing:  /var/lib/tftpboot/grub/grub-x86_64 .efi
removing:  /var/lib/tftpboot/grub/efidefault
removing:  /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink  /var/lib/cobbler/loaders/pxelinux .0 ->  /var/lib/tftpboot/pxelinux .0
copying:  /var/lib/cobbler/loaders/pxelinux .0 ->  /var/lib/tftpboot/pxelinux .0
trying hardlink  /var/lib/cobbler/loaders/menu .c32 ->  /var/lib/tftpboot/menu .c32
copying:  /var/lib/cobbler/loaders/menu .c32 ->  /var/lib/tftpboot/menu .c32
trying hardlink  /var/lib/cobbler/loaders/yaboot  ->  /var/lib/tftpboot/yaboot
copying:  /var/lib/cobbler/loaders/yaboot  ->  /var/lib/tftpboot/yaboot
trying hardlink  /usr/share/syslinux/memdisk  ->  /var/lib/tftpboot/memdisk
copying:  /usr/share/syslinux/memdisk  ->  /var/lib/tftpboot/memdisk
trying hardlink  /var/lib/cobbler/loaders/grub-x86 .efi ->  /var/lib/tftpboot/grub/grub-x86 .efi
trying hardlink  /var/lib/cobbler/loaders/grub-x86_64 .efi ->  /var/lib/tftpboot/grub/grub-x86_64 .efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering TFTPD files
generating  /etc/xinetd .d /tftp
cleaning link caches
running post- sync  triggers
running python triggers from  /var/lib/cobbler/triggers/sync/post/ *
running python trigger cobbler.modules.sync_post_restart_services
running shell triggers from  /var/lib/cobbler/triggers/sync/post/ *
running python triggers from  /var/lib/cobbler/triggers/change/ *
running python trigger cobbler.modules.scm_track
running shell triggers from  /var/lib/cobbler/triggers/change/ *
*** TASK COMPLETE ***
[root@linux-node1 ~] # cobbler check
The following are potential configuration items that you may want to fix:
 
1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
 
Restart cobblerd and  then  run  'cobbler sync'  to apply changes.

六:DHCP配置

我们可以配置cobbler,使用cobber来管理dhcp服务,修改一下配置文件:

1
2
3
4
[root@linux-node1 ~] # vim /etc/cobbler/settings 
# set to 1 to enable Cobbler's DHCP management features.
# the choice of DHCP management engine is in /etc/cobbler/modules.conf
manage_dhcp: 1  #这里从0改成1,启动dhcp管理服务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[root@linux-node1 cobbler] # ls
auth.conf       cobbler_bash  dhcp.template     import_rsync_whitelist  ldap          mongodb.conf    power  reporting       rsync .template      settings         users .conf    version        zone_templates
cheetah_macros  completions   dnsmasq.template  iso                     modules.conf  named.template  pxe     rsync .exclude  secondary.template  tftpd.template   users .digest  zone.template
[root@linux-node1 cobbler] # vim dhcp.template 
# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set  vendorclass = option vendor-class-identifier;
option pxe-system- type  code 93 = unsigned integer 16;
subnet 192.168.56.0 netmask 255.255.255.0 {
      option routers             192.168.56.2; #路由地址
      option domain-name-servers 192.168.56.2; #dns地址
      option subnet-mask         255.255.255.0;
      range dynamic-bootp        192.168.56.100 192.168.56.254;
      default-lease- time          21600; #默认租期时间
      max-lease- time              43200; #最大租期时间
      next-server                $next_server; #tftp地址
      class  "pxeclients"  {
           match  if  substring (option vendor-class-identifier, 0, 9) =  "PXEClient" ;
           if  option pxe-system- type  = 00:02 {
                   filename  "ia64/elilo.efi" ;
           else  if  option pxe-system- type  = 00:06 {
                   filename  "grub/grub-x86.efi" ;
           else  if  option pxe-system- type  = 00:07 {
                   filename  "grub/grub-x86_64.efi" ;
           else  {
                   filename  "pxelinux.0" ;
           }
      }
}

执行cobbler sync 自动生成dhcp配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[root@linux-node1 cobbler] # systemctl restart cobblerd
[root@linux-node1 cobbler] # cobbler sync
task started: 2017-02-21_105948_sync
task started ( id =Sync,  time =Tue Feb 21 10:59:48 2017)
running pre- sync  triggers
cleaning trees
removing:  /var/lib/tftpboot/pxelinux .cfg /default
removing:  /var/lib/tftpboot/grub/images
removing:  /var/lib/tftpboot/grub/grub-x86 .efi
removing:  /var/lib/tftpboot/grub/grub-x86_64 .efi
removing:  /var/lib/tftpboot/grub/efidefault
removing:  /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink  /var/lib/cobbler/loaders/pxelinux .0 ->  /var/lib/tftpboot/pxelinux .0
copying:  /var/lib/cobbler/loaders/pxelinux .0 ->  /var/lib/tftpboot/pxelinux .0
trying hardlink  /var/lib/cobbler/loaders/menu .c32 ->  /var/lib/tftpboot/menu .c32
copying:  /var/lib/cobbler/loaders/menu .c32 ->  /var/lib/tftpboot/menu .c32
trying hardlink  /var/lib/cobbler/loaders/yaboot  ->  /var/lib/tftpboot/yaboot
copying:  /var/lib/cobbler/loaders/yaboot  ->  /var/lib/tftpboot/yaboot
trying hardlink  /usr/share/syslinux/memdisk  ->  /var/lib/tftpboot/memdisk
copying:  /usr/share/syslinux/memdisk  ->  /var/lib/tftpboot/memdisk
trying hardlink  /var/lib/cobbler/loaders/grub-x86 .efi ->  /var/lib/tftpboot/grub/grub-x86 .efi
trying hardlink  /var/lib/cobbler/loaders/grub-x86_64 .efi ->  /var/lib/tftpboot/grub/grub-x86_64 .efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating  /etc/dhcp/dhcpd .conf
rendering TFTPD files
generating  /etc/xinetd .d /tftp
cleaning link caches
running post- sync  triggers
running python triggers from  /var/lib/cobbler/triggers/sync/post/ *
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout: 
received on stderr: 
running: service dhcpd restart  #这里会自动重启dhcp服务
received on stdout: 
received on stderr: Redirecting to  /bin/systemctl  restart  dhcpd.service
 
running shell triggers from  /var/lib/cobbler/triggers/sync/post/ *
running python triggers from  /var/lib/cobbler/triggers/change/ *
running python trigger cobbler.modules.scm_track
running shell triggers from  /var/lib/cobbler/triggers/change/ *
*** TASK COMPLETE ***

验证::::

这里查看dhcpd.conf会自动生成相同的配置文件信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[root@linux-node1 cobbler] # cat /etc/dhcp/dhcpd.conf 
# ******************************************************************
# Cobbler managed dhcpd.conf file
# generated from cobbler dhcp.conf template (Tue Feb 21 15:59:49 2017)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
# ******************************************************************
 
ddns-update-style interim;
 
allow booting;
allow bootp;
 
ignore client-updates;
set  vendorclass = option vendor-class-identifier;
 
option pxe-system- type  code 93 = unsigned integer 16;
 
subnet 192.168.56.0 netmask 255.255.255.0 {
      option routers             192.168.56.2;
      option domain-name-servers 192.168.56.2;
      option subnet-mask         255.255.255.0;
      range dynamic-bootp        192.168.56.100 192.168.56.254;
      default-lease- time          21600;
      max-lease- time              43200;
      next-server                192.168.56.11;
      class  "pxeclients"  {
           match  if  substring (option vendor-class-identifier, 0, 9) =  "PXEClient" ;
           if  option pxe-system- type  = 00:02 {
                   filename  "ia64/elilo.efi" ;
           else  if  option pxe-system- type  = 00:06 {
                   filename  "grub/grub-x86.efi" ;
           else  if  option pxe-system- type  = 00:07 {
                   filename  "grub/grub-x86_64.efi" ;
           else  {
                   filename  "pxelinux.0" ;
           }
      }
 
}
 
# group for Cobbler DHCP tag: default
group {
}

七、导入操作系统

我们使用上传工具,上传一个系统到cobbler文件系统下面,这里使用的C7做为测试

7.1上传os到opt目录下面

1
2
3
[root@linux-node1 opt] # ll -sh
total 4.1G
4.1G -rw-r--r-- 1 root root 4.1G Feb 21 11:10 CentOS-7-x86_64-DVD-1511.iso

7.2 导入distro,即导入一个发行版,发行版指的是操作系统

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@linux-node1 opt] # df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root    46G  5.6G   41G  13% /
devtmpfs                 1.9G     0  1.9G   0%  /dev
tmpfs                    1.9G     0  1.9G   0%  /dev/shm
tmpfs                    1.9G  8.6M  1.9G   1%  /run
tmpfs                    1.9G     0  1.9G   0%  /sys/fs/cgroup
/dev/sda1                 497M  125M  373M  26%  /boot
tmpfs                    378M     0  378M   0%  /run/user/0
[root@linux-node1 opt] # mount -t iso9660 -o loop /opt/CentOS-7-x86_64-DVD-1511.iso /mnt 
mount /dev/loop0  is write-protected, mounting  read -only
[root@linux-node1 opt] # df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root    46G  5.6G   41G  13% /
devtmpfs                 1.9G     0  1.9G   0%  /dev
tmpfs                    1.9G     0  1.9G   0%  /dev/shm
tmpfs                    1.9G  8.6M  1.9G   1%  /run
tmpfs                    1.9G     0  1.9G   0%  /sys/fs/cgroup
/dev/sda1                 497M  125M  373M  26%  /boot
tmpfs                    378M     0  378M   0%  /run/user/0
/dev/loop0                4.1G  4.1G     0 100%  /mnt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[root@linux-node1 ~] # cobbler import --path=/mnt/ --name=c7.2-x86_64 --arch=x86_64
task started: 2017-02-21_134843_import
task started ( id =Media  import time =Tue Feb 21 13:48:43 2017)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path  /var/www/cobbler/ks_mirror/c7 .2-x86_64:
creating new distro: c7.2-x86_64
trying  symlink /var/www/cobbler/ks_mirror/c7 .2-x86_64 ->  /var/www/cobbler/links/c7 .2-x86_64
creating new profile: c7.2-x86_64
associating repos
checking  for  rsync  repo(s)
checking  for  rhn repo(s)
checking  for  yum repo(s)
starting descent into  /var/www/cobbler/ks_mirror/c7 .2-x86_64  for  c7.2-x86_64
processing repo at :  /var/www/cobbler/ks_mirror/c7 .2-x86_64
need to process repo /comps /var/www/cobbler/ks_mirror/c7 .2-x86_64
looking  for  /var/www/cobbler/ks_mirror/c7 .2-x86_64 /repodata/ *comps*.xml
error launching createrepo (not installed?), ignoring
Exception occured: < type  'exceptions.IOError' >
Exception value: [Errno 2] No such  file  or directory:  '/var/www/cobbler/ks_mirror/config/c7.2-x86_64.repo'
Exception Info:
   File  "/usr/lib/python2.7/site-packages/cobbler/modules/manage_import_signatures.py" , line 599,  in  yum_process_comps_file
     config_file =  open (fname,  "w+" )
 
*** TASK COMPLETE ***
[root@linux-node1 ~] # ll /var/www/cobbler/ks_mirror/c7.2-x86_64/
total 296
-r--r--r-- 1 root root     14 Dec  9  2015 CentOS_BuildTag
dr-xr-xr-x 3 root root     33 Dec  9  2015 EFI
-r--r--r-- 1 root root    215 Dec  9  2015 EULA
-r--r--r-- 1 root root  18009 Dec  9  2015 GPL
dr-xr-xr-x 3 root root     54 Dec  9  2015 images
dr-xr-xr-x 2 root root   4096 Dec  9  2015 isolinux
dr-xr-xr-x 2 root root     41 Dec  9  2015 LiveOS
dr-xr-xr-x 2 root root 204800 Dec  9  2015 Packages
dr-xr-xr-x 2 root root   4096 Dec  9  2015 repodata
-r--r--r-- 1 root root   1690 Dec  9  2015 RPM-GPG-KEY-CentOS-7
-r--r--r-- 1 root root   1690 Dec  9  2015 RPM-GPG-KEY-CentOS-Testing-7
-r--r--r-- 1 root root   2883 Dec  9  2015 TRANS.TBL

7.3 指定profile,在导入发行版的时候可以通过–kickstart=KICKSTART_FILE指定profile文件,如果没有指定,可以在后期重新指定,需要将profile文件提前准备好,最好放在/var/lib/cobbler/kickstarts,因为这是cobbler默认的ks文件路径,如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#查看默认使用的ks文件,默认使用的是sample_end.ks
[root@linux-node1 kickstarts] # cobbler profile report
Name                           : c7.2-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : c7.2-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 Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : [ 'admin' ]
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm
#上传一个自己写好的ks文件,并写入到profile文件配置里面
[root@linux-node1 kickstarts] # pwd
/var/lib/cobbler/kickstarts
[root@linux-node1 kickstarts] # ll
total 56
-rw-r--r--  1 root root 1519 Feb 21 13:59 CentOS-7.1-x86_64_cobbler.cfg
[root@linux-node1 kickstarts] # cobbler profile edit --name=c7.2-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.1-x86_64_cobbler.cfg
[root@linux-node1 kickstarts] # cobbler profile report
Name                           : c7.2-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : c7.2-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      :  /var/lib/cobbler/kickstarts/CentOS-7 .1-x86_64_cobbler.cfg
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : [ 'admin' ]
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm
 
#修改内核配置
[root@linux-node1 kickstarts] # cobbler profile edit --name=c7.2-x86_64 --kopts='net.ifnames=0 biosdevname=0'
[root@linux-node1 kickstarts] # cobbler profile report
Name                           : c7.2-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : c7.2-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : { 'biosdevname' '0' 'net.ifnames' '0' }
Kernel Options (Post Install)  : {}
Kickstart                      :  /var/lib/cobbler/kickstarts/CentOS-7 .1-x86_64_cobbler.cfg
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : [ 'admin' ]
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm
 
#更改登录界面内容
[root@linux-node1 kickstarts] # vim /etc/cobbler/pxe/pxedefault.template 
 
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http: //cobbler .github.io/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile
 
LABEL  local
         MENU LABEL ( local )
         MENU DEFAULT
         LOCALBOOT -1
 
$pxe_menu_items
 
MENU end


到此安装完毕

启动客户端测试

wKiom1itUAGAQv_YAAAI26F25FI729.png




本文转自 kesungang 51CTO博客,原文链接:http://blog.51cto.com/sgk2011/1900302,如需转载请自行联系原作者
相关文章
|
8月前
|
Linux 网络安全 Apache
源码安装----httpd
源码安装----httpd
264 1
|
Java jenkins Linux
CentOS7 下安装配置Jenkins01------安装Jenkins
直接下载war包,windows和Linux环境通用。Linux 可以通过wget 命令直接下载 windows直接把链接复制到浏览器链接栏即可下载。
396 0
CentOS7 下安装配置Jenkins01------安装Jenkins
|
jenkins Java Linux
CentOS7 下安装配置Jenkins02------配置Jenkins
接上一篇CentOS7 下安装配置Jenkins01------安装Jenkins,我们把Jenkins 安装成功之后,接下来看看如何配置Jenkins。
203 0
CentOS7 下安装配置Jenkins02------配置Jenkins
|
Web App开发 关系型数据库 应用服务中间件
|
Web App开发 应用服务中间件 PHP