Cobbler体验小记

简介:
原创作品,允许转载,转载时请务必以超链接形式标明文章  原始出处 、作者信息和本声明。否则将追究法律责任。 http://navyaijm.blog.51cto.com/4647068/1263115

Cobbler有人称之为装系统神奇,当你用了之后你会发现确实如此哈,下记录一下使用过程:

一、安装

我系统环境是centos6.4,采用yum安装:

1
yum -y  install  cobbler  cobbler-web  httpd  rsync  tftp-server xinetd dhcp python-ctypes debmirror pykickstart

二、配置

1、关闭防火墙和SELinux 后重启系统: 

1
2
3
/etc/init .d /iptables  stop          #关闭防火墙
chkconfig iptables off
sed  -i  '/SELINUX=/d'  /etc/selinux/config  &&   echo  "SELINUX=disabled" >>  /etc/selinux/config   #关闭SELINUX

2、修改cobbler配置文件:

 

1
2
3
4
5
6
7
8
9
10
11
12
'next_server: 127.0.0.1'  替换成  'next_server:172.28.26.188'     #DHCP服务地址
'server: 127.0.0.1'  替换成  'server: 172.28.26.188'    #cobbler服务地址
'manage_dhcp: 0'  替换成  'manage_dhcp: 1'       #cobbler管理dhcp
'manage_rsync: 0'  替换成  'manage_rsync: 1'      #cobbler管理rsync功能
'http_port: 80' 替换成  'http_port: 9080'      #更改端口号9080
default_password_crypted:  "$1$1111$vZEjq1D9/uNasiTXwyx4o."   #修改这个默认密码,因为运行cobbler check时会提示你修改密码, 用这个命令实现"openssl passwd -1 -salt '任意字母' '你的密码' "
sed  -i  's/next_server: 127.0.0.1/next_server: 172.28.26.188/g'  /etc/cobbler/settings
sed  -i  's/server: 127.0.0.1/server: 172.28.26.188/g'  /etc/cobbler/settings
sed  -i  's/manage_dhcp: 0/manage_dhcp: 1/g'  /etc/cobbler/settings
sed  -i  's/manage_rsync: 0/manage_rsync: 1/g'  /etc/cobbler/settings
sed  -i  's/http_port: 80/http_port: 9080/g'  /etc/cobbler/settings
openssl  passwd  -1 -salt  '1234312'  'navy123456'     #把生成的密码填到/etc/cobbler/settings配置里default_password_crypted:生成的新密码

3、修改tftp服务和rsync服务配置 :

1
2
sed  -i  '/disable/c disable = no'  /etc/xinetd .d /tftp     #设置 'disable' 为 'no'
sed  -i -e  's/= yes/= no/g'  /etc/xinetd .d /rsync         #设置 'disable' 为 'no'

4、修改dhcp模板 :

1
2
3
4
5
6
7
8
9
10
11
vim  /etc/cobbler/dhcp .template
subnet 172.28.26.0 netmask 255.255.255.0 {      #修改为自己需求网段
option routers             172.28.26.188;                  #修改自己的路由
option domain-name-servers 172.28.26.188;     #域名服务器地址
option subnet-mask         255.255.255.0;          #子网掩码
range dynamic-bootp        172.28.26.191 172.28.26.193;     #分配IP地址段
filename                    "/pxelinux.0" ;
default-lease- time          21600;
max-lease- time              43200;
next-server                $next_server;
}

5、修改cobbler-web配置 :

1
2
3
4
5
6
7
8
9
10
sed  -i  's/Listen 80/Listen 9080/g'  /etc/httpd/conf/httpd .conf   #修改hhtp端口为9080
sed  -i  's/module = authn_denyall/module = authn_configfile/g'  /etc/cobbler/modules .conf    #修改认证
htdigest   /etc/cobbler/users .digest  "Cobbler"  cobbler   #修改cobbler WEB页面管理密码
vim   /etc/httpd/conf .d /ssl .conf      #修改ssl配置,把下面几行添加到配置后面即可
<VirtualHost *:9080>
<LocationMatch  "^/cobbler_web/*" >
RewriteEngine on
RewriteRule ^(.*) https: // %{SERVER_NAME}/%{REQUEST_URI} [R,L]
< /LocationMatch >
< /VirtualHost >

6、启动相关的服务:

1
2
3
4
5
6
7
8
/etc/init .d /httpd  start
/etc/init .d /xinetd  start
/etc/init .d /dhcpd  start
/etc/init .d /cobblerd  start
chkconfig --level 35 httpd on
chkconfig --level 35 xinetd on
chkconfig --level 35 dhcpd on
chkconfig --level 35 cobblerd on

7、效验cobbler安装条件:

1
2
3
service cobblerd restart
cobbler get-loaders        #修复cobbler check时出现的错误信息
cobbler check

三、导入镜配置:

1
2
3
4
5
6
7
8
挂载ISO镜像到 /mnt 目录
mount  -o loop  /data/kisops_centos6 .3._vm.iso  /mnt/
导入ISO,并设置为“x86_64”,并将其命名为Centos6.3。(注:具体可查看 /var/www/cobbler/ks_mirror/Centos6 .4-x86_64/目录文件生成情况。)
cobbler  import  --path= /mnt/    --name=Centos6.3  --arch=x86_64
查看导入结果
cobbler distro list
完成后同步所有配置
cobbler  sync

四、需要抓系统的机器从网卡启动就可以了

174837197.jpg spacer.gif

PS:附加一下ks.cfg

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
#set $swap= $getVar('$swap', '12000')
autostep --autoscreenshot
install
url --url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
text
skipx
lang en_US.UTF-8
keyboard us
network --onboot  yes  --bootproto dhcp --noipv6 --nodns
rootpw  --iscrypted \$6\$Qz7FvhTWfC2yTdb1\$qNF1o.fpE44l /F1ROzJ .bXRKeB4OVQ.maYCY3tMZKDS7tDLrHthIAREXZFvW1G08tOqptkLMxfvyW4wA.vPOz1
firewall --disabled
firstboot --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
#timezone --isUtc Asia/Shanghai
timezone --utc Asia /Shanghai
# 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
logging --level=info
#bootloader --append="nohz=off" --location=mbr
bootloader --location=mbr --driveorder=sda --append= "biosdevname=0 nohz=off thash_entries=1048576 rhash_entries=1048576 selinux=0"
zerombr  yes
# clearpart --all --initlabel --drives=sda
clearpart --all --initlabel
# ignoredisk --only-use=sda
part / --fstype=ext4 --asprimary --size=50000 --maxsize=50000 --label=/
part swap --asprimary --size=$swap --maxsize=$swap --label=swap
part  /data  --fstype=xfs --grow --asprimary --size=12000 --label= /data
%pre
$SNIPPET( 'pre_install_network_config' )
# Add Pre-Installation Script here
date
%end
%packages --excludedocs --ignoremissing
@base
@core
@development
@server-policy
ftp
nc
telnet
cmake
compat-gcc-34
compat-gcc-34-c++
sgpio
libXtst
yum-plugin-priorities
koan
openssl
tengine
-lvm2
-acpid
-biosdevname
-hunspell-en
-abrt-cli
- man -pages-overrides
-blktrace
-words
-abrt-addon-kerneloops
-abrt-addon-ccpp
-bridge-utils
-nano
-mtr
-hunspell
-abrt-addon-python
- man -pages
-byacc
-indent
-diffstat
-doxygen
-intltool
-git
-ctags
-cscope
-iptables
-system-config-firewall-base
-iptables-ipv6
-system-config-firewall-tui
-subversion
%end
$SNIPPET( 'services_disable_enable' )
%post
$SNIPPET( 'post_install_network_config' )
$SNIPPET( 'env_init' )
$SNIPPET( 'kis_cobbler_api' )
$SNIPPET( 'cactirelease' )
$SNIPPET( 'kisyum_install' )
/usr/sbin/eject  -rv  /dev/sr # eject P cdrom
echo  'v1.3'  > ~root /VERSION
%end
# finish
reboot -- eject

 

本文出自 “屌丝运维男” 博客,请务必保留此出处http://navyaijm.blog.51cto.com/4647068/1263115

目录
相关文章
|
Linux 程序员 网络安全
ansible2.4安装和体验
ansible是常用的开源配置管理工具,简单易用,可以高效的帮助我们对服务器进行远程操作,欢迎您本文一起安装和体验2.4版本
ansible2.4安装和体验
|
XML IDE 数据可视化
Vim的三款实用插件
Vim 是 Linux 下的常用文本编辑器,但也经常被称为是一个上古神器,因为它对于初学者而言相当不友好,也不好入门。
285 0
|
Linux 网络安全 开发工具
cobbler 无人值守-安装
环境准备 准备两台主机,如centos6和centos7 centos7当作server服务器 关闭selinux 关闭防火墙 安装 cobbler包光盘里是没有的,要配置epel源,这里就说怎么配置epel源了,在yum.
1185 0
|
网络协议 API 机器学习/深度学习
cobbler 无人值守-介绍
cobbler 介绍 快速网络安装linux操作系统的服务,支持众多的Linux版本,也支持网络安装windows系统 PXE的二次封装,将多种安装参数封装到一个菜单 它是由Python编写的 还可以用CLI和WEB来管理 cobbler 配置目录说明 安装:yum in...
2052 0
|
存储 开发工具 数据安全/隐私保护
|
数据安全/隐私保护
|
运维 网络协议 Linux