标签:cobbler
1、配置yum源
[root@dn1 ~]# cd /etc/yum.repos.d
[root@dn1 yum.repos.d]# vim aliyun.repo
添加如下内容:
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://mirrors.aliyun.com/epel/6/$basearch
http://mirrors.aliyuncs.com/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
2、 DHCP
[root@dn1 yum.repos.d]# yum -y install dhcp
配置dhcp
[root@dn1 ~]# cd /etc/dhcp/
[root@dn1 dhcp]# vim dhcpd.conf
subnet 192.168.239.0 netmask 255.255.255.0 {
option routers 192.168.239.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.239.10 192.168.239.254;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.239.129;
filename "pxelinux.0";
}
启动dhcp,添加自启动
[root@dn1 dhcp]# service dhcpd start
[root@dn1 dhcp]# chkconfig dhcpd on
[root@dn1 dhcp]# chkconfig --list | grep dhcpd
[root@dn1 dhcp]# ss -tulnp | grep dhcpd
3、 TFTP
yum -y install tftp-server xinetd httpd
配置tftp
[root@dn1 ~]# cd /etc/xinetd.d/
[root@dn1 xinetd.d]# vim tftp
service tftp
{
disable = no #开启tftp服务
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -B 1380 -v -s /var/lib/tftpboot #tftp服务文件存放的目录位置
per_source = 11
cps = 100 2
flags = IPv4
}
启动xinetd服务,添加自启动
[root@dn1 xinetd.d]# service xinetd start
[root@dn1 xinetd.d]# chkconfig xinetd on
[root@dn1 xinetd.d]# chkconfig --list |grep xinetd
[root@dn1 xinetd.d]# ss -tulnp| grep 69
[root@dn1 xinetd.d]# service httpd start
[root@dn1 xinetd.d]# ss -tulnp | grep 80
4,关闭selinux和iptables
[root@dn1 xinetd.d]# service iptables stop
[root@dn1 xinetd.d]# setenforce 0
[root@dn1 xinetd.d]# vim /etc/selinux/config
SELINUX=disabled
5、cobbler安装配置
1) cobbler安装
[root@dn1 xinetd.d]# yum -y install cobbler pykickstart
2) cobbler的配置
[root@dn1 ~]# cd /etc/cobbler/
[root@dn1 cobbler]# vim settings
[root@dn1 xinetd.d]# openssl passwd -1
复制密钥到配置文件里面
default_password_crypted: "$1$bfI7WLZz$PxXetL97LkScqJFxnW7KS1"
server: 192.168.239.129 dhcp服务器ip
next_server: 192.168.239.129 tftp服务器ip
3)启动cobbler
[root@dn1 cobbler]# service cobblerd start
[root@dn1 cobbler]# chkconfig cobblerd on
[root@dn1 cobbler]# cobbler check
执行完后出现下面的信息
The following are potential configuration items that you may want to fix:
1 : 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.
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
Restart cobblerd and then run ‘cobbler sync‘ to apply changes.
上面这段信息大意就是:
1,执行 cobbler get-loaders,系统将自动下载loader程序,完成提示4的修复工作。
2,提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略,如果需要安装,下载地址为:
[root@dn1 cobbler]# cobbler get-loaders
[root@dn1 cobbler]# /etc/init.d/cobblerd restart
[root@dn1 cobbler]# cobbler check
[root@dn1 cobbler]# cobbler sync
6、cobbler导入
[root@dn1 cobbler]# mount /dev/sr0 /mnt/cdrom
[root@dn1 cobbler]# vim /root/ks.cfg
[root@dn1 cobbler]# cobbler import --name=centost.t --arch=x86_64 --path=/mnt/cdrom
--kickstart=/var/lib/cobbler/kickstarts/centos-x86.cfg
centos-x86.cfg文件如下:
install
text
url --url http://192.168.239.129/cobbler/ks_mirror/centos-6.6-x86_64
lang zh_CN.UTF-8
keyboard us
network --onboot no --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$wzz4LV2oyhi0Oc/i$lZ4/7FcOy6KXf.uhcISJabk99AHaWSo9DOzMAng1qgCELaL2nLDV8iAna6dZiWahKCenWciyYc2Afnkx9JYi61
firewall --disabled
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
part /boot --fstype=ext4 --size=2000
part swap --size=2000
part / --fstype=ext4 --grow --size=200
repo --name="CentOS" --baseurl=http://192.168.239.129/cobbler/ks_mirror/centos-6.6-x86_64
%packages
@base
@chinese-support
@console-internet
@core
@debugging
@directory-client
@hardware-monitoring
@java-platform
@large-systems
@network-file-system-client
@performance
@perl-runtime
@server-platform
@server-policy
@workstation-policy
pax
oddjob
sgpio
device-mapper-persistent-data
samba-winbind
certmonger
pam_krb5
krb5-workstation
perl-DBD-SQLite
%end
标签:cobbler
原文地址:http://learnlinux.blog.51cto.com/9320044/1660963