cobbler 无人值守安装

简介:

1.阿里云源

1
2
3
[root@linux-node1 ~] # wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@linux-node1 ~] # wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@linux-node1 ~] # yum clean all

2.操作系统(centos7.3 会有问题选择centos7.2或者7.1)

1
2
3
[root@linux-node1 ~] # cat  /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
[root@linux-node1 ~] #

3.安装需要的软件

1
[root@linux-node1 ~] #  yum  install   -y httpd   dhcp   tftp   cobbler

4.启动httpd和cobblerd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@linux-node1 ~] # systemctl start  httpd 
[root@linux-node1 ~] # systemctl enable  httpd 
Created  symlink  from  /etc/systemd/system/multi-user .target.wants /httpd .service to  /usr/lib/systemd/system/httpd .service.
[root@linux-node1 ~] # systemctl start   cobblerd
[root@linux-node1 ~] # systemctl enable   cobblerd
Created  symlink  from  /etc/systemd/system/multi-user .target.wants /cobblerd .service to  /usr/lib/systemd/system/cobblerd .service.
[root@linux-node1 ~]
 
检查是否启动
[root@linux-node1 ~] # 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      922 /sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1580 /master         
tcp        0      0 127.0.0.1:25151         0.0.0.0:*               LISTEN      2820 /python2        
tcp6       0      0 :::80                   :::*                    LISTEN      2792 /httpd          
tcp6       0      0 :::22                   :::*                    LISTEN      922 /sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1580 /master         
[root@linux-node1 ~] #

5.执行cobbler check检查需要配置的cobbler模块

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@linux-node1 ~] # 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 : change  'disable'  to  'no'  in  /etc/xinetd .d /tftp
4 : 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.
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 : ksvalidator was not found,  install  pykickstart
8 : 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
9 : 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.
[root@linux-node1 ~] #

 5.1 修改1和2

1
2
3
4
[root@linux-node1 ~] # grep "192.168.56.13" /etc/cobbler/settings
next_server: 192.168.56.13
server: 192.168.56.13
[root@linux-node1 ~] #

 5.2修改3

1
2
3
[root@linux-node1 ~] # grep "disable"  /etc/xinetd.d/tftp
     disable         = no
[root@linux-node1 ~] #

5.3修改4

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@linux-node1 ~] # cobbler get-loaders
task started: 2017-02-20_033851_get_loaders
task started ( id =Download Bootloader Content,  time =Mon Feb 20 03:38:51 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 ***

5.4修改5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@linux-node1 ~] # systemctl start  rsyncd
[root@linux-node1 ~] # systemctl enable  rsyncd
Created  symlink  from  /etc/systemd/system/multi-user .target.wants /rsyncd .service to  /usr/lib/systemd/system/rsyncd .service.
[root@linux-node1 ~] # 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:873             0.0.0.0:*               LISTEN      2874 /rsync          
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      922 /sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1580 /master         
tcp        0      0 127.0.0.1:25151         0.0.0.0:*               LISTEN      2820 /python2        
tcp6       0      0 :::873                  :::*                    LISTEN      2874 /rsync          
tcp6       0      0 :::80                   :::*                    LISTEN      2792 /httpd          
tcp6       0      0 :::22                   :::*                    LISTEN      922 /sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1580 /master         
[root@linux-node1 ~] #

5.5 修改7 ,6不用管

1
[root@linux-node1 ~] # yum  -y install  install pykickstart

5.6 修改客户机的密码

1
2
3
4
5
6
[root@linux-node1 ~] # openssl passwd -1 -salt '123123' '123123'
$1$123123$MAV.kVI /b3swmFLErPD2b0
[root@linux-node1 ~] # vim  /etc/cobbler/settings 
[root@linux-node1 ~] # grep "default_password_crypted"  /etc/cobbler/settings
default_password_crypted:  "$1$123123$MAV.kVI/b3swmFLErPD2b0"
[root@linux-node1 ~] #

5.7 修改9

[root@linux-node1 ~]# yum  -y install  cman  fence-agents

5.8校验

1
2
3
4
5
6
7
8
9
出现如下状况就可以了
[root@linux-node1 ~] # systemctl restart cobblerd
[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.
[root@linux-node1 ~] #

6 让cobbler管理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
[root@linux-node1 ~] # grep "manage_dhcp" /etc/cobbler/settings
manage_dhcp: 1
# if using cobbler with manage_dhcp, put the IP address
# Note that if manage_dhcp and manage_dns are disabled, the respective
[root@linux-node1 ~]
[root@linux-node1 ~] # vim  /etc/cobbler/dhcp.template
 
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                $next_server;
      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" ;
           }
      }
 
}
 
[root@linux-node1 ~] # systemctl restart  cobblerd

7.让配置文件生效

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
[root@linux-node1 ~] # cobbler sync 
task started: 2017-02-20_041326_sync
task started ( id =Sync,  time =Mon Feb 20 04:13:26 2017)
running pre- sync  triggers
cleaning trees
removing:  /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink  /var/lib/cobbler/loaders/pxelinux .0 ->  /var/lib/tftpboot/pxelinux .0
trying hardlink  /var/lib/cobbler/loaders/menu .c32 ->  /var/lib/tftpboot/menu .c32
trying hardlink  /var/lib/cobbler/loaders/yaboot  ->  /var/lib/tftpboot/yaboot
trying hardlink  /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
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 ***
[root@linux-node1 ~] #

8.上传镜像

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@linux-node1 opt] # ll
total 4228096
-rw-r--r-- 1 root root 4329570304 Feb 20 04:20 CentOS-7-x86_64-DVD-1511.iso
[root@linux-node1 opt] # mount -o  loop   /opt/CentOS-7-x86_64-DVD-1511.iso   /mnt 
mount /dev/loop0  is write-protected, mounting  read -only
[root@linux-node1 opt]
导入镜像
[root@linux-node1 opt] # cobbler  import --path=/mnt --name=CentOS-7.2-x86_64   --arch=x86_64
task started: 2017-02-20_042242_import
task started ( id =Media  import time =Mon Feb 20 04:22:42 2017)
。。。。。 此处比较慢
 
镜像导入这一步其实是,复制镜像的过程
[root@linux-node1 mnt] # cd  /var/www/cobbler/ks_mirror
[root@linux-node1 ks_mirror] # ls
CentOS-7.2-x86_64  config
[root@linux-node1 ks_mirror] #

9检查校验

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@linux-node1 ks_mirror] # cobbler  list 
distros:
    CentOS-7.2-x86_64
 
profiles:
    CentOS-7.2-x86_64
 
systems:
 
repos:
 
images:
 
mgmtclasses:
 
packages:
 
files:
[root@linux-node1 ks_mirror] #

10上传配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@linux-node1 kickstarts] # ll
total 56
-rw-r--r-- 1 root root 1355 Feb 18 15:39 CentOS-7-x86_64.cfg  #这个配置文件
-rw-r--r-- 1 root root  115 Nov 17 03:09 default.ks
-rw-r--r-- 1 root root   22 Nov 17 03:09 esxi4-ks.cfg
-rw-r--r-- 1 root root   22 Nov 17 03:09 esxi5-ks.cfg
drwxr-xr-x 2 root root   54 Feb 20 03:29 install_profiles
-rw-r--r-- 1 root root 1424 Nov 17 03:09 legacy.ks
-rw-r--r-- 1 root root  292 Nov 17 03:09 pxerescue.ks
-rw-r--r-- 1 root root 2916 Nov 17 03:09 sample_autoyast.xml
-rw-r--r-- 1 root root 1825 Nov 17 03:09 sample_end.ks
-rw-r--r-- 1 root root    0 Nov 17 03:09 sample_esx4.ks
-rw-r--r-- 1 root root  324 Nov 17 03:09 sample_esxi4.ks
-rw-r--r-- 1 root root  386 Nov 17 03:09 sample_esxi5.ks
-rw-r--r-- 1 root root 1784 Nov 17 03:09 sample.ks
-rw-r--r-- 1 root root 3419 Nov 17 03:09 sample_old.seed
-rw-r--r-- 1 root root 5879 Nov 17 03:09 sample.seed
[root@linux-node1 kickstarts] # pwd
/var/lib/cobbler/kickstarts  #目录
[root@linux-node1 kickstarts] #

11.查看profile

1
2
3
[root@linux-node1 kickstarts] # cobbler  profile  list
    CentOS-7.2-x86_64
[root@linux-node1 kickstarts] #

12. 查看参数

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
[root@linux-node1 kickstarts] # cobbler  profile report 
Name                           : CentOS-7.2-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : CentOS-7.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
 
[root@linux-node1 kickstarts] #

13.修改内核参数

1
2
3
4
[root@linux-node1 kickstarts] # cobbler profile edit --name=CentOS-7.2-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7-x86_64.cfg 
[root@linux-node1 kickstarts] # cobbler profile edit --name=CentOS-7.2-x86_64 --kopts='net.ifnames=0 biosdevname=0'
[root@linux-node1 kickstarts] # cobbler  profile report 
Name                           : CentOS-7.2-x86_64
1
2
3
4
5
6
7
8
9
10
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : CentOS-7.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-x86_64 .cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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                      :
1
2
3
Virt RAM (MB)                  : 512
Virt Type                      : kvm
[root@linux-node1 kickstarts] #

14 启动xinetd

1
2
3
[root@linux-node1 kickstarts] # yum  -y install  xinetd 
[root@linux-node1 kickstarts] # systemctl  start xinetd
[root@linux-node1 kickstarts] # systemctl  enable  xinetd

15.配置文件接着生成

1
[root@linux-node1 kickstarts] # cobbler sync

16.新建一台虚拟机(非克隆机) 关掉本地的dhcp服务

可以看出自动安装了

wKioL1iplIDRUpMyAAA8Y5DwhAg335.png-wh_50wKiom1iplIGi5jg5AAAmcIip-DY647.png-wh_50wKiom1iplLbCvEJ5AABbtFhh_5g475.png-wh_50

wKioL1iplsSikw54AAA0X01x7Vo341.png-wh_50 

完毕安装 

17.cobbler的web界面管理

1
2
3
yum  -y   install   cobbler-web
htdigest  /etc/cobbler/users .digest  "Cobbler"  cobbler    #让输入密码 给cobbler密码
systemctl  restart  httpd

wKiom1ipmR7gufUfAACJs8sQpdI667.png-wh_50

wKiom1ipmR-wdzoIAABo-e75ALk779.png-wh_50

wKioL1ipmSPSdVnlAADxI59Ee54041.png-wh_50

18.对特定服务器的mac地址分配特定的IP

wKioL1ipni_BR2e2AADk_jHD2_c498.png-wh_50

1
2
3
[root@linux-node1 kickstarts] # cobbler system add --name=linux-node2 --mac=00:50:56:39:A9:37 --profile=CentOS-7.2-x86_64 --ip-address=192.168.56.112 --subnet=255.255.255.0 --gateway=192.168.56.2 --interface=eth0 --static=1 --hostname=linux-node2.com --name-servers="192.168.56.2" --kickstart=/var/lib/cobbler/kickstarts/CentOS-7-x86_64.cfg 
[root@linux-node1 kickstarts] # cobbler system  list 
    linux-node2

再次启动刚所对应mac的服务器

wKioL1ipoNmizPKmAABN2UwDKUM545.png-wh_50










本文转自 小小三郎1 51CTO博客,原文链接:http://blog.51cto.com/wsxxsl/1899308,如需转载请自行联系原作者
目录
相关文章
|
Go
go map进行有序的排序
go map进行有序的排序
193 0
|
设计模式 开发者 UED
理解Visual Basic中的事件驱动编程模型
【4月更文挑战第27天】本文介绍了Visual Basic中的事件驱动编程模型,阐述了事件驱动编程的基本概念,包括事件、事件源和事件处理。在VB中,事件处理通过界面设计与代码分离实现,开发者可直观绑定事件并编写处理函数。文章还讨论了事件参数、事件链式响应和优先级,以及事件驱动模型的优势(如响应性和模块化)和挑战(如调试困难和性能问题)。最后,提出了实践技巧和优化策略,如简化事件处理、管理事件订阅、异步处理和应用设计模式,以提升程序效率和可维护性。
271 1
|
安全 编译器 Swift
探索iOS开发之旅:Swift编程语言的魅力与挑战
【9月更文挑战第5天】在iOS应用开发的广阔天地中,Swift作为苹果官方推荐的编程语言,以其简洁、高效和安全的特点,成为了开发者的新宠。本文将带领你领略Swift语言的独特魅力,同时探讨在实际开发过程中可能遇到的挑战,以及如何克服这些挑战,成为一名优秀的iOS开发者。
190 5
|
机器学习/深度学习 人工智能 算法
神经网络算法——损失函数(Loss Function)
神经网络算法——损失函数(Loss Function)
2890 0
|
人工智能 算法 PyTorch
极智AI | 目标检测实现分享四:详解YOLOv4算法实现
大家好,我是极智视界,本文详细介绍一下 YOLOv4 算法的设计与实践,实践部分包括 darknet 与 pytorch。
417 1
|
JSON 算法 Java
SpringBoot 实现接口参数加密解密功能
SpringBoot 实现接口参数加密解密功能
854 0
|
Java 编译器 程序员
synchronized 原理(锁升级、锁消除和锁粗化)
synchronized 原理(锁升级、锁消除和锁粗化)
|
存储 人工智能 大数据
从技术视角看大数据行业的发展趋势
从技术视角看大数据行业的发展趋势
|
存储 SQL 前端开发
电子商务网站建设必备要素:设施、技术、人员配置全解析
服务器是网站运行的基础,需要选择性能稳定的服务器。根据业务规模,可以选择单机服务器、云服务器等不同类型。单机服务器成本低但扩展性差,云服务器虽价格高但弹性好。服务器数量应根据日均访问量和峰值访问量确定,以保证网站高可用。
507 0
|
存储 IDE Serverless
基于函数计算部署Serverless VSCode WebIDE
基于函数计算一键部署一个Serverless VSCode WebIDE,即开即用,用完即走。

热门文章

最新文章