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

[经验分享] cobbler初探------实现自动安装centos6.4

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-1-7 08:43:12 | 显示全部楼层 |阅读模式
今天研究了下cobbler,发现挺不错的,可以节省大量的时间,cobbler的内容有点多,也是我研究的自动化的主要部分之一,以后可能会继续总结吧。
为了避免大家安装出现问题,我现在再重新部署一遍

在虚拟机里面做实验,所以我考虑用host-only或vmnet自定义网络,这样没有其他的干扰,这里以host-only为例进行测试

为了简单,我设置cobbler网卡为桥接,ip为108.108.108.75,能上网

1 配置源
1
2
3
[iyunv@localhost ~]# cd /etc/yum.repos.d
[iyunv@localhost yum.repos.d]# rename .repo .repo.bak *
[iyunv@localhost yum.repos.d]# wget mirrors.aliyun.com/repo/{Centos-6.repo,epel-6.repo}



1 下载cobbler组件
1
[iyunv@localhost yum.repos.d]# yum -y install cobbler cobbler-web



2 初始化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
[iyunv@localhost 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.
注:这里对应着修改setting的server

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.
注:这里对应着修改setting的next_server(tftp服务器的位置)

3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
注:让tftp可以启动,并被xinetd管理

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.
注:增加一些基本的引导内核的文件用于pxe引导,这一步很关键

5 : change 'disable' to 'no' in /etc/xinetd.d/rsync
注:让rsync可以启动,并被xinetd管理

6 : reposync is not installed, need for cobbler reposync, install/upgrade yum-utils?
注:暂时忽略该错误

7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
注:配置debmirror

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.



2.1 2.2 2.9
1
2
3
4
5
6
7
cd /etc/cobbler
[iyunv@localhost cobbler]# sed  -i 's#^server:.*#server: 108.108.108.75#' settings
[iyunv@localhost cobbler]# sed  -i 's#^next_server:.*#next_server: 108.108.108.75#' settings
[iyunv@localhost cobbler]# sed  -i 's#pxe_just_once: 0#pxe_just_once: 1#' settings
[iyunv@localhost cobbler]# openssl passwd -1 -salt  'random' 'liuliancao'
$1$random$6Q6tvl/J2PV1qhkZfN3cK/
[iyunv@localhost cobbler]# sed -i 's#default_password_crypted:.*#default_password_crypted: "$1$random$6Q6tvl/J2PV1qhkZfN3cK/"#' settings



2.3 2.5
1
2
[iyunv@localhost cobbler]# sed -i 's#disable.*#disable                 = no#' /etc/xinetd.d/tftp
[iyunv@localhost cobbler]# sed -i 's#disable.*#disable         = no#' /etc/xinetd.d/rsync



2.4 多次执行如下命令直至成功
1
[iyunv@localhost cobbler]# cobbler get-loaders



2.8  2.7 2.10
1
[iyunv@localhost cobbler]# yum -y install pykickstart cman debmirror



好吧,终于差不多了

3 配置外部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
[iyunv@localhost cobbler]# yum -y install dhcp
[iyunv@localhost cobbler]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample  /etc/dhcp/dhcpd.conf
cp:是否覆盖"/etc/dhcp/dhcpd.conf"? y
[iyunv@localhost cobbler]# cat /etc/dhcp/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option domain-name "liuliancao.com";
option domain-name-servers ns1.liuliancao.com;

default-lease-time 600;
max-lease-time 7200;

# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

subnet 108.108.108.0 netmask 255.255.255.0 {
    range 108.108.108.76 108.108.108.77;
    option routers 108.108.108.75;
}
# 下面重要
next_server="108.108.108.75";
filename="pxelinux.0";
[iyunv@localhost cobbler]# service dhcpd start
Starting dhcpd:                                            [  OK  ]



4 准备kickstart文件

网上有,自己也可以根据图形化界面定制
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
[iyunv@localhost cobbler]# cat /var/lib/cobbler/kickstarts/Centos-basic.ks
# Kickstart file automatically generated by anaconda.

#version=DEVEL
install
url --url="http://108.108.108.75/cobbler/ks_mirror/Centos-6.4-X86_64"
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto static --ip 60.60.60.13 --netmask 255.255.255.0 --gateway 60.60.60.1 --noipv6 --nameserver 202.98.192.67 --hostname cobbler
rootpw  --iscrypted $default_password_crypted
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Asia/Chongqing
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --all --drives=sda --initlabel
zerombr
clearpart --all --initlabel
ignoredisk --only-use=sda

part /boot --fstype=ext4 --size=200
part /swap --fstype=ext4 --size=10240
part / --fstype=ext4 --size=38912
#part pv.008002 --grow --size=200

#volgroup vg_cobbler --pesize=4096 pv.008002
#logvol swap --name=LogVol00 --vgname=vg_auto --size=10240
#logvol / --fstype=ext4 --name=LogVol01 --vgname=vg_auto --size=38912

#repo --name="CentOS"  --baseurl=cdrom:sr0 --cost=100

%packages
@base
@console-internet
@core
@debugging
@directory-client
@hardware-monitoring
@java-platform
@large-systems
@network-file-system-client
@performance
@perl-runtime
@server-platform
@server-policy
pax
oddjob
sgpio
device-mapper-persistent-data
samba-winbind
certmonger
pam_krb5
krb5-workstation
perl-DBD-SQLite
%end



导入内核等,说白了就是放到httpd上供使用,此时也会生成一个基于basicks的profile
[iyunv@localhost ~]# service xinetd start
[iyunv@localhost ~]# service httpd restart
[iyunv@localhost ~]# service cobblerd restart
[iyunv@localhost ~]# cobbler import --name='Centos-6.4-x86_64' --path=/media --kickstart=/var/lib/cobbler/kickstarts/
[iyunv@localhost ~]# cobbler sync



然后可以web界面上看看
用户名密码cobbler/cobbler



最后的测试
vmware新建一个虚拟机,选择等会安装
如果是PXE-not found等

那么首先
1 检查你的新的虚拟机网卡是不是bridge,就是在同一个网段
2 检查你的服务是否真的启动起来了,尤其是tftp,dhcpd

大致是这样,大家可能有很多问题,耐心解决就行了。


运维网声明 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.yunweiku.com/thread-161192-1-1.html 上篇帖子: debian 7.9 安装OCS服务端 客户端安装 下篇帖子: CentOS6.6编译安装GCC-5.2.0
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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