Chinaunix首页 | 论坛 | 博客
  • 博客访问: 669477
  • 博文数量: 220
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1961
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-04 21:54
文章分类

全部博文(220)

文章存档

2018年(1)

2015年(140)

2014年(79)

我的朋友

分类: 系统运维

2015-04-28 11:55:49

http://freeloda.blog.51cto.com/2033581/1320090
(有改动)
大纲

一、前言

二、环境配置

三、Cobbler 安装

四、Cobbler 配置详解

注,操作系统 CentOS 6.4 x86_64,软件版本 Cobbler-2.4.0-1。(目前最新版


一、前言

在上一篇博客中(http://freeloda.blog.51cto.com/2033581/1319695)我们主要讲解与Cobbler相关的基础知识,在一篇博客中我们主要中大家来说一下Cobbler安装与配置,并且详细说一下Cobbler命令的使用。好了,废话不多说下面直接上干货。


二、环境配置

1.实验拓扑

Cobbler 拓扑

2.安装yum源

点击(此处)折叠或打开

  1. [root@node2 ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  2. Retrieving http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  3. warning: /var/tmp/rpm-tmp.z0cbxV: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
  4. Preparing... ########################################### [100%]
  5.   1:epel-release ########################################### [100%]


3.同步系统时间

1
2
3
4
[root@node2 ~]# yum install -y ntp
[root@node2 ~]# ntpdate 202.120.2.101
 4 Nov 13:49:41 ntpdate[1190]: step time server 202.120.2.101 offset 388653.714776 sec
[root@node2 ~]# hwclock -w

4.关闭防火墙与SELinux

1
2
3
4
[root@node2 ~]# service iptables stop
[root@node2 ~]# chkconfig iptables off
[root@node2 ~]# getenforce
Disabled


三、Cobbler 安装

1.Cobbler运行所需基础包

1
[root@node2 ~]# yum install -y cobbler tftp dhcp httpd cman pykickstart debmirror

2.Cobblerf所需环境支持包

1
[root@node2 ~]# yum install -y ed patch perl perl-Compress-Zlib perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl

3.将所有服务加入开机自启动并启动相关服务

1
2
3
4
5
6
7
8
9
10
[root@node2 ~]# chkconfig httpd on
[root@node2 ~]# chkconfig dhcpd on
[root@node2 ~]# chkconfig xinetd on
[root@node2 ~]# chkconfig cobblerd on
[root@node2 ~]#
[root@node2 ~]# service httpd start
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using node2.test.com for ServerName
                              [确定]
[root@node2 ~]# service cobblerd start
Starting cobbler daemon:                  [确定]

4.修改apache相关配置并重新启动

注,从上面的启动信息可以看出apache启动有点小错误,我们来修正一下。

1
2
3
4
5
6
[root@node2 ~]# vim /etc/httpd/conf/httpd.conf
#增加一行
ServerName localhost:80
[root@node2 ~]# service httpd restart
停止 httpd:                        [确定]
正在启动 httpd:                      [确定]

5.运行Cobbler检查命令

1
2
3
4
5
6
7
8
9
10
[root@node2 ~]# 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 : 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.
4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
5 : comment out 'dists' on /etc/debmirror.conf for proper debian support
6 : comment out 'arches' on /etc/debmirror.conf for proper debian support
7 : 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
Restart cobblerd and then run 'cobbler sync' to apply changes.

注,从上面的执行结果来看上面有7处错误,下面我们来解决一下。

(1).错误1,修改/etc/cobbler/settings 里面的 server 为Cobbler Server的IP地址 ;

1
2
[root@node2 ~]# vim /etc/cobbler/settings
server: 192.168.18.202

(2).错误2,修改/etc/cobbler/settings 里面的 next_serverw 为本机的 ip;

1
2
[root@node2 ~]# vim /etc/cobbler/settings
next_server: 192.168.18.202

(3).错误3,据说这个错误可以忽略,有强迫完美运行症的人士可以运行以下命令来解决;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@node2 ~]# cobbler get-loaders
task started: 2013-11-04_143149_get_loaders
task started (id=Download Bootloader Content, time=Mon Nov 4 14:31:49 2013)
downloading http://www.cobblerd.org/loaders/README to /var/lib/cobbler/loaders/README
downloading http://www.cobblerd.org/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading http://www.cobblerd.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading http://www.cobblerd.org/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading http://www.cobblerd.org/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading http://www.cobblerd.org/loaders/yaboot-1.3.14-12 to /var/lib/cobbler/loaders/yaboot
downloading http://www.cobblerd.org/loaders/pxelinux.0-3.61 to /var/lib/cobbler/loaders/pxelinux.0
downloading http://www.cobblerd.org/loaders/menu.c32-3.61 to /var/lib/cobbler/loaders/menu.c32
downloading http://www.cobblerd.org/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading http://www.cobblerd.org/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

(4).错误4,修改/etc/xinetd.d/tftp 把'disable' 修改为'no';修改/etc/xinetd.d/rsync 把'disable' 修改为'no';

1
2
3
4
[root@node2 ~]# vim /etc/xinetd.d/tftp
disable         = no
[root@node2 ~]# vim /etc/xinetd.d/rsync
disable = no

注,启动xinetd服务。

1
2
[root@node2 ~]# service xinetd start
正在启动 xinetd:                     [确定]

(5).错误5与错误6,debmmirror有错误;

1
2
3
4
[root@node2 ~]# vim /etc/debmirror.conf
#注释掉@dists="sid"与@arches="i386即可
#@dists="sid";
#@arches="i386";

(6).错误7,设置默认root密码;

注,刚接触Cobbler的博友会问,这个密码是什么密码。有的博友系统安装好了会问,root密码是什么。这里设置的就是客户端安装好系统的root密码。

#生成你想要的密码的加密字符串,然后复制运行命令之后的加密代码;

1
2
[root@node2 ~]# openssl passwd -1 -salt 'hahaha' '123456'
$1$hahaha$hSxFjZSHRoiEn4DYrrGUI.

#然后替换/etc/cobbler/settings 中选项双引号中的加密代码;

1
2
[root@node2 ~]# vim /etc/cobbler/settings
default_password_crypted: "$1$hahaha$hSxFjZSHRoiEn4DYrrGUI."

6.重新启动Cobbler并运行检查命令

1
2
3
4
5
[root@node2 ~]# service cobblerd restart
Stopping cobbler daemon:                  [确定]
Starting cobbler daemon:                  [确定]
[root@node2 ~]# cobbler check
No configuration problems found. All systems go.

好了,到这里我们Cobbler安装就全部完成了,最后我们来查看一下启动的端口。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@node2 ~]# netstat -ntulp
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   1011/sshd 
tcp    0   0 127.0.0.1:25        0.0.0.0:*          LISTEN   1087/master
tcp    0   0 127.0.0.1:6010       0.0.0.0:*          LISTEN   1126/sshd 
tcp    0   0 127.0.0.1:6011       0.0.0.0:*          LISTEN   1607/sshd 
tcp    0   0 127.0.0.1:25151       0.0.0.0:*          LISTEN   12677/python
tcp    0   0 :::80            :::*            LISTEN   1696/httpd
tcp    0   0 :::22            :::*            LISTEN   1011/sshd 
tcp    0   0 ::1:25           :::*            LISTEN   1087/master
tcp    0   0 ::1:6010          :::*            LISTEN   1126/sshd 
tcp    0   0 ::1:6011          :::*            LISTEN   1607/sshd 
tcp    0   0 :::873           :::*            LISTEN   12747/xinetd
udp    0   0 0.0.0.0:69         0.0.0.0:*                12747/xinetd


四、Cobbler 配置详解

主要的 Cobbler 配置文件是 /etc/cobbler/settings。使用文本编辑器打开这个文件,并设置以下选项:

  • manage_dhcp:1

  • manage_dns:1

  • manage_tftpd:1

  • restart_dhcp:1

  • restart_dns:1

  • pxe_just_once:1

  • next_server:<服务器的 IP 地址>

  • server:<服务器的 IP 地址>

选项 manage_* 和 restart_* 无需加以说明。选项 next_server 用在 DHCP 配置文件中,向客户端告知提供引导文件的服务器地址。选项 server 在客户端安装期间用于引用 Cobbler 服务器地址。最后,选项 pxe_just_once 预防将机器中的安装循环配置为始终从网络引导。激活此选项时,机器告诉 Cobbler 安装已完成。Cobbler 将系统对象的 netboot 标志更改为 false,这会强制机器从本地磁盘引导。好了,下面我们配置并管理dhcp服务与http服务。


1.让Cobbler来管理DHCP服务器

1
2
[root@node2 ~]# vim /etc/cobbler/settings
manage_dhcp: 1

2.修改DHCP模板

1
2
3
4
5
6
7
8
9
10
11
[root@node2 ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.18.0 netmask 255.255.255.0 {
option routers 192.168.18.254;
option domain-name-servers 8.8.8.8;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.18.221 192.168.18.225;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}

3.重新启动Cobbler服务

1
2
3
[root@node2 ~]# service cobblerd restart
Stopping cobbler daemon:                  [确定]
Starting cobbler daemon:                  [确定]

4.编辑/etc/httpd/conf.d/wsgi.conf 去掉注释

1
2
[root@node2 ~]# vim /etc/httpd/conf.d/wsgi.conf
LoadModule wsgi_module modules/mod_wsgi.so

5.完成后一定要运行cobbler sync 命令让配置生效,使dhcp、http被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
[root@node2 ~]# cobbler sync
task started: 2013-11-04_164727_sync
task started (id=Sync, time=Mon Nov 4 16:47:27 2013)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.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: 关闭 dhcpd:[确定]
正在启动 dhcpd:[确定]
received on stderr:
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 ***

好了,到这里我们的Cobbler安装与配置就讲解完成了,我们在下一篇博客中将讲解Cobbler管理与使用详解。最后,希望大家有所收获^_^……

大纲

一、前言

二、Cobbler 命令详解

三、导入要安装的镜像文件

四、客户端安装操作系统

注,操作系统 CentOS 6.4 x86_64,软件版本 Cobbler-2.4.0-1。(目前最新版


一、前言

在上一篇博客中(http://freeloda.blog.51cto.com/2033581/1320090)我们详细的讲解了Cobbler安装与基本配置,在最后的实验中我们已经安装好了Cobbler。在这一篇博客中我们来主要讲解一下Cobbler命令的使用与相关配置目录的说明。好了,下面废话不多说直接上干货。(注,这一篇博客的内容是跟着上一篇博客的内容写的,对安装不了解的博友可以先参考上一篇博客。


二、Cobbler 命令详解

1.查看一下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
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
[root@node2 ~]# cobbler
usage 
===== 
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ... 
    [add|edit|copy|getks*|list|remove|rename|report] [options|--help] 
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version> [options|--help]
注,大家可以在上面的显示中可以看到cobbler命令有很多的选项,想获得相关选项的帮助只需要加--help即可。
[root@node2 ~]# cobbler profile --help
usage 
===== 
cobbler profile add 
cobbler profile copy 
cobbler profile dumpvars 
cobbler profile edit 
cobbler profile find 
cobbler profile getks 
cobbler profile list 
cobbler profile remove 
cobbler profile rename 
cobbler profile report
[root@node2 ~]# cobbler profile add --help
Usage: cobbler [options]
Options:
 -h, --help      show this help message and exit 
 --name=NAME      Name (Ex: F10-i386-webserver) 
 --uid=UID     
 --owners=OWNERS    Owners (Owners list for authz_ownership (space 
            delimited)) 
 --distro=DISTRO    Distribution (Parent distribution) 
 --parent=PARENT    Parent Profile 
 --enable-gpxe=ENABLE_GPXE 
            Enable gPXE? (Use gPXE instead of PXELINUX for 
            advanced booting options) 
 --enable-menu=ENABLE_MENU 
            Enable PXE Menu? (Show this profile in the PXE menu?) 
 --kickstart=KICKSTART 
            Kickstart (Path to kickstart template) 
 --kopts=KERNEL_OPTIONS 
            Kernel Options (Ex: selinux=permissive) 
 --kopts-post=KERNEL_OPTIONS_POST 
            Kernel Options (Post Install) (Ex: clocksource=pit 
            noapic) 
 --ksmeta=KS_META   Kickstart Metadata (Ex: dog=fang agent=86) 
 --proxy=PROXY     Proxy (Proxy URL) 
 --repos=REPOS     Repos (Repos to auto-assign to this profile) 
 --comment=COMMENT   Comment (Free form text description) 
 --virt-auto-boot=VIRT_AUTO_BOOT 
            Virt Auto Boot (Auto boot this VM?) 
 --virt-cpus=VIRT_CPUS 
            Virt CPUs (integer) 
 --virt-file-size=VIRT_FILE_SIZE 
            Virt File Size(GB) 
 --virt-disk-driver=VIRT_DISK_DRIVER 
            Virt Disk Driver Type (The on-disk format for the 
            virtualization disk) 
 --virt-ram=VIRT_RAM  Virt RAM (MB) 
 --depth=DEPTH   
 --virt-type=VIRT_TYPE 
            Virt Type (Virtualization technology to use) (valid 
            options: xenpv,xenfv,qemu,kvm,vmware,openvz) 
 --virt-path=VIRT_PATH 
            Virt Path (Ex: /directory OR VolGroup00) 
 --virt-bridge=VIRT_BRIDGE 
            Virt Bridge 
 --dhcp-tag=DHCP_TAG  DHCP Tag (See manpage or leave blank) 
 --server=SERVER    Server Override (See manpage or leave blank) 
 --ctime=CTIME   
 --mtime=MTIME   
 --name-servers=NAME_SERVERS 
            Name Servers (space delimited) 
 --name-servers-search=NAME_SERVERS_SEARCH 
            Name Servers Search Path (space delimited) 
 --mgmt-classes=MGMT_CLASSES 
            Management Classes (For external configuration 
            management) 
 --mgmt-parameters=MGMT_PARAMETERS 
            Management Parameters (Parameters which will be handed 
            to your management application (Must be valid YAML 
            dictionary)) 
 --boot-files=BOOT_FILES 
            TFTP Boot Files (Files copied into tftpboot beyond the 
            kernel/initrd) 
 --fetchable-files=FETCHABLE_FILES 
            Fetchable Files (Templates for tftp or wget) 
 --template-files=TEMPLATE_FILES 
            Template Files (File mappings for built-in config 
            management) 
 --redhat-management-key=REDHAT_MANAGEMENT_KEY 
            Red Hat Management Key (Registration key for RHN, 
            Spacewalk, or Satellite) 
 --redhat-management-server=REDHAT_MANAGEMENT_SERVER 
            Red Hat Management Server (Address of Spacewalk or 
            Satellite Server) 
 --template-remote-kickstarts=TEMPLATE_REMOTE_KICKSTARTS 
 --clobber       allow add to overwrite existing objects 
 --in-place      edit items in kopts or ksmeta without clearing the 
            other items

2.Cobbler 常用命令详解

  • cobbler check #检查cobbler配置

  • cobbler sync #同步配置到dhcp/pxe和数据目录

  • cobbler list #列出所有的cobbler元素

  • cobbler import #导入安装的系统镜像

  • cobbler report #列出各元素的详细信息

  • cobbler distro #查看导入的发行版系统信息

  • cobbler profile #查看配置信息

  • cobbler system #查看添加的系统信息

  • cobbler reposync #同步yum仓库到本地

(1).cobbler check

1
2
[root@node2 ~]# cobbler check 
No configuration problems found. All systems go.

注,主要用于检查cobbler配置是否有错。

(2).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
[root@node2 ~]# cobbler sync 
task started: 2013-11-11_133827_sync  
task started (id=Sync, time=Mon Nov 11 13:38:27 2013)  
running pre-sync triggers  
cleaning trees  
removing: /var/lib/tftpboot/pxelinux.cfg/default  
removing: /var/lib/tftpboot/grub/grub-x86_64.efi  
removing: /var/lib/tftpboot/grub/images  
removing: /var/lib/tftpboot/grub/efidefault  
removing: /var/lib/tftpboot/grub/grub-x86.efi  
removing: /var/lib/tftpboot/s390x/profile_list  
copying bootloaders  
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi  
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.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: 关闭 dhcpd:[确定]  
正在启动 dhcpd:[确定]
received on stderr: 
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 ***

注,同步cobbler配置到数据目录中,更改某些配置后得执行一下,同步一下配置。

(3).cobbler list

1
2
3
4
5
6
7
8
9
[root@node2 ~]# cobbler list 
distros: #导入的发行版本
profiles: #安装的配置信息
systems: #增加的系统信息
repos: #yum仓库
images: #存储所有导入发行版的Kernel和initrd镜像用于远程网络启动
mgmtclasses:
packages:
files:

注,用cobbler list 命令可以列出cobbler所有元素。

(4).cobbler import

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@node2 ~]# cobbler import --help 
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

注,cobbler import 命令可以导入我们要安装的镜像文件(ISO文件)。

(5).cobbler report

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@node2 ~]# cobbler report 
distros:  
==========
profiles: 
==========
systems: 
==========
repos: 
==========
images: 
==========
mgmtclasses: 
==========
packages: 
==========
files: 
==========

注,由于我们还没有导入任何的系统镜像文件,所以这里显示为空。一会我们导入完系统镜像后,就可以看到详细信息。

(6).cobbler distro

1
2
3
4
5
6
7
8
9
10
11
[root@node2 ~]# cobbler distro 
usage  
=====  
cobbler distro add  
cobbler distro copy  
cobbler distro edit  
cobbler distro find  
cobbler distro list  
cobbler distro remove  
cobbler distro rename  
cobbler distro report

注,cobbler distro 命令不但可以查看导入的发行版系统信息还可以增加与修改等。

(7).cobbler profile

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@node2 ~]# cobbler profile 
usage  
=====  
cobbler profile add  
cobbler profile copy  
cobbler profile dumpvars  
cobbler profile edit  
cobbler profile find  
cobbler profile getks  
cobbler profile list  
cobbler profile remove  
cobbler profile rename  
cobbler profile report

注,cobbler profile命令不但可以查看Kickstart文件而且还可以编辑与删除此文件。

(8).cobbler system

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@node2 ~]# cobbler system 
usage  
=====  
cobbler system add  
cobbler system copy  
cobbler system dumpvars  
cobbler system edit  
cobbler system find  
cobbler system getks  
cobbler system list  
cobbler system poweroff  
cobbler system poweron  
cobbler system powerstatus  
cobbler system reboot  
cobbler system remove  
cobbler system rename  
cobbler system report

注,cobbler system 命令可以将cobbler的配置安装文件与客户端相关联。下面是具体的案例,

1
2
3
4
5
6
7
8
9
[root@node2 ~]# cobbler system add --name=desktop-xfce-1 \
                   --profile=Fedora17-xfce \
                   --mac=52:54:00:b8:5e:8f \
                   --ip-address=192.168.122.10
[root@node2 ~]# cobbler system add --name=desktop-gnome-1 \
                   --profile=Fedora17-gnome \
                   --mac=52:54:00:88:f3:44 \
                   --ip-address=192.168.122.11
[root@node2 ~]# cobbler system report

(9).cobbler reposync

1
2
3
4
5
6
[root@node2 ~]# cobbler reposync
task started: 2013-11-11_144127_reposync
task started (id=Reposync, time=Mon Nov 11 14:41:27 2013)
hello, reposync
run, reposync, run!
*** TASK COMPLETE ***

注,cobbler reposync命令可以同步远程的yum源到本地。


三、导入要安装的镜像文件

1.镜像文件

  • CentOS-5.5-x86_64-bin-DVD-1of2.iso

  • CentOS-6.4-x86_64-bin-DVD1.iso

注,这里我们主要演示两个系统。一个是CentOS 5.5,另一个是CentOS6.4。这两个系统是现在比较常用的两个,重点给大家演示一下怎么导入系统。(在上篇博客中我们已经安装好Cobbler,并修改好相关配置,但是没有导入任何系统,不清楚的博友可以先参考一下上一篇博客:http://freeloda.blog.51cto.com/2033581/1320090。下面我们就来具体演示一下!)


2.导入CentOS 5.5镜像

(1).选择CentOS 5.5镜像

2013-11-11_153115

(2).选择 “使用ISO映像文件”

2013-11-11_153133

(3).选择 “CentOS-5.5-x86_64-bin-DVD-1of2.iso”,并确定。

2013-11-11_153145

(4).挂载镜像

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
[root@node2 ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@node2 ~]# cd /mnt/
[root@node2 mnt]# ls
CentOS  RELEASE-NOTES-cs    RELEASE-NOTES-en_US    RELEASE-NOTES-ja     RELEASE-NOTES-ro
EULA   RELEASE-NOTES-cs.html RELEASE-NOTES-en_US.html RELEASE-NOTES-ja.html   RELEASE-NOTES-ro.html
GPL    RELEASE-NOTES-de    RELEASE-NOTES-es     RELEASE-NOTES-nl     repodata
images  RELEASE-NOTES-de.html RELEASE-NOTES-es.html   RELEASE-NOTES-nl.html   RPM-GPG-KEY-beta
isolinux RELEASE-NOTES-en    RELEASE-NOTES-fr     RELEASE-NOTES-pt_BR    RPM-GPG-KEY-CentOS-5
NOTES   RELEASE-NOTES-en.html RELEASE-NOTES-fr.html   RELEASE-NOTES-pt_BR.html TRANS.TBL
(5).使用cobbler import命令导入镜像
[root@node2 mnt]# cobbler import --help
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

注,主要有以下几个参数--path 指定导入镜像的路径,--name 指定导入镜像的名称,--arch 指定导入镜像的架构(32位还是64位)。还有需要说明的是这里导入的时间相对较长大概在5-10分钟左右,请大家耐心等待。下面是具体的导入过程,

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@node2 ~]# cobbler import --path=/mnt/ --name=CentOS-5.5 --arch=x86_64
task started: 2013-11-11_154941_import
task started (id=Media import, time=Mon Nov 11 15:49:41 2013)
Found a candidate signature: breed=redhat, version=rhel5
Found a matching signature: breed=redhat, version=rhel5
Adding distros from path /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64:
creating new distro: CentOS-5.5-x86_64
trying symlink: /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64 -> /var/www/cobbler/links/CentOS-5.5-x86_64
creating new profile: CentOS-5.5-x86_64
creating new distro: CentOS-5.5-xen-x86_64
trying symlink: /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64 -> /var/www/cobbler/links/CentOS-5.5-xen-x86_64
creating new profile: CentOS-5.5-xen-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/CentOS-5.5-x86_64 for CentOS-5.5-x86_64
processing repo at : /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64
looking for /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/repodata/*comps*.xml
running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/repodata/comps.xml /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64
received on stdout: Spawning worker 0 with 3392 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
received on stderr:
starting descent into /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64 for CentOS-5.5-xen-x86_64
processing repo at : /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64
looking for /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/repodata/*comps*.xml
*** TASK COMPLETE ***

注,从上面显示信息所知,cobbler会将镜像中的拷贝到本地一份,放在/var/www/cobbler/ks_mirrors下的CentOS-5.5-x86_64目录下。同时会创建一个名字为CentOS-5.5-x86_64的一个发布版本,以及一个名字为CentOS-5.5-x86_64的profile文件。下面我们来具体查看一下,

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@node2 cobbler]# cobbler list
distros:
  CentOS-5.5-x86_64
  CentOS-5.5-xen-x86_64
profiles:
  CentOS-5.5-x86_64
  CentOS-5.5-xen-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:

(6).cobbler report 查看一下详细信息

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
[root@node2 ks_mirror]# cobbler report
distros:
==========
Name              : CentOS-5.5-x86_64
Architecture          : x86_64
TFTP Boot Files        : {}
Breed             : redhat
Comment            :
Fetchable Files        : {}
Initrd             : /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/pxeboot/initrd.img
Kernel             : /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/pxeboot/vmlinuz
Kernel Options         : {}
Kernel Options (Post Install) : {}
Kickstart Metadata       : {'tree': 'http://@@http_server@@/cblr/links/CentOS-5.5-x86_64'}
Management Classes       : []
OS Version           : rhel5
Owners             : ['admin']
Red Hat Management Key     : <<inherit>>
Red Hat Management Server   : <<inherit>>
Template Files         : {}
Name              : CentOS-5.5-xen-x86_64
Architecture          : x86_64
TFTP Boot Files        : {}
Breed             : redhat
Comment            :
Fetchable Files        : {}
Initrd             : /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/xen/initrd.img
Kernel             : /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/xen/vmlinuz
Kernel Options         : {}
Kernel Options (Post Install) : {}
Kickstart Metadata       : {'tree': 'http://@@http_server@@/cblr/links/CentOS-5.5-xen-x86_64'}
Management Classes       : []
OS Version           : rhel5
Owners             : ['admin']
Red Hat Management Key     : <<inherit>>
Red Hat Management Server   : <<inherit>>
Template Files         : {}
profiles:
==========
Name              : CentOS-5.5-x86_64
TFTP Boot Files        : {}
Comment            :
DHCP Tag            : default
Distribution          : CentOS-5.5-x86_64
Enable gPXE?          : 0
Enable PXE Menu?        : 1
Fetchable Files        : {}
Kernel Options         : {}
Kernel Options (Post Install) : {}
Kickstart           : /var/lib/cobbler/kickstarts/sample.ks
Kickstart Metadata       : {}
Management Classes       : []
Management Parameters     : <<inherit>>
Name Servers          : []
Name Servers Search Path    : []
Owners             : ['admin']
Parent Profile         :
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
Name              : CentOS-5.5-xen-x86_64
TFTP Boot Files        : {}
Comment            :
DHCP Tag            : default
Distribution          : CentOS-5.5-xen-x86_64
Enable gPXE?          : 0
Enable PXE Menu?        : 1
Fetchable Files        : {}
Kernel Options         : {}
Kernel Options (Post Install) : {}
Kickstart           : /var/lib/cobbler/kickstarts/sample.ks
Kickstart Metadata       : {}
Management Classes       : []
Management Parameters     : <<inherit>>
Name Servers          : []
Name Servers Search Path    : []
Owners             : ['admin']
Parent Profile         :
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           : xenpv
systems:
==========
repos:
==========
images:
==========
mgmtclasses:
==========
packages:
==========
files:
==========

好了,到这里我们的CentOS5.5的镜像文件就导入完成了,同样的CentOS 6.4导入方法与CentOS5.5是一样的,在下面我们会为大家具体演示。下面我们为大家演示一下,用客户端安装操作系统!


四、客户端安装操作系统

1.实验拓扑

Cobbler 拓扑

2.在VMWare中新建客户端

(1).新建虚拟机

无标题

(2).这里我们选择自定义

2013-11-11_162640

(3). 这里默认就好,选择“下一步”。

2013-11-11_162703

(4).这里选择“以后安装操作系统”

2013-11-11_162723

(5).这里我们选择“CentOS 64-bit”

2013-11-11_162731

(6).这里我们设置虚拟机名称与存放位置

2013-11-11_162803

(7).这里我们设置CPU个数

2013-11-11_162813

(8).这里我们设置虚拟机的内存

2013-11-11_162819

(9).这里我们设置一下网络连接,这里我们设置的“桥接”

2013-11-11_162828

(10).这里我们选择一下I/O设备的控制器

2013-11-11_162835

(11).创建一个磁盘

2013-11-11_162840

2013-11-11_162844

(12).选择磁盘类型

2013-11-11_162851

(13).选择磁盘存放的位置

2013-11-11_162857

(14).到这里我们虚拟机就新建完成

2013-11-11_162900

(15).结果如下

2013-11-11_162913

3.具体的安装过程

(1).安装前检查

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
[root@node2 ~]# cobbler check
No configuration problems found. All systems go.
[root@node2 ~]# cobbler sync
task started: 2013-11-11_170434_sync
task started (id=Sync, time=Mon Nov 11 17:04:34 2013)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/CentOS-5.5-x86_64
removing: /var/www/cobbler/images/CentOS-5.5-xen-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/images/CentOS-5.5-x86_64
removing: /var/lib/tftpboot/images/CentOS-5.5-xen-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying files for distro: CentOS-5.5-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/CentOS-5.5-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/CentOS-5.5-x86_64/initrd.img
copying files for distro: CentOS-5.5-xen-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/xen/vmlinuz -> /var/lib/tftpboot/images/CentOS-5.5-xen-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/xen/initrd.img -> /var/lib/tftpboot/images/CentOS-5.5-xen-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: CentOS-5.5-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/CentOS-5.5-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/CentOS-5.5-x86_64/initrd.img
Writing template files for CentOS-5.5-x86_64
copying files for distro: CentOS-5.5-xen-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/xen/vmlinuz -> /var/www/cobbler/images/CentOS-5.5-xen-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5.5-x86_64/images/xen/initrd.img -> /var/www/cobbler/images/CentOS-5.5-xen-x86_64/initrd.img
Writing template files for CentOS-5.5-xen-x86_64
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: 关闭 dhcpd:[确定]
正在启动 dhcpd:[确定]
received on stderr:
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 ***

(2).查看一下启动的服务端口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@node2 mnt]# netstat -ntulp
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   1031/sshd    
tcp    0   0 127.0.0.1:25        0.0.0.0:*          LISTEN   1108/master   
tcp    0   0 127.0.0.1:6010       0.0.0.0:*          LISTEN   1143/sshd    
tcp    0   0 127.0.0.1:25151       0.0.0.0:*          LISTEN   2015/python   
tcp    0   0 :::80            :::*            LISTEN   2030/httpd   
tcp    0   0 :::22            :::*            LISTEN   1031/sshd    
tcp    0   0 ::1:25           :::*            LISTEN   1108/master   
tcp    0   0 ::1:6010          :::*            LISTEN   1143/sshd    
tcp    0   0 :::873           :::*            LISTEN   1990/xinetd   
udp    0   0 0.0.0.0:67         0.0.0.0:*                1974/dhcpd   
udp    0   0 0.0.0.0:69         0.0.0.0:*                1990/xinetd   
udp    0   0 0.0.0.0:69         0.0.0.0:*                1905/in.tftpd

(3).启动客户端(设置为网络启动)

102706426.png

102746676.png

102746724.png


(4).下面是具体安装过程

注,重新启动直接进入安装界面。

102835113.png

注,我们选择CentOS-5.5-x86_64。

102902949.png

注,我们点击 “Tab”键查看具体参数。

2013-11-12_092110

注,直接敲“回车”键进行安装。

102930536.png

注,下面是加载驱动界面。

2013-11-12_092130

注,下面是检查安装的依赖关系。

2013-11-12_092157

注,下面是进行格式化。

2013-11-12_092208

注,下面进行软件包的安装 。

103056627.png

注,下面是软件包安装完成界面。安装完成后自动重启!

103110514.png

注,安装完成重启以后进行登录界面。

2013-11-12_092635

注,输入用户名和密码,我这里的用户是root,密码为123456。

2013-11-12_092655

好了,到这里我们的CentOS 5.5就安装完成了。在下篇博客中我们为大家讲解Cobbler安装CentOS6.4以及各种问题汇总解答。最后,希望大家有所收获^_^……

大纲

一、前言

二、Cobbler 工作原理详解

三、Cobbler 常用命令汇总

四、Cobbler 各种目录说明

五、自定义Kickstart文件详解

六、Cobbler 实战案例安装CentOS6.4

注,操作系统 CentOS 6.4 x86_64,软件版本 Cobbler-2.4.0-1。(目前最新版)


一、前言

在上篇博客中我们讲解了cobbler命令的详细使用,并在最后我们详细的讲解了Cobbler安装CentOS5.5全部过程,不清楚的博友可以先参考上一篇博文(http://freeloda.blog.51cto.com/2033581/1323620),在这一篇博客中我们主要和大家总结一下上几篇博客讲解的内容,并详细讲解一下自定义Kickstart文件与Cobbler相关目录的说明,最后以一个实际案例做结尾。好了,废话不多说,下面我们先来回顾一下Cobbler工作原理。


二、Cobbler 工作原理详解

1.概述

在前几篇博客中我们和大家说了,Cobbler集众家之长支持众多有服务,我在这里简单的说一下Cobbler集成了哪些服务,

  • PXE 服务

  • DHCP服务管理

  • DNS服务管理

  • HTTP服务管理

  • TFTP服务管理

  • Kickstart服务

  • yum仓库管理

  • 电源管理

2.工作流程

(1).需要安装系统的客户端主机的网卡支持网络安装,也就是支持以PXE模式启动。如下图,

PXE模式

(2).客户端主机需要有一个IP地址来与Cobbler Server进行通信,这时网络中必须要有一个主机能自动分配IP。DHCP就是一个能为客户端主机自动分配IP地址的服务,DHCP就是安装在Cobbler Server主机上。

(3).客户端得到IP地址后,需要提供一个引导程序pxelinux.0(类似于grub) 此文件由syslinux程序提供,所以需要安装syslinux并且能加载内核及内核镜像文件(vmlinuz与initrd.img),客户端可以通过TFTP协议到TFTP Server上下载内核及内核镜像文件(vmlinuz与initrd.img),所以需要一个TFTP 服务,TFTP也是安装在Cobbler Server主机上,客户端只是知道可以用TFTP协议下载文件,但是TFTP Server的IP是那个,这个还得需要DHCP服务器指名告诉客户端那个是TFTP Server(注,所以我们在配置DHCP模板时指定next-server,同时指定了filename,这里的filename就是指定的pxelinux.0引导程序),而TFTP服务需要超级进程进行管理,此进程是xinetd,因此需要在Cobbler Server上安装xinet服务。下面是DHCP模板的部分内容,

1
2
3
4
5
6
7
8
9
10
[root@node2 ~]# vim /etc/cobbler/dhcp.conf
subnet 192.168.18.0 netmask 255.255.255.0 {
   option routers       192.168.18.254; 
   option domain-name-servers 192.168.18.254; 
   option subnet-mask     255.255.255.0; 
   range dynamic-bootp    192.168.18.221 192.168.18.225; 
   filename          "/pxelinux.0"; #指定的网络引导程序 
   default-lease-time     21600; 
   max-lease-time       43200; 
   next-server        $next_server; #指定的TFTP服务器的地址

(4).客户端完全自动化部署操作系统,则需要一个kickstart文件,默认使用的是/var/lib/cobbler/kickstarts/default.ks文件,我们也可以自己自定义一个kickstart文件,自定义kickstart文件可以自己手动的编写,也可以用system-config-kickstart工具进行生成,如果需要则可以在Cobbler Server上安装system-config-kickstart工具生成一个kickstart文件。

(5).已经有了kickstart文件,需要在kickstart文件中指定一个参数,告诉客户端以什么方式安装(http/ftp/nfs等),这里的参数指的就是到哪里去找安装源(安装源就是指安装系统所需的软件),这样的方式可以是nfs,ftp,http等,选择其一即可,Cobbler Server在此选择以http方式提供安装源。

3.Cobbler 所依赖的软件包

注,上述流程可以得到Cobbler安装软件所需的主要的依赖性包。

dhcp 提供IP地址、指名TFTP Server的地址、指定pxelinux文件 tftp-server 提供引导所需的文件、内核文件、内核镜像文件等 xinetd 管理tftp服务的超级进程 syslinux 提供pxelinux文件 system-config-kickstart 生成kickstart文件 httpd 提供安装源 cman 提供电源管理 其它依赖包

好了,刚才我们重新整理一下Cobbler的工作原理,希望可以帮助大家理解。下面我们来看一下Cobbler的常用命令!


三、Cobbler 常用命令汇总

1.导入镜像文件

命令:cobbler import --path=镜像路径 -- name=安装引导名 --arch=32位或64位

参数:

  • path 是镜像所挂载的目录

  • name 是导入到cobbler里面显示的名字

  • arch 是32位系统还是64位系统

2.导入kickstart文件

命令:cobbler profile add --name=list名 --distro=镜像 --kickstart=路径

参数:

  • name是表示添加的ks 的名字,用cobbler report可以看到这个名字

  • distro 是用哪个镜像,list的distros里面选择一个,需要版本相对应

  • kickstart 是具体的 ks 文件路径

3.同步DHCP、HTTPD

命令:cobbler sync

注,每次修改完dhcp.template之类的配置文件需要执行一次使其生效。

4.查看Cobbler列表

命令:cobbler list

注,列出Cobbler所有的元素。

5.删除相关列表

命令:cobbler distro/profile remove --name=要删除的引导文件名

  • 删除指定 distro , 也就是镜像

  • 删除指定的 profile 文件,也就是 ks


四、Cobbler 各种目录说明(注,这里只介绍重点的文件或目录 )

1.cobbler配置文件目录/etc/cobbler

1
2
3
4
5
6
[root@node2 cobbler]# ls /etc/cobbler/
auth.conf    cobblerd.service    dnsmasq.template    mongodb.conf  rsync.exclude    users.conf 
cheetah_macros  cobbler_web.conf    import_rsync_whitelist named.template rsync.template   users.digest 
cobbler_bash   completions       iso           power      secondary.template version 
cobbler.conf   dhcp.template      ldap          pxe       settings      zone.template 
cobblerd_rotate distro_signatures.json modules.conf      reporting    tftpd.template   zone_templates
  • /etc/cobbler/settings cobbler主配置文件

  • /etc/cobbler/iso/ iso模板配置文件

  • /etc/cobbler/pxe pxe模板文件

  • /etc/cobbler/power 电源的配置文件

  • /etc/cobbler/users.conf Web 服务授权配置文件

  • /etc/cobbler/users.digest 用于web访问的用户名密码配置文件

  • /etc/cobbler/dhcp.template DHCP服务的配置模板

  • /etc/cobbler/dnsmasq.template DNS服务的配置模板

  • /etc/cobbler/tftpd.template tftp服务的配置模板

  • /etc/cobbler/modules.conf Cobbler模块配置文件

2.cobbler数据目录/var/lib/cobbler

1
2
3
4
5
6
7
[root@node2 cobbler]# ls /var/lib/cobbler/
config distro_signatures.json kickstarts loaders lock scripts snippets triggers web.ss
[root@node2 config]# ls
distros.d files.d images.d mgmtclasses.d packages.d profiles.d repos.d systems.d
[root@node2 loaders]# ls
COPYING.elilo   COPYING.yaboot grub-x86_64.efi menu.c32  README 
COPYING.syslinux elilo-ia64.efi grub-x86.efi   pxelinux.0 yaboot
  • /var/lib/cobbler/config/ 用于存放distros、systems、profiles等信息配置文件

  • /var/lib/cobbler/triggers 用于存放用户定义的cobbler 命令

  • /var/lib/cobbler/kickstarts/ 默认存放kickstart文件

  • /var/lib/cobbler/loaders 存放的各种引导程序

3.镜像数据目录/var/www/cobbler

1
2
[root@node2 cobbler]# ls
aux images ks_mirror links localmirror pub rendered repo_mirror svc
  • /var/www/cobbler/ks_mirror/ 导入的发行版系统的所有数据

  • /var/www/cobbler/images/ 导入发行版的Kernel和initrd镜像用于远程网络启动

  • /var/www/cobbler/repo_mirror/ yum仓库存储目录

4.日志目录 /var/log/cobbler/

1
2
3
4
5
[root@node2 cobbler]# ls
anamon cobbler.log install.log kicklog syslog tasks
[root@node2 cobbler]# cat install.log
profile  CentOS-5.5-x86_64  192.168.18.222  start  1384219313.49 
profile  CentOS-5.5-x86_64  192.168.18.222  stop  1384219512.05
  • /var/log/cobbler/install.log 客户端的安装系统日志

  • /var/log/cobbler/cobbler.log cobbler日志


五、自定义Kickstart文件详解

1.默认的Kickstart文件

1
2
3
4
5
[root@node2 kickstarts]# cd /var/lib/cobbler/kickstarts/
[root@node2 kickstarts]# ls 
default.ks  legacy.ks      sample_end.ks  sample_esxi5.ks sample.seed 
esxi4-ks.cfg pxerescue.ks     sample_esx4.ks  sample.ks 
esxi5-ks.cfg sample_autoyast.xml sample_esxi4.ks sample_old.seed

注,一般sample.ks与sample_end.ks用的比较多,下面我们来查看一下。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@node2 ~]# cobbler report
#上面部分内容省略
profiles:
==========
Name              : CentOS-5.5-x86_64
TFTP Boot Files        : {}
Comment            : 
DHCP Tag            : default
Distribution          : CentOS-5.5-x86_64
Enable gPXE?          : 0
Enable PXE Menu?        : 1
Fetchable Files        : {}
Kernel Options         : {}
Kernel Options (Post Install) : {}
Kickstart           : /var/lib/cobbler/kickstarts/sample.ks

注,大家可以看到我们导入的CentOS5.5的镜像默认使用的kickstarts文件是sample.ks ,下面我们来具体看一下sample.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
[root@node2 ~]# cat /var/lib/cobbler/kickstarts/sample.ks
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5 #用户登录认证
# System bootloader configuration
bootloader --location=mbr #mbr引导
# Partition clearing information
clearpart --all --initlabel #默认清除所以分区
# Use text mode install
text #默认以文本模式安装
# Firewall configuration
firewall --enabled #防火墙默认开启
# Run the Setup Agent on first boot
firstboot --disable #禁用启动代理
# System keyboard
keyboard us #默认英文键盘
# System language
lang en_US #默认语言英文
# Use network installation
url --url=$tree #网络安装路径
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza #默认的yum仓库
# Network information
$SNIPPET('network_config') 
# Reboot after installation
reboot #安装完成后重启
#Root password
rootpw --iscrypted $default_password_crypted #密码是我们/etc/cobbler/settings设置密码
# SELinux configuration
selinux --disabled #默认关闭selinux
# Do not configure the X Window System
skipx #默认没有安装图形界面 
# System timezone
timezone America/New_York #默认时区是美国/纽约
# Install OS instead of upgrade
install #定义的是安装系统而不是升级系统
# Clear the Master Boot Record
zerombr #默认清空所有的mbr
# Allow anaconda to partition the system as needed
autopart #默认自动分区
#下面就是Cobbler自定执行的一些脚本,我就不解释了。
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%packages
$SNIPPET('func_install_if_enabled')
$SNIPPET('puppet_install_if_enabled')
%post
$SNIPPET('log_ks_post')
# Start yum configuration 
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('puppet_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps

注,大家可以看到默认的Kickstart文件,有许多地方并不符合我们的安装需求,如:默认时区不符合、分区不符合等。所以,我们得自定义Kickstart文件。

2.自定义Kickstart文件

一般两种方案:

  • 手动的修改已有的Kickstart文件

  • 用system-config-kickstart工具生成Kickstart文件

(1).手动的修改已有的Kickstart文件

注,手动修改已存在的Kickstart文件,其中有两个地方有Kickstart文件。一个在root家目录下的anaconda-ks.cfg文件,另一个就是我们默认的/var/lib/cobbler/kickstarts/sample.ks文件。其中anaconda-ks.cfg文件中有我们需要的时区信息、分区信息等,而sample.ks文件有我们需要的其它信息。我们可以手动修改一下,整理出我们需要的Kickstart文件。好了,下面我们就来手动的修改一下。

注,查看默认的 anaconda-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
[root@node2 ~]# cat anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
cdrom
lang zh_CN.UTF-8
keyboard us
network --onboot no --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$rLcXd8hdqBw35VJ4$xMY155kcD1IULRuOW5AllU48obFbIgp11OBg72nPAE575mo8oC9Eqo8tGzJgtM2HkrDSciAGVUtCMXTjiIdaG.
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Asia/Shanghai
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 --none
#part /boot --fstype=ext4 --size=200
#part / --fstype=ext4 --size=10000
#part /data --fstype=ext4 --size=5000
#part swap --size=1000
repo --name="CentOS" --baseurl=cdrom:sr0 --cost=100
%packages
@chinese-support
@core
@development
@server-policy

注,查看默认的/var/lib/cobbler/kickstarts/sample.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
[root@node2 ~]# cat /var/lib/cobbler/kickstarts/sample.ks
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --enabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
$SNIPPET('network_config')
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone America/New_York
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
autopart
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%packages
$SNIPPET('func_install_if_enabled')
$SNIPPET('puppet_install_if_enabled')
%post
$SNIPPET('log_ks_post')
# Start yum configuration 
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('puppet_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps

注,修改后的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
69
70
71
72
73
74
75
76
[root@node2 ~]# cd /var/lib/cobbler/kickstarts/
[root@node2 kickstarts]# cp sample.ks centos.ks
[root@node2 kickstarts]# cat centos.ks
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --service=ssh #开启动防火墙但开放ssh服务
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=$tree 
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
$SNIPPET('network_config')
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone --utc Asia/Shanghai #时区修改为亚洲/上海
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
#下面定义的是默认分区,这个分区大小可以自己定义,单位为MB。由于我这里是虚拟机只有20的硬盘空间,所以我是这样划分的/boot 200MB、/ 10G 、/data 5G、swap 1G。
part /boot --fstype=ext4 --size=200
part / --fstype=ext4 --size=10000
part /data --fstype=ext4 --size=5000
part swap --size=1000
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%packages #这里增加了默认安装的软件包,包括对中文的支持与开发组件。
$SNIPPET('func_install_if_enabled')
$SNIPPET('puppet_install_if_enabled')
@chinese-support
@core
@development
%post
$SNIPPET('log_ks_post')
# Start yum configuration 
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('puppet_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps

好了,到这里我们的手动修改Kickstart文件就全部讲解完成了,下面我们来说一下怎么用system-config-kickstart工具生成Kickstart文件。

(2).用system-config-kickstart工具生成Kickstart文件

注,首先我们得用yum安装一下system-config-kickstart工具。

1
[root@node2 ~]# yum install -y system-config-kickstart

注,下面我们就来具体演示一下怎么生成Kickstart文件。

1
[root@node2 ~]# system-config-kickstart

2013-11-13_112430

注,修改相关选项,设置时区、设置根口令、选择“安装后重新引导系统”。

171519552.png

注,选择“执行新安装”、安装方法选择“http”设置相关参数。

2013-11-13_113103

注,这里选择“清除主引导记录”、“删除所有现在分区”、“不要初始化磁盘标签”、设置分区。

2013-11-13_113316

注,配置网络信息,增加eth0设置为DHCP获得。

2013-11-13_113342

注,验证这里全部默认不需要修改。

2013-11-13_113357

注,设置防火墙与SELinux为禁用状态。

2013-11-13_113406

注,显示配置我这里安装了图形环境,你可以根据需要设置是否安装。首次引导设置代理“禁用”。

2013-11-13_113424

注,软件包这边我选择了“开发工具”,其它都没有选择其实就是默认安装。

2013-11-13_113452

注,语言支持这边我们选择是“中文支持”。

2013-11-13_113502

注,预安装脚本与安装后脚本可以根据需求自定义配置。

2013-11-13_113539

2013-11-13_113542

注,先预览一下我们的配置的Kickstart文件,发现在没有问题我们保存一下就好。

2013-11-13_113817

注,发现在没有问题了,我们保存一下。

2013-11-13_113842

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
[root@node2 ~]# ls
anaconda-ks.cfg install.log install.log.syslog ks.cfg
[root@node2 ~]# cat ks.cfg 
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://192.168.18.202/cobbler/ks_mirror/CentOS-5.5-x86_64/"
# Root password
rootpw --iscrypted $1$lNz9giZK$b.1VPUVpxYkCYd/Su.E5r1
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone --isUtc Asia/Shanghai
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part /boot --fstype="ext4" --size=256
part / --fstype="ext4" --size=10000
part /data --fstype="ext4" --size=5000
part swap --fstype="swap" --size=1000
%packages
@chinese-support
@development
git
-ibus-table-cangjie
-ibus-table-erbi
-ibus-table-wubi
%end

好了,到这里我们的自定义Kickstart文件就全部讲解完成了,下面我们来说一下怎么将自定义的Kickstart文件与导入的镜像文件相关联。

3.将自定义的Kickstart文件与导入的镜像文件相关联

(1).查看一下导入的镜像文件

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@node2 ~]# cobbler list
distros:
  CentOS-5.5-x86_64
  CentOS-5.5-xen-x86_64
profiles:
  CentOS-5.5-x86_64
  CentOS-5.5-xen-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:

注,大家可以看到我们导入的是CentOS5.5镜像,下面我们再来查看一下此镜像对就的Kickstart文件。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@node2 ~]# cobbler report
注,上面一些内容省略。
profiles:
==========
Name              : CentOS-5.5-x86_64
TFTP Boot Files        : {}
Comment            : 
DHCP Tag            : default
Distribution          : CentOS-5.5-x86_64
Enable gPXE?          : 0
Enable PXE Menu?        : 1
Fetchable Files        : {}
Kernel Options         : {}
Kernel Options (Post Install) : {}
Kickstart           : /var/lib/cobbler/kickstarts/sample.ks 
Kickstart Metadata       : {}
Management Classes       : []
Management Parameters     : <<inherit>>
Name Servers          : []
Name Servers Search Path    : []
Owners             : ['admin']
……

注,大家可以看到现在默认的Kickstart文件是sample.ks,现在我就来修改一下设置Kickstart文件文件为我们手动修改的Kickstart文件。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@node2 ~]# cobbler profile edit --name=CentOS-5.5-x86_64 --distro=CentOS-5.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos.ks
[root@node2 ~]# cobbler report
注,上面一些内容省略。
profiles:
==========
Name              : CentOS-5.5-x86_64
TFTP Boot Files        : {}
Comment            : 
DHCP Tag            : default
Distribution          : CentOS-5.5-x86_64
Enable gPXE?          : 0
Enable PXE Menu?        : 1
Fetchable Files        : {}
Kernel Options         : {}
Kernel Options (Post Install) : {}
Kickstart           : /var/lib/cobbler/kickstarts/centos.ks
……

好了,大家可以看到现在使用的Kickstart文件是我们自定义的Kickstart文件了,客户端再安装系统就会使用的我们定义Kickstart文件去执行。到这里我们的自定义Kickstart文件就全部讲解完成,最后我们来讲解一个案例来结束我们本篇博客。


六、Cobbler 实战案例安装CentOS6.4

1.实验拓扑

Cobbler 拓扑

2.安装yum源

1
2
3
4
5
[root@node2 ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.N9dqlP: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...        ########################################### [100%]
  1:epel-release      ########################################### [100%]

3.同步系统时间

1
2
3
4
[root@node2 ~]# yum install -y ntp
[root@node2 ~]# ntpdate 202.120.2.101
13 Nov 15:14:52 ntpdate[1174]: step time server 202.120.2.101 offset -28799.776629 sec
[root@node2 ~]# hwclock -w

4.安装Cobbler基础包

1
[root@node2 ~]# yum install -y cobbler tftp dhcp httpd cman pykickstart debmirror

5.安装Cobbler依赖包

1
[root@node2 ~]# yum install -y ed patch perl perl-Compress-Zlib perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl

6.将所有服务加入开机自启动

1
2
3
4
[root@node2 ~]# chkconfig httpd on
[root@node2 ~]# chkconfig dhcpd on
[root@node2 ~]# chkconfig xinetd on
[root@node2 ~]# chkconfig cobblerd on

7.修改httpd配置文件并启动httpd

1
2
3
4
5
6
[root@node2 ~]# vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
[root@node2 ~]# service httpd start
正在启动 httpd:                      [确定]
[root@node2 ~]# netstat -ntulp | grep :80
tcp    0   0 :::80            :::*            LISTEN   1525/httpd

8.启动Cobbler服务并执行检查命令

1
2
3
4
5
6
7
8
9
10
11
12
[root@node2 ~]# service cobblerd start
Starting cobbler daemon:                  [确定]
[root@node2 ~]# 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 : 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.
4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
5 : comment out 'dists' on /etc/debmirror.conf for proper debian support
6 : comment out 'arches' on /etc/debmirror.conf for proper debian support
7 : 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
Restart cobblerd and then run 'cobbler sync' to apply changes.

9.解决上述相关配置错误

(1).错误1,修改/etc/cobbler/settings 里面的 server 为Cobbler Server的IP地址 ;

1
2
[root@node2 ~]# vim /etc/cobbler/settings
server: 192.168.18.202

(2).错误2,修改/etc/cobbler/settings 里面的 next_serverw 为本机的 ip;

1
2
[root@node2 ~]# vim /etc/cobbler/settings
next_server: 192.168.18.202

(3).错误3,据说这个错误可以忽略,有强迫完美运行症的人士可以运行以下命令来解决;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@node2 ~]# cobbler get-loaders
task started: 2013-11-04_143149_get_loaders
task started (id=Download Bootloader Content, time=Mon Nov 4 14:31:49 2013)
downloading http://www.cobblerd.org/loaders/README to /var/lib/cobbler/loaders/README
downloading http://www.cobblerd.org/loaders/COPYING.elilo to/var/lib/cobbler/loaders/COPYING.elilo
downloading http://www.cobblerd.org/loaders/COPYING.yaboot to/var/lib/cobbler/loaders/COPYING.yaboot
downloading http://www.cobblerd.org/loaders/COPYING.syslinux to/var/lib/cobbler/loaders/COPYING.syslinux
downloading http://www.cobblerd.org/loaders/elilo-3.8-ia64.efi to/var/lib/cobbler/loaders/elilo-ia64.efi
downloading http://www.cobblerd.org/loaders/yaboot-1.3.14-12 to/var/lib/cobbler/loaders/yaboot
downloading http://www.cobblerd.org/loaders/pxelinux.0-3.61 to/var/lib/cobbler/loaders/pxelinux.0
downloading http://www.cobblerd.org/loaders/menu.c32-3.61 to /var/lib/cobbler/loaders/menu.c32
downloading http://www.cobblerd.org/loaders/grub-0.97-x86.efi to/var/lib/cobbler/loaders/grub-x86.efi
downloading http://www.cobblerd.org/loaders/grub-0.97-x86_64.efi to/var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

(4).错误4,修改/etc/xinetd.d/tftp 把'disable' 修改为'no';修改/etc/xinetd.d/rsync 把'disable' 修改为'no';

1
2
3
4
[root@node2 ~]# vim /etc/xinetd.d/tftp
disable     = no
[root@node2 ~]# vim /etc/xinetd.d/rsync
disable = no

注,启动xinetd服务。

1
2
[root@node2 ~]# service xinetd start
正在启动 xinetd:           [确定]

(5).错误5与错误6,debmmirror有错误;

1
2
3
4
[root@node2 ~]# vim /etc/debmirror.conf
#注释掉@dists="sid"与@arches="i386即可
#@dists="sid";
#@arches="i386";

(6).错误7,设置默认root密码;

注,刚接触Cobbler的博友会问,这个密码是什么密码。有的博友系统安装好了会问,root密码是什么。这里设置的就是客户端安装好系统的root密码。

注,生成你想要的密码的加密字符串,然后复制运行命令之后的加密代码;

1
2
[root@node2 ~]# openssl passwd -1 -salt 'hahaha' '123456'
$1$hahaha$hSxFjZSHRoiEn4DYrrGUI.

注,然后替换/etc/cobbler/settings 中选项双引号中的加密代码;

1
2
[root@node2 ~]# vim /etc/cobbler/settings
default_password_crypted: "$1$hahaha$hSxFjZSHRoiEn4DYrrGUI."

10.重新启动Cobbler并运行检查命令

1
2
3
4
5
6
7
[root@node2 ~]# service cobblerd restart
Stopping cobbler daemon:         [确定]
Starting cobbler daemon:         [确定]
[root@node2 ~]# cobbler check
The following are potential configuration items that you may want to fix:
1 : service dhcpd is not running
Restart cobblerd and then run 'cobbler sync' to apply changes.

11.修改DHCP模板

1
2
3
4
5
6
7
8
9
10
[root@node2 ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.18.0 netmask 255.255.255.0 {
   option routers       192.168.18.254;
   option domain-name-servers 192.168.18.254;
   option subnet-mask     255.255.255.0;
   range dynamic-bootp    192.168.18.221 192.168.18.225;
   filename          "/pxelinux.0";
   default-lease-time     21600;
   max-lease-time       43200;
   next-server        $next_server;

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
36
37
38
39
40
41
42
43
[root@node2 ~]# cobbler sync
task started: 2013-11-13_153610_sync
task started (id=Sync, time=Wed Nov 13 15:36:10 2013)
running pre-sync triggers
cleaning trees
mkdir: /var/lib/tftpboot/pxelinux.cfg
mkdir: /var/lib/tftpboot/grub
mkdir: /var/lib/tftpboot/s390x
mkdir: /var/lib/tftpboot/ppc
mkdir: /var/lib/tftpboot/etc
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_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.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: 正在启动 dhcpd:[确定]
received on stderr:
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@node2 ~]# cobbler check
No configuration problems found. All systems go.

好了,到这里我们Cobbler安装就全部完成了,最后我们来重新启动一下xinetd并查看一下启动的端口。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@node2 ~]# service xinetd restart
停止 xinetd:                       [确定]
正在启动 xinetd:
                              [确定]
[root@node2 ~]# netstat -ntulp
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   1010/sshd    
tcp    0   0 127.0.0.1:25        0.0.0.0:*          LISTEN   1087/master   
tcp    0   0 127.0.0.1:6010       0.0.0.0:*          LISTEN   1125/sshd    
tcp    0   0 127.0.0.1:6011       0.0.0.0:*          LISTEN   1478/sshd    
tcp    0   0 127.0.0.1:25151       0.0.0.0:*          LISTEN   1643/python   
tcp    0   0 :::80            :::*            LISTEN   1525/httpd   
tcp    0   0 :::22            :::*            LISTEN   1010/sshd    
tcp    0   0 ::1:25           :::*            LISTEN   1087/master   
tcp    0   0 ::1:6010          :::*            LISTEN   1125/sshd    
tcp    0   0 ::1:6011          :::*            LISTEN   1478/sshd    
tcp    0   0 :::873           :::*            LISTEN   1777/xinetd   
udp    0   0 0.0.0.0:67         0.0.0.0:*                1715/dhcpd   
udp    0   0 0.0.0.0:69         0.0.0.0:*                1777/xinetd   
udp    0   0 0.0.0.0:69         0.0.0.0:*                1618/in.tftpd

13.导入CentOS6.4镜像文件

2013-11-13_153949

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@node2 ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@node2 ~]# cd /mnt/
[root@node2 mnt]# ls
CentOS_BuildTag GPL    Packages         RPM-GPG-KEY-CentOS-6      RPM-GPG-KEY-CentOS-Testing-6
EFI       images  RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Debug-6   TRANS.TBL
EULA       isolinux repodata         RPM-GPG-KEY-CentOS-Security-6
[root@node2 ~]# cobbler import --path=/mnt/ --name=CentOS-6.4 --arch=x86_64
task started: 2013-11-13_154155_import
task started (id=Media import, time=Wed Nov 13 15:41:55 2013)
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64:
creating new distro: CentOS-6.4-x86_64
trying symlink: /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64 -> /var/www/cobbler/links/CentOS-6.4-x86_64
creating new profile: CentOS-6.4-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/CentOS-6.4-x86_64 for CentOS-6.4-x86_64
processing repo at : /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64
looking for /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/repodata/*comps*.xml
running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/repodata/2727fcb43fbe4c1a3588992af8c19e4d97167aee2f6088959221fc285cab6f72-c6-x86_64-comps.xml /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64
received on stdout: Spawning worker 0 with 3955 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
received on stderr:
*** TASK COMPLETE ***
[root@node2 ~]# cobbler list
distros:
  CentOS-6.4-x86_64
profiles:
  CentOS-6.4-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:

14.查看一下导入镜像的详细信息

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
[root@node2 ~]# cobbler report
distros:
==========
Name              : CentOS-6.4-x86_64
Architecture          : x86_64
TFTP Boot Files        : {}
Breed             : redhat
Comment            : 
Fetchable Files        : {}
Initrd             : /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/initrd.img
Kernel             : /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/vmlinuz
Kernel Options         : {}
Kernel Options (Post Install) : {}
Kickstart Metadata       : {'tree': 'http://@@http_server@@/cblr/links/CentOS-6.4-x86_64'}
Management Classes       : []
OS Version           : rhel6
Owners             : ['admin']
Red Hat Management Key     : <<inherit>>
Red Hat Management Server   : <<inherit>>
Template Files         : {}
profiles:
==========
Name              : CentOS-6.4-x86_64
TFTP Boot Files        : {}
Comment            : 
DHCP Tag            : default
Distribution          : CentOS-6.4-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         : 
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
systems:
==========
repos:
==========
images:
==========
mgmtclasses:
==========
packages:
==========
files:
==========

15.自定义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
69
70
71
72
73
74
75
76
77
78
[root@node2 ~]# cd /var/lib/cobbler/kickstarts/
[root@node2 kickstarts]# cp sample_end.ks centos6.ks
[root@node2 kickstarts]# vim centos6.ks
# kickstart template for Fedora 8 and later.
# (includes %end blocks)
# do not use with earlier distros
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --service=ssh
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
$SNIPPET('network_config')
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone --utc Asia/Shanghai
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
part /boot --fstype=ext4 --size=200
part / --fstype=ext4 --size=10000
part /data --fstype=ext4 --size=5000
part swap --size=1000
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
@chinese-support
@development
$SNIPPET('func_install_if_enabled')
%end
%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end

16.将自定义的kickstart文件与镜像相关联

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@node2 ~]# cobbler profile edit --name=CentOS-6.4-x86_64 --distro=CentOS-6.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6.ks
[root@node2 ~]# cobbler report
注,上面部分省略。
profiles:
==========
Name              : CentOS-6.4-x86_64
TFTP Boot Files        : {}
Comment            : 
DHCP Tag            : default
Distribution          : CentOS-6.4-x86_64
Enable gPXE?          : 0
Enable PXE Menu?        : 1
Fetchable Files        : {}
Kernel Options         : {}
Kernel Options (Post Install) : {}
Kickstart           : /var/lib/cobbler/kickstarts/centos6.ks

17.同步一下

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@node2 ~]# cobbler sync
task started: 2013-11-13_163907_sync
task started (id=Sync, time=Wed Nov 13 16:39:07 2013)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/CentOS-6.4-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/images/CentOS-6.4-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying files for distro: CentOS-6.4-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/CentOS-6.4-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/CentOS-6.4-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: CentOS-6.4-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/CentOS-6.4-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/CentOS-6.4-x86_64/initrd.img
Writing template files for CentOS-6.4-x86_64
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: 关闭 dhcpd:[确定]
正在启动 dhcpd:[确定]
received on stderr:
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 ***

18.新建客户端虚拟机

2013-11-13_164148

19.启动客户端并进行系统安装

(1).选择 “CentOS-6.4-x86_64”进行安装。

2013-11-13_164519

(2).选择后直接回车进行安装。

172123214.png

(3).开始安装初始化

172150387.png

(4).安装相关软件包

2013-11-13_164713

(5).软件包安装完成,大概过1分钟后进行重启

2013-11-13_165246

(6).重新启动虚拟机客户端

2013-11-13_165403

2013-11-13_1654122013-11-13_165426

(8).进入登录界面

2013-11-13_165437

20.下面我们对客户端安装系统进行登录测试并查看

(1).输入用户名root与密码123456进行登录测试

2013-11-13_170105

(2).查看自定义的分区与时区

2013-11-13_170231

好了,到这里我们Linux运维自化工具之Cobbler工具就全部讲解完成了,最后希望大家有所收获吧!^_^……


[size=0.76em]Cobbler 更简单:Web 界面

[size=0.76em]您可能希望轻松地可视化 Cobbler 对象,并为每天的重复任务重用对象值。Cobbler 提供了一个很有用的 Web 界面,您可以通过该界面实现此目的。要使用这个界面,首先需要安装它的程序包:

yum -y install cobbler-web

[size=0.76em]安装该程序包后,配置 Cobbler 授权和身份验证系统,以便您可以登录。配置位于文件 /etc/cobbler/modules.conf 中,类似于清单 9 中的代码:


清单 9. 默认的 Cobbler 授权和身份验证系统配置
# authentication:# what users can log into the WebUI and Read-Write XMLRPC?# choices:#    authn_denyall    -- no one (default)#    authn_configfile -- use /etc/cobbler/users.digest (for basic setups)#    authn_passthru   -- ask Apache to handle it (used for kerberos)#    authn_ldap       -- authenticate against LDAP#    authn_spacewalk  -- ask Spacewalk/Satellite (experimental)#    authn_pam        -- use PAM facilities#    authn_testing    -- username/password is always testing/testing (debug)#    (user supplied)  -- you may write your own module# WARNING: this is a security setting,  do not choose an option blindly.# for more information:# https://github.com/cobbler/cobbler/wiki/Cobbler-web-interface#https://github.com/cobbler/cobbler/wiki/Security-overview# https://github.com/cobbler/cobbler/wiki/Kerberos#https://github.com/cobbler/cobbler/wiki/Ldap[authentication]module = authn_denyall# authorization:# once a user has been cleared by the WebUI/XMLRPC, what can they do?# choices:#    authz_allowall   -- full access for all authneticated users (default)#    authz_ownership  -- use users.conf, but add object ownership semantics#    (user supplied)  -- you may write your own module# WARNING: this is a security setting  do not choose an option blindly.# If you want to further restrict cobbler with ACLs for various groups,# pick authz_ownership.  authz_allowall does not support ACLs.  configfile# does but does not support object ownership which is useful as an additional# layer of control.# for more information:#https://github.com/cobbler/cobbler/wiki/Cobbler-web-interface#https://github.com/cobbler/cobbler/wiki/Security-overview# https://github.com/cobbler/cobbler/wiki/Web-authorization[authorization]module = authz_allowall

[size=0.76em]清单 9 中的帮助注释表明,可使用 LDAP、PAM 和配置文件等身份验证选项。因为 PAM 非常常见,所以使用它执行身份验证。在授权一节中,定义哪些用户拥有使用该工具的官方许可。将 module 值设置为 authz_ownership,以便您可在 users.conf 文件中指定谁能够访问 Web 界面。配置类似于清单 10 中的代码:


清单 10. Cobbler Web 界面的身份验证和授权配置
[authentication]module = authn_pam[authorization]module = authz_ownership

[size=0.76em]保存该文件。接下来,您需要一个名为 myuser 的系统用户(如果没有,可使用 useradd myuser && passwd myuser 创建)。然后,打开文件 /etc/cobbler/users.conf 并将 myuser 添加到 admins 组(这个组拥有对象的完整访问权),如清单 11 所示:


清单 11. 将 myuser 添加到授权文件中的 admins 组
# Cobbler WebUI / Web Services authorization config file## NOTICE:# this file is only used when /etc/cobbler/modules.conf# specifies an authorization mode of either:##   (A) authz_configfile#   (B) authz_ownership## For (A), any user in this file, in any group, are allowed# full access to any object in cobbler configuration.## For (B), users in the "admins" group are allowed full access# to any object, otherwise users can only edit an object if# their username/group is listed as an owner of that object. If a# user is not listed in this file they will have no access.##     cobbler command line example:##     cobbler system edit --name=server1 --owner=dbas,mac,pete,jack## NOTE:  yes, you do need the equal sign after the names.# don't remove that part.  It's reserved for future use.[admins]myuser = ""

[size=0.76em]配置已完成。现在,重新启动 Cobbler 和 Apache 服务以应用更改:

service cobblerd restartservice httpd restart

[size=0.76em]Web 界面很简单(参见图 2):左侧的菜单显示了配置类(比如存储库、系统、发行版和配置文件)、资源(用于配置管理)和操作(导入、同步)。单击一个配置类,就会在屏幕右侧列出所有对象。可通过每一项旁边的按钮(Edit、Copy、Rename、Delete)应用列表过滤器和执行不同操作。


图 2. Cobbler Web 界面





=========================================================================================================================================http://blog.csdn.net/liangliangdetianxia/article/details/37605787 

前言:这篇文章是系统运维www.osyunwei.com的作品,我只是根据实践了一下,出于对原作者的尊重附原文链接如下:

原文链接http://www.osyunwei.com/archives/7606.html

根据文章的说明是可以完成所属功能的,不过原文章有点小问题,在本文中我已经修改过了,仅供大家参考,有问题大家交流,E-mail:lianglianghelloworld@yahoo.com

安装之前的一点说明

Cobbler服务器系统:CentOS5.10 64位

IP地址:192.168.21.128

需要安装部署的Linux系统:

eth0(第一块网卡,用于外网)IP地址段:192.168.21.160-192.168.21.200

eth1(第二块网卡,用于内网)IP地址段:10.0.0.160-10.0.0.200

子网掩码:255.255.255.0

网关:192.168.21.2

DNS:8.8.8.8 8.8.4.4

所有服务器均支持PXE网络启动

实现目的:通过配置Cobbler服务器,全自动批量安装部署Linux系统

 

具体操作步骤如下:

第一部分:在Cobbler服务器上操作

一、关闭SELINUX

vi /etc/selinux/config

#SELINUX=enforcing #注释掉

#SELINUXTYPE=targeted #注释掉

SELINUX=disabled #增加

:wq!  #保存退出

setenforce 0 #使配置立即生效

二、配置防火墙

开启TCP:80端口、TCP:25151端口、UDP:69端口

vi /etc/sysconfig/iptables  #编辑

-A RH-Firewall-1-INPUT -m state --state NEW-m tcp -p tcp --dport 80 -j ACCEPT  #http服务需要此端口

-A RH-Firewall-1-INPUT -m state --state NEW-m udp -p udp --dport 69 -j ACCEPT  #tftp服务需要此端口

-A RH-Firewall-1-INPUT -m state --state NEW-m tcp -p tcp --dport 25151 -j ACCEPT  #cobbler需要此端口

:wq!  #保存退出

/etc/init.d/iptables restart #最后重启防火墙使配置生效

三、安装Cobbler

cd /usr/local/src

wgethttp://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm  #CentOS5.x 64位

rpm -ivh  epel-release-5-4.noarch.rpm#企业版 Linux 附加软件包(以下简称 EPEL)

备注:

wgethttp://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm  #CentOS5.x 32位

wgethttp://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm  #CentOS6.x64位

wgethttp://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm  #CentOS6.x32位

yum  install cobbler tftp tftp-serverxinetd  dhcp  httpd  rsync  #安装cobbler

yum  install  pykickstart debmirror  python-ctypes   cman   #安装运行cobbler需要的软件包

四、配置Cobbler

1、设置http服务

vi /etc/httpd/conf.d/wsgi.conf

LoadModule wsgi_modulemodules/mod_wsgi.so  #取消前面的注释

:wq! #保存退出

chkconfig httpd on  #设置开机启动

service httpd start #启动

2、设置tftp服务开机启动

vi  /etc/cobbler/tftpd.template  #编辑

service tftp

{

disable =no #修改为no

socket_type= dgram

protocol= udp

wait= yes

user= root

server= /usr/sbin/in.tftpd

server_args = -B 1380 -v -s /tftpboot

per_source= 11

cps= 100 2

flags = IPv4

}

:wq! #保存退出

3、设置rsync服务开机启动

vi /etc/xinetd.d/rsync  #编辑配置文件,设置开机启动rsync

service rsync

{

disable = no   #修改为no

socket_type= stream

wait= no

user= root

server= /usr/bin/rsync

server_args= --daemon

log_on_failure+= USERID

}

:wq! #保存退出

/etc/init.d/xinetd start  #启动(CentOS中是以xinetd 来管理Rsync和tftp服务的)

4、配置cobbler相关参数

vi /etc/debmirror.conf  #注释掉 @dists 和 @arches 两行

#@dists="sid";

#@arches="i386";

:wq! #保存退出

openssl passwd -1 -salt 'osyunwei' '123456'  #生成默认模板下系统安装完成之后root账号登录密码

$1$osyunwei$sEV8iwXXuR4CqzLXyLnzm0  #记录下这行,下面会用到

vi /etc/cobbler/settings  #编辑,修改

default_password_crypted:"$1$osyunwei$sEV8iwXXuR4CqzLXyLnzm0"

next_server: 192.168.21.128

server: 192.168.21.128

manage_dhcp: 1

default_kickstart:/var/lib/cobbler/kickstarts/default.ks

:wq! #保存退出

系统运维  www.osyunwei.com  温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接

5、配置dhcp服务器

vi /etc/cobbler/dhcp.template #编辑,修改

subnet 192.168.21.0 netmask 255.255.255.0{ #设置网段

option routers 192.168.21.2; #设置网关

option domain-name-servers 8.8.8.8,8.8.4.4; #设置dns服务器地址

option subnet-mask 255.255.255.0; #设置子网掩码

range dynamic-bootp 192.168.21.160192.168.21.200;  #设置dhcp服务器IP地址租用的范围

default-lease-time 21600;  #默认租约时间

max-lease-time 43200;  #最大租约时间

next-server $next_server;

class "pxeclients" {

match if substring (optionvendor-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";

}

}

}

:wq! #保存退出

vi /etc/sysconfig/dhcpd   #指定DHCP服务的网络接口

DHCPDARGS=eth0

:wq!  #保存退出

dhcpd  #测试dhcp服务器配置是否正确

chkconfig dhcpd on   #设置开机启动

chkconfig cobblerd on   #设置开机启动

cobbler get-loaders  #安装cobbler相关工具包,否则检查cobbler配置会报错

service cobblerd start  #启动cobbler

cobbler sync  #同步配置文件到dhcp服务器

service dhcpd start    #启动dhcp服务

6、设置cobbler相关服务启动脚本

vi /etc/rc.d/init.d/cobbler #编辑,添加以下代码

#!/bin/sh

# chkconfig: - 80 90

# description:cobbler

case $1 in

start)

/etc/init.d/httpd start

/etc/init.d/xinetd start

/etc/init.d/dhcpd start

/etc/init.d/cobblerd start

;;

stop)

/etc/init.d/httpd stop

/etc/init.d/xinetd stop

/etc/init.d/dhcpd stop

/etc/init.d/cobblerd stop

;;

restart)

/etc/init.d/httpd restart

/etc/init.d/xinetd restart

/etc/init.d/dhcpd restart

/etc/init.d/cobblerd restart

;;

status)

/etc/init.d/httpd status

/etc/init.d/xinetd status

/etc/init.d/dhcpd status

/etc/init.d/cobblerd status

;;

sync)

cobbler sync

;;

*)

echo "Input error,please in put'start|stop|restart|status|sync'!";

exit 2>&1 >/dev/null &

;;

esac

:wq! #保存退出

chmod +x /etc/rc.d/init.d/cobbler  #添加脚本执行权限

chkconfig cobbler on  #添加开机启动

service cobbler  restart  #重启cobbler

cobbler  check  #检查cobbler配置,出现下面的提示,SELinux和防火墙前面已经设置过了,不用理会

The following are potential configurationitems that you may want to fix:

1 : SELinux is enabled. Please review thefollowing wiki page for details on ensuring cobbler works correctly in your SELinuxenvironment:

https://github.com/cobbler/cobbler/wiki/Selinux

2 : since iptables may be running, ensure69, 80/443, and 25151 are unblocked

Restart cobblerd and then run 'cobblersync' to apply changes

=====================================================================================

五、挂载系统安装镜像到http服务器站点目录

上传系统安装镜像文件CentOS-5.10-x86_64-bin-DVD-1of2.iso到/usr/local/src/目录

mkdir -p/var/www/html/os/CentOS-5.10-x86_64  #创建挂载目录

mount -t iso9660 -o loop/usr/local/src/CentOS-5.10-x86_64-bin-DVD-1of2.iso /var/www/html/os/CentOS-5.10-x86_64 #挂载系统镜像

vi /etc/fstab #添加以下代码。实现开机自动挂载

/usr/local/src/CentOS-5.10-x86_64-bin-DVD-1of2.iso  /var/www/html/os/CentOS-5.10-x86_64 iso9660 defaults,ro,loop  0 0

:wq! #保存退出

备注:iso9660使用df  -T查看设备卸载:umount  /var/www/html/os/CentOS-5.10-x86_64

重复上面的操作,把自己需要安装的CentOS系统镜像文件都挂载到/var/www/html/os/目录下

例如:

CentOS-5.10-x86_64-bin-DVD-1of2.iso

CentOS-6.5-x86_64-bin-DVD1.iso

六、创建kickstarts自动安装脚本

cd /var/lib/cobbler/kickstarts  #进入默认Kickstart模板目录

vi/var/lib/cobbler/kickstarts/CentOS-5.10-x86_64.ks  #创建CentOS-5.10-x86_64安装脚本

# Kickstart file automatically generated byanaconda.

install

url--url=http://192.168.21.128/cobbler/ks_mirror/CentOS-5.10-x86_64/

lang en_US.UTF-8

zerombr  yes

key --skip

keyboard us

network --device eth0 --bootprotodhcp  --onboot on

#network --device eth0 --bootproto static--ip 192.168.21.250 --netmask 255.255.255.0 --gateway 192.168.21.2 --nameserver8.8.8.8 --hostname CentOS5.10

rootpw --iscrypted$1$QqobZZ1g$rYnrawi9kYlEeUuq1vcRS/

firewall --enabled --port=22:tcp

authconfig --enableshadow --enablemd5

selinux --disabled

timezone Asia/Shanghai

bootloader --location=mbr --driveorder=sda

# The following is the partitioninformation you requested

# Note that any partitions you deleted arenot expressed

# here so unless you clear all partitionsfirst, this is

# not guaranteed to work

#clearpart --linux

clearpart --all --initlabel

part / --bytes-per-inode=4096--fstype="ext3" --size=2048

part /boot --bytes-per-inode=4096--fstype="ext3" --size=128

part swap --bytes-per-inode=4096--fstype="swap" --size=500

part /data --bytes-per-inode=4096--fstype="ext3" --grow --size=1

reboot

%packages

ntp

@base

@core

@dialup

@editors

@text-internet

keyutils

trousers

fipscheck

device-mapper-multipath

%post

#同步系统时间

ntpdate cn.pool.ntp.org

hwclock --systohc

echo -e "0 1 * * * root/usr/sbin/ntpdate cn.pool.ntp.org > /dev/null"  >>/etc/crontab

service crond restart

#添加用户组

groupadd maintain

groupadd develop

mkdir -p /home/maintain

mkdir -p /home/develop

#添加用户

useradd -g maintain  user01  -d/home/maintain/user01 -m

echo "123456"|passwd user01--stdin

useradd -g maintain user02  -d/home/maintain/user02 -m

echo "123456"|passwd user02--stdin

useradd -g maintain user03  -d/home/maintain/user03 -m

echo "123456"|passwd user03--stdin

useradd -g maintain user04  -d/home/maintain/user04 -m

echo "123456"|passwd user04--stdin

#禁止root用户直接登录系统

sed -i "s/#PermitRootLoginyes/PermitRootLogin no/g" '/etc/ssh/sshd_config'

service sshd restart

#禁止开机启动的服务

chkconfig acpid off

chkconfig atd off

chkconfig autofs off

chkconfig bluetooth off

chkconfig cpuspeed off

chkconfig firstboot off

chkconfig gpm off

chkconfig haldaemon off

chkconfig hidd off

chkconfig ip6tables off

chkconfig isdn off

chkconfig messagebus off

chkconfig nfslock off

chkconfig pcscd off

chkconfig portmap off

chkconfig rpcgssd off

chkconfig rpcidmapd off

chkconfig yum-updatesd off

chkconfig sendmail off

#允许开机启动的服务

chkconfig crond on

chkconfig kudzu on

chkconfig network on

chkconfig readahead_early on

chkconfig sshd on

chkconfig syslog on

#禁止使用Ctrl+Alt+Del快捷键重启服务器

sed -i"s/ca::ctrlaltdel:\/sbin\/shutdown -t3 -rnow/#ca::ctrlaltdel:\/sbin\/shutdown -t3 -r now/g" '/etc/inittab'

telinit q

#优化系统内核

echo -e "ulimit -cunlimited"  >> /etc/profile

echo -e "ulimit -sunlimited"  >> /etc/profile

echo -e "ulimit -SHn 65535" >> /etc/profile

source  /etc/profile

sed -i "s/net.ipv4.ip_forward =0/net.ipv4.ip_forward = 1/g" '/etc/sysctl.conf'

echo -e "net.core.somaxconn =262144"  >> /etc/sysctl.conf

echo -e "net.core.netdev_max_backlog =262144"  >> /etc/sysctl.conf

echo -e "net.core.wmem_default =8388608"  >> /etc/sysctl.conf

echo -e "net.core.rmem_default =8388608"  >> /etc/sysctl.conf

echo -e "net.core.rmem_max =16777216"  >> /etc/sysctl.conf

echo -e "net.core.wmem_max =16777216"  >> /etc/sysctl.conf

echo -e"net.ipv4.netfilter.ip_conntrack_max = 131072"  >> /etc/sysctl.conf

echo -e"net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180" >> /etc/sysctl.conf

echo -e "net.ipv4.route.gc_timeout =20"  >> /etc/sysctl.conf

echo -e "net.ipv4.ip_conntrack_max =819200"  >> /etc/sysctl.conf

echo -e "net.ipv4.ip_local_port_range= 10024  65535"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_retries2 =5"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_fin_timeout =30"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_syn_retries =1"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_synack_retries =1"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_timestamps =0"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_tw_recycle =1"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_tw_len =1"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_tw_reuse =1"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_keepalive_time =120"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_keepalive_probes= 3"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_keepalive_intvl= 15"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_max_tw_buckets =36000"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_max_orphans =3276800"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_max_syn_backlog= 262144"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_wmem = 8192131072 16777216"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_rmem = 32768131072 16777216"  >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_mem = 94500000915000000 927000000"  >> /etc/sysctl.conf

/sbin/sysctl -p

#执行外部脚本

cd /root

wgethttp://192.168.21.128/cobbler/ks_mirror/config/autoip.sh

sh /root/autoip.sh

:wq! #保存退出

vi/var/www/cobbler/ks_mirror/config/autoip.sh  #创建脚本,自动设置Linux系统静态IP地址、DNS、网关、计算机名称

#!/bin/sh

ROUTE=$(route -n|grep"^0.0.0.0"|awk '{print $2}')

BROADCAST=$(/sbin/ifconfig eth0|grep -ibcast|awk '{print $3}'|awk -F":" '{print $2}')

HWADDR=$(/sbin/ifconfig eth0|grep -iHWaddr|awk '{print $5}')

IPADDR=$(/sbin/ifconfig eth0|grep"inet addr"|awk '{print $2}'|awk -F":" '{print $2}')

NETMASK=$(/sbin/ifconfig eth0|grep"inet addr"|awk '{print $4}'|awk -F":" '{print $2}')

cat >/etc/sysconfig/network-scripts/ifcfg-eth0<<EOF

DEVICE=eth0

BOOTPROTO=static

BROADCAST=$BROADCAST

HWADDR=$HWADDR

IPADDR=$IPADDR

NETMASK=$NETMASK

GATEWAY=$ROUTE

ONBOOT=yes

EOF

IPADDR1=$(echo $IPADDR|awk -F"."'{print $4}')

cat>/etc/sysconfig/network-scripts/ifcfg-eth1<<EOF

DEVICE=eth1

BOOTPROTO=static

BROADCAST=10.0.0.255

HWADDR=$(/sbin/ifconfig eth1|grep -iHWaddr|awk '{print $5}')

IPADDR=10.0.0.$IPADDR1

NETMASK=255.255.255.0

ONBOOT=yes

EOF

HOSTNAME=OsYunWei_HZ_$(echo $IPADDR|awk-F"." '{print $4}')

cat >/etc/sysconfig/network<<EOF

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=$HOSTNAME

GATEWAY=$ROUTE

EOF

echo "127.0.0.1  $HOSTNAME">> /etc/hosts

hostname=$HOSTNAME

echo "nameserver 8.8.8.8"  > /etc/resolv.conf

echo "nameserver  8.8.4.4">> /etc/resolv.conf

:wq!  #保存退出

七、导入系统镜像到cobbler

cobbler import--path=/var/www/html/os/CentOS-5.10-x86_64 --name=CentOS-5.10-x86_64  --arch=x86_64  #导入系统镜像文件,需要一段时间

cd /var/www/cobbler/ks_mirror  #进入系统镜像导入目录

命令格式:cobbler import --path=镜像路径 -- name=安装引导名 --arch=32位或64位

重复上面的操作,把其他的系统镜像文件导入到cobbler

八、设置profile

按照操作系统版本分别关联系统镜像文件和kickstart自动安装文件

在第一次导入系统镜像时,cobbler会给安装镜像指定一个默认的kickstart自动安装文件

例如:CentOS-5.10-x86_64版本的kickstart自动安装文件为:/var/lib/cobbler/kickstarts/sample.ks

cobbler profile report --name CentOS-5.10-x86_64  #查看profile设置

cobbler distro report --nameCentOS-5.10-x86_64 #查看安装镜像文件信息

cobbler profile remove--name=CentOS-5.10-x86_64  #移除profile

cobbler profile add--name=CentOS-5.10-x86_64 --distro=CentOS-5.10-x86_64--kickstart=/var/lib/cobbler/kickstarts/CentOS-5.10-x86_64.ks  #添加

cobbler profile edit--name=CentOS-5.10-x86_64 --distro=CentOS-5.10-x86_64--kickstart=/var/lib/cobbler/kickstarts/CentOS-5.10-x86_64.ks  #编辑

命令:cobbler profile add|edit|remove --name=安装引导名 --distro=系统镜像名 --kickstart=kickstart自动安装文件路径

--name:自定义的安装引导名,注意不能重复

--distro:系统安装镜像名,用cobblerdistro list可以查看

--kickstart:与系统镜像文件相关联的kickstart自动安装文件

#查看Cobbler列表

cobbler list

cobbler report

cobbler profile report

cobbler distro list

#通过profile查找对应的kickstart自动安装文件文件

例如:

ksfile=$( cobbler profile report --name CentOS-5.10-x86_64|grep -E '^Kickstart' |head -n 1|cut -d ':' -f 2 );cat$ksfile;

重复上面的操作,把其他的系统镜像文件和kickstart自动安装文件关联起来

注意:

1、kickstart自动安装文件需要预先配置好

2、每次修改完配置文件,需要执行一次同步操作:cobbler sync 配置才能生效

3、kickstart自动安装文件可以用工具生成(需要用到图形界面操作)

yum  install system-config-kickstart #安装

yum groupinstall "X WindowSystem" #安装X Window图形界面

system-config-kickstart #运行kickstart配置

service  cobbler  sync  #与cobbler sync作用相同

service  cobbler  restart  #重启cobbler

第二部分:设置要安装的服务器从网络启动

一、  裸机安装

开机之后,如下图所示,根据需要选择相应的系统版本进行安装,安装完成之后,系统会自动重启





一、  重新安装系统:


在需要重装系统的服务器上安装koan

wget http://dl.fedoraproject.org/pub/epel/5/x86_64/koan-2.4.4-1.el5.noarch.rpm  #CentOS5.X

rpm -ivh koan-2.4.0-1.el5.noarch.rpm  #安装koan

http://dl.fedoraproject.org/pub/epel/6/x86_64/koan-2.4.0-1.el6.noarch.rpm  #CentOS6.X

yum  install  cobbler debmirror  pykickstart  python-ctypes  cman   #安装koan运行依赖包(需要设置epel源)

koan --list=profiles --server=192.168.21.128  #查看Cobbler服务器系统镜像列表

koan --replace-self --server=192.168.21.128--profile=CentOS-5.10-x86_64  #选择要重装的系统

reboot #重新启动系统进行自动安装

二、  扩展阅读:

Cobbler目录说明:

1、Cobbler配置文件目录:/etc/cobbler

/etc/cobbler/settings   #cobbler主配置文件

/etc/cobbler/dhcp.template   #DHCP服务的配置模板

/etc/cobbler/tftpd.template   #tftp服务的配置模板

/etc/cobbler/rsync.template   #rsync服务的配置模板

/etc/cobbler/iso   #iso模板配置文件

/etc/cobbler/pxe   #pxe模板文件

/etc/cobbler/power  #电源的配置文件

/etc/cobbler/users.conf   #Web服务授权配置文件

/etc/cobbler/users.digest   #用于web访问的用户名密码配置文件

/etc/cobbler/dnsmasq.template   #DNS服务的配置模板

/etc/cobbler/modules.conf   #Cobbler模块配置文件

2、Cobbler数据目录:/var/lib/cobbler

/var/lib/cobbler/config #配置文件

/var/lib/cobbler/triggers  #Cobbler命令

/var/lib/cobbler/kickstarts  #默认存放kickstart文件

/var/lib/cobbler/loaders  #存放的各种引导程序

3、系统安装镜像目录:/var/www/cobbler

/var/www/cobbler/ks_mirror #导入的系统镜像列表

/var/www/cobbler/images  #导入的系统镜像启动文件

/var/www/cobbler/repo_mirror #yum源存储目录

4、日志目录:/var/log/cobbler

/var/log/cobbler/install.log  #客户端系统安装日志

/var/log/cobbler/cobbler.log  #cobbler日志

至此,Cobbler全自动批量安装部署Linux系统完成。

 

在安装过程当中会有各种惊人的问题,我遇到的问题已经记录在我的博客中,建议遇到问题的时候去搜索吧,这样快一点。

文中不再使用原作者的图片,请原作者谅解,用我自己的图片也说明我是一步一步脚踏实地的按照原作者的文章来做事可以成功的嘛,欢迎大家批评指正。

阅读(3577) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~