cobbler批量装机系统centos 6.4下安装配置

简介: 最近笔者研究cobbler批量装机系统。 cobbler装机系统是较早前kickstart的升级版,优点比较容易配置,还自带web界面比较易于管理,不足在于中文资料较少。 这里就详细的介绍下笔者亲自经历的一次安装过程。
最近笔者研究cobbler批量装机系统。
cobbler装机系统是较早前kickstart的升级版,优点比较容易配置,还自带web界面比较易于管理,不足在于中文资料较少。
这里就详细的介绍下笔者亲自经历的一次安装过程。
开始的时候笔者用的是centos 5.8系统,但是在安装cpbbler-web的时候报错,于是这次采用了centos6.4系统进行安装配置。

环境:
操作系统:CentOS 6.4

测试机器ip:10.0.0.128
先将iptables selinux 关掉。

/etc/init.d/iptables stop

chkconfig iptables off

setenforce 0

并修改配置文件/etc/sysconfig/selinux 将其disable
一、导入yum源,安装软件.

rpm -Uvh http://mirrors.hustunique.com/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum install cobbler cobbler-web

yum install dhcp httpd

chkconfig cobblerd on

chkconfig httpd on

cobbler check

二:配置环境
1> 修改cobbler 的配置文件


Vi  /etc/cobbler/settings

修改如下地方:

next_server: 10.0.0.128

server: 10.0.0.128

manage_dhcp: 1

manage_rsync: 1

生成密码串

[root@puppet ~]# openssl passwd -1 -salt "cobber" "123456"  #举个简单例子"123456"

$1$cobber$yV9XfOuaaiVDvImopK7o.1
openssl passwd -1 -salt '
任间字符' '密码'
这个命令的用法,任意字符可以随便写,这个密码就是安装完系统root的密码了。替换配置文件里的字串。
vi  /etc/cobbler/settings
default_password_crypted: "$1$cobber$yV9XfOuaaiVDvImopK7o.1"
2>
启用tfpt rsync
vim /etc/xinetd.d/tftp
vim /etc/xinetd.d/rsync
disable的值修改成no
启动服务
/etc/init.d/xinetd restart
3>
修改dhcp的配置文件

# vi /etc/cobbler/dhcp.template

ddns-update-style interim;

allow booting;

allow bootp;

ignore client-updates;

set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet 10.0.0.0 netmask 255.255.255.0 {

     option routers             10.0.0.1;

     option domain-name-servers 8.8.8.8;

     option subnet-mask         255.255.255.0;

     range dynamic-bootp        10.0.0.2 10.0.0.100;

     default-lease-time         21600;

     max-lease-time             43200;

     next-server                $next_server;

   }

 

余下默认,只修改这个模板就行,cobbler 会同步到dhcp的配置。
[root@cobbler ~]# cobbler get-loaders

task started: 2014-03-25_163306_get_loaders

task started (id=Download Bootloader Content, time=Tue Mar 25 16:33:06 2014)

path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/COPYING.yaboot already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/COPYING.syslinux already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/elilo-ia64.efi already exists, not overwriting existing content, use --force if you wish to update

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 ***

 

:配置web环境
#vi /etc/cobbler/modules.conf

module = authn_configfile /修改认证方式为密码文件类型

#htdigest /etc/cobbler/users.digest "Cobbler"cobbler/添加cobbler用户,提示输入2遍密码确认

# cobbler sync /输出*** TASK COMPLETE *** 表示配置无错误

# /etc/init.d/httpd restart

# /etc/init.d/cobblerd restart

访问web页面 https://10.0.0.128/cobbler_web /使用刚才创建的用户登录


1:添加DVD源,

[root@puppet soft]# mount /dev/cdrom /mnt/cdrom/

cobbler import --path=/mnt/cdrom --name=centos6.4

[root@cobbler ~]# cobbler import --path=/mnt/cdrom --name=centos6.4             

task started: 2014-03-25_182605_import

task started (id=Media import, time=Tue Mar 25 18:26:05 2014)

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/centos6.4:

creating new distro: centos6.4-i386

trying symlink: /var/www/cobbler/ks_mirror/centos6.4 -> /var/www/cobbler/links/centos6.4-i386

creating new profile: centos6.4-i386

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/centos6.4 for centos6.4-i386

processing repo at : /var/www/cobbler/ks_mirror/centos6.4

need to process repo/comps: /var/www/cobbler/ks_mirror/centos6.4

looking for /var/www/cobbler/ks_mirror/centos6.4/repodata/*comps*.xml

running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/centos6.4/repodata/151ad5b0a3056212a6012b429192adcabba8b37571ff12453d6a29bc5199c943-c6-i386-comps.xml /var/www/cobbler/ks_mirror/centos6.4

received on stdout: Spawning worker 0 with 3114 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 ***

 

图形界面操作点击Importer DVD (先挂载镜像ISO),然后再Importer,点击run


导入完成后可以看到

选择左侧profile配置ks文件

输入你所需要的ks文件路径

Centos6.ks文件如下,这里只是个比较简单的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 --disable

# 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

autopart

clearpart --all --drives=sda --initlabel

part /boot --fstype ext3 --size=200

part / --fstype ext3 --size=8000

part swap --size=2048

 

%pre

$SNIPPET('log_ks_pre')

$kickstart_start

$SNIPPET('pre_install_network_config')

# Enable installation monitoring

$SNIPPET('pre_anamon')

%packages

@admin-tools

@base

@chinese-support

@core

@development-libs

@development-tools

@editors

@system-tools

@text-internet

OpenIPMI-tools

hardlink

kernel-PAE

kernel-PAE-devel

kernel-devel

libpng-devel

lrzsz

minicom

net-snmp-utils

pcre-devel

sysstat

x86info

puppet

 

%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

 

 

5:客户端从网络启动后选择对应的工程文件开始自动部署


选择配置好的选项开始自动安装

完成后自动重启,可以用先前定义好的密码("123456")登陆了.

附:错误排除
# cobbler check
The following are potential configuration items that you may want to fix:
1 : Must enable a selinux boolean to enable vital web services components, run: setsebool -P httpd_can_network_connect true
2 : you need to set some SELinux content rules to ensure cobbler serves content correctly in your SELinux environment, run the following: /usr/sbin/semanage fcontext -a -t public_content_t "/tftpboot/.*" && /usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler"/images/.*
3 : you need to set some SELinux rules if you want to use cobbler-web (an optional package), run the following: /usr/sbin/semanage fcontext -a -t httpd_sys_content_rw_t "/var/lib/cobbler/webui_sessions/.*"
解决:关闭selinux
# vim /etc/sysconfig/selinux
SELINUX=disabled
4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
解决:编辑/etc/xinetd.d/tftp文件,将文件中的disable字段的配置由yes改为no
5 : change 'disable' to 'no' in /etc/xinetd.d/rsync
解决:编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no
6 : since iptables may be running, ensure 69, 80, and 25151 are unblocked
解决:在iptables中将698025151端口打开。如果仅仅只是在内部环境中使用,建议直接将防火墙关掉
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
解决:yum install debmirror
或:rpm -Uvh ftp://rpmfind.net/linux/epel/5/i386/debmirror-20090807-1.el5.noarch.rpm –nodeps –force
8 : ksvalidator was not found, install pykickstart
解决:yum install pykickstart
9 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
解决: 修改默认密码就OK了,然后把密码写入到/etc/cobbler/settings
# openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'
10 : comment 'dists' on /etc/debmirror.conf for proper debian support
11 : comment 'arches' on /etc/debmirror.conf for proper debian support
解决:注释/etc/debmirror.conf 下面两行
#@dists="sid";
@sections="main,main/debian-installer,contrib,non-free";
#@arches="i386";
12
fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
解决: yum install cman
修复完成,再用 cobbler check 检查一下,确认没问题后用 cobbler sync 做同步操作:
# cobbler check
No configuration problems found. All systems go.

13. comment out 'dists' on /etc/debmirror.conf for proper debian support

comment out 'arches' on /etc/debmirror.conf for proper debian supportvim              vi /etc/debmirror.conf

#注释掉@dists="sid"@arches="i386即可

#@dists="sid";

#@arches="i386";

14. 较验cobbler check出错

Traceback (most recent call last):

 File "/usr/bin/cobbler", line 35, in ?

 sys.exit(app.main())

 File "/usr/lib/python2.4/site-packages/cobbler/cli.py", line 558, in main

 rc = cli.run(sys.argv)

 File "/usr/lib/python2.4/site-packages/cobbler/cli.py", line 202, in run

 self.token = self.remote.login("", self.shared_secret)

 File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__

 return self.__send(self.__name, args)

 File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request

 verbose=self.__verbose

 File "/usr/lib64/python2.4/xmlrpclib.py", line 1147, in request

 return self._parse_response(h.getfile(), sock)

 File "/usr/lib64/python2.4/xmlrpclib.py", line 1286, in _parse_response

 return u.close()

 File "/usr/lib64/python2.4/xmlrpclib.py", line 744, in close

 raise Fault(**self._stack[0])

xmlrpclib.Fault:

解决方法:此为BUG,按下方操作执行即

service cobblerd restart

cobbler get-loaders


返回这个结果就OK



相关文章
|
18天前
|
Linux 虚拟化 数据安全/隐私保护
系统崩溃不用慌!VMware这个逆天功能竟能让CentOS一键回档?后悔药真实存在!
备份的重要性在于它能在系统出现异常或错误时,帮助我们快速恢复到正常状态,避免重新安装系统和配置环境。VMware 提供了两种备份方式:快照和克隆。 **快照**是保存虚拟机某一时刻的完整状态(包括内存、CPU、磁盘数据),便于快速回滚,适合临时保存状态。操作简单,可在系统运行时创建。 **克隆**则是复制整个虚拟机系统,侧重长期备份,需在系统关闭时进行。分为完整克隆和链接克隆,前者独立于源系统,占用更多空间,但更安全可靠。
51 17
系统崩溃不用慌!VMware这个逆天功能竟能让CentOS一键回档?后悔药真实存在!
|
1月前
|
Linux 应用服务中间件 nginx
CentOS系统下的软件安装与卸载
CentOS系统中安装及卸载软件,常用yum命令安装及卸载软件包。yum是基于RPM的软件包管理器,可用于在CentOS中安装、更新、查询和移除软件包。yum命令可以从指定服务器下载rpm包并安装,能自动解决依赖问题。
155 78
|
15天前
|
存储 安全 Linux
Centos 8系统ext4文件系统类型进行扩容缩容 (LVM)
通过使用这些技术和工具,可以有效管理CentOS 8系统上的存储资源,确保系统在高负载和高并发情况下的稳定运行。
34 9
|
2月前
|
Java
CentOS7.8配置Adoptium-Java17运行环境
本指南介绍如何设置清华镜像源并安装 Temurin-17-JRE 运行环境。首先,编辑 `/etc/yum.repos.d/adoptium.repo` 文件,配置清华镜像源。接着,使用 `yum install -y temurin-17-jre` 命令安装 Temurin-17-JRE,并通过 `java --version` 验证安装成功。相关配置和操作界面截图附后。
74 8
|
2月前
|
网络协议 Java 应用服务中间件
centos7环境下tomcat8的安装与配置
本文介绍了在Linux环境下安装和配置Tomcat 8的详细步骤。首先,通过无网络条件下的文件交互软件(如Xftp 6或MobaXterm)下载并解压Tomcat安装包至指定路径,启动Tomcat服务并测试访问。接着,修改Tomcat端口号以避免冲突,并部署Java Web应用项目至Tomcat服务器。最后,调整Linux防火墙规则,确保外部可以正常访问部署的应用。关键步骤包括关闭或配置防火墙、添加必要的端口规则,确保Tomcat服务稳定运行。
|
3月前
|
运维 监控 安全
CentOS 7系统 OpenSSH和OpenSSL版本升级指南
本文详细介绍如何在CentOS 7系统上升级OpenSSH和OpenSSL至最新稳定版本(OpenSSH 9.6p1和OpenSSL 1.1.1w),解决多个已知安全漏洞(如CVE-2023-51767等)。涵盖环境说明、现存漏洞、升级准备、具体步骤及故障排查,确保服务器安全。建议先在测试环境验证,再应用于生产环境。
408 7
|
5月前
|
Web App开发 搜索推荐 Unix
Linux系统之MobaXterm远程连接centos的GNOME桌面环境
【10月更文挑战第21天】Linux系统之MobaXterm远程连接centos的GNOME桌面环境
1046 5
Linux系统之MobaXterm远程连接centos的GNOME桌面环境
|
4月前
|
Linux 开发工具 Windows
CentOS8 64位系统 搭建内网穿透frp
【10月更文挑战第23天】本文介绍了如何在Linux系统上搭建frp内网穿透服务,并配置Windows客户端进行访问。首先,通过系统信息检查和软件下载,完成frp服务端的安装与配置。接着,在Windows客户端下载并配置frpc,实现通过域名访问内网地址。最后,通过创建systemd服务,实现frp服务的开机自动启动。
287 20
|
5月前
|
Linux 网络安全 数据安全/隐私保护
Linux系统之Centos7安装cockpit图形管理界面
【10月更文挑战第12天】Linux系统之Centos7安装cockpit图形管理界面
212 1
Linux系统之Centos7安装cockpit图形管理界面
|
4月前
|
存储 Linux Docker
centos系统清理docker日志文件
通过以上方法,可以有效清理和管理CentOS系统中的Docker日志文件,防止日志文件占用过多磁盘空间。选择合适的方法取决于具体的应用场景和需求,可以结合手动清理、logrotate和调整日志驱动等多种方式,确保系统的高效运行。
424 2