设为首页 收藏本站
查看: 286|回复: 0

[经验分享] cobbler基础配置

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-2-24 08:51:09 | 显示全部楼层 |阅读模式
                      cobbler:

    pxe的二次封装:python语言开发,可以为我们提供dhcp服务以及tftp服务;
可以实现多环境的pxe共存
   pxe:dhcp,tftp

程序包:cobbler(epel)
服务:CentOS 7:systemctl start cobblerd.service

核心概念:distro,profile,system

cobbler:distro(repository)-->profile(kickstart)-->system(ip/mask)



测试环境:CentOS7
一、配置及启动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
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
[iyunv@localhost ~]# yum install -y cobbler
[iyunv@localhost ~]# rpm -ql cobbler | grep "\<settings\>"
/etc/cobbler/settings          #此为cobbler的主配置文件
/usr/lib/python2.7/site-packages/cobbler/settings.py
/usr/lib/python2.7/site-packages/cobbler/settings.pyc
/usr/lib/python2.7/site-packages/cobbler/settings.pyo

[iyunv@localhost ~]# systemctl start cobblerd    #启动cobbler
[iyunv@localhost ~]# cobbler check     #进行cobbler check,我们需要解决cobbler所报出的问题,其中第3、4、7问题可以暂时忽略。
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 : file /etc/xinetd.d/rsync does not exist
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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.

[iyunv@localhost cobbler]# grep "^server" settings    #第一个问题的解决方案
server: 172.16.61.2         #指向本地可以与外界通信的地址
[iyunv@localhost cobbler]# grep "^next_server" settings   #第二个问题的解决
next_server: 172.16.61.2    #指向tftp地址
[iyunv@localhost cobbler]# grep "^default_password" settings  #第八个问题的解决
default_password_crypted: "$6$2Mf6mBdf$zoPVM3cv2Vgx4VIwSMJWSrIqYquBT1O686shIJEBYfmq3od9lgWtq301r39wkn8.gJrBI/oaWYU93kmXRbduP/"
[iyunv@localhost cobbler]# cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/cobbler/loaders/    #第五个问题的解决方案
  
[iyunv@localhost cobbler]# cobbler sync    #执行cobbler sync
task started: 2016-02-23_140634_sync
task started (id=Sync, time=Tue Feb 23 14:06:34 2016)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
copying: /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
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 ***





二、配置dhcp服务

1
2
3
4
5
6
7
8
9
10
11
12
option domain-name "tz.com";                              
option domain-name-servers 172.16.0.1;            
default-lease-time 3600;
max-lease-time 7200;
log-facility local7;
subnet 172.16.0.0 netmask 255.255.0.0 {         
    range 172.16.61.1 172.16.61.61;         
    option routers 172.16.61.2;              
    filename "pxelinux.0";
    next-server 172.16.61.2;
}
[iyunv@localhost cobbler]# systemctl start dhcpd   #启动dhcp服务




三、管理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
[iyunv@localhost cobbler]# cobbler import --help   #使用import命令将光盘制作为distro
Usage: cobbler [options]

Options:
  -h, --help            show this help message and exit
  --arch=ARCH           OS architecture being imported
  --breed=BREED         the breed being imported
  --os-version=OS_VERSION
                        the version being imported
  --path=PATH           local path or rsync location
  --name=NAME           name, ex 'RHEL-5'
  --available-as=AVAILABLE_AS
                        tree is here, don't mirror
  --kickstart=KICKSTART_FILE
                        assign this kickstart file
  --rsync-flags=RSYNC_FLAGS
                        pass additional flags to rsync
                        
[iyunv@localhost cobbler]# cobbler import --name="CentOS-7-X86-64-1503" --path=/media/cdrom
task started: 2016-02-23_142932_import
task started (id=Media import, time=Tue Feb 23 14:29:32 2016)  

[iyunv@localhost ~]# ls /var/www/cobbler/ks_mirror/   #在该目录下生成我们指定的文件
CentOS-7-X86-64-1503  config  

[iyunv@localhost cobbler]# cobbler distro list   #生成的distro
   CentOS-7-X86-64-1503-x86_64   
[iyunv@localhost cobbler]# cobbler profile list  #生成的profile文件
   CentOS-7-X86-64-1503-x86_64



注:cobbler会根据profile自动生成kickstart文件
测试结果:
wKiom1bMJfqz2-_jAAAqpWt41AY271.jpg


四、cobbler_web

1
2
3
4
5
6
7
8
9
10
11
[iyunv@localhost ~]# yum install -y cobbler-web   #安装cobbler-web
[iyunv@localhost ~]# vim /etc/cobbler/modules.conf

[authentication]
module = authn_configfile    #基于configfile认证

[iyunv@localhost ~]# htdigest -c /etc/cobbler/users.digest Cobbler cobbleradmin  #生成管理员用户与密码
Adding password for cobbleradmin in realm Cobbler.
New password:
Re-type new password:
[iyunv@localhost ~]# systemctl restart cobblerd




测试结果:
wKioL1bMPH-Qx3vJAABwbucOlZk304.jpg
wKiom1bMPDbhJK0oAACevh6SQo8697.jpg
                   


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-182033-1-1.html 上篇帖子: linux删除文件夹(里面有文件) 下篇帖子: pietty 指定私钥远程登陆linux主机问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表