cobber+centos6.6+esix5.5

文档http://www.3mu.me/centos6-5%E5%AE%89%E8%A3%85%E5%92%8C%E9%85%8D%E7%BD%AEcobbler-2-6%E5%AE%9E%E7%8E%B0%E8%87%AA%E5%8A%A8%E5%8C%96%E6%97%A0%E4%BA%BA%E5%80%A4%E5%AE%88%E7%BD%91%E7%BB%9C%E6%89%B9%E9%87%8F%E5%AE%89%E8%A3%85/

 

1 rpm -ivh wget  https://mirrors.ustc.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm 

2 yum -y install cobbler  httpd rsync tftp-server xinetd dhcp python-ctypes debmirror pykickstart fence-agents gcc gcc-*

3

sed -i '/disable/c disable = no' /etc/xinetd.d/tftp
sed -i -e 's/= yes/= no/g' /etc/xinetd.d/rsync
sed -i 's/next_server: 127.0.0.1/next_server: 10.5.6.170/g' /etc/cobbler/settings
sed -i 's/server: 127.0.0.1/server: 10.5.6.170/g' /etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings

4  vi /etc/httpd/conf/httpd.conf

ServerName 10.5.6.170

5

6 vim /etc/cobbler/settings

7

scp /etc/dhcp/dhcpd.conf 10.5.3.133:/etc/dhcp/

# ******************************************************************
# Cobbler managed dhcpd.conf file
# generated from cobbler dhcp.conf template (Tue Dec 6 02:37:09 2016)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
# ******************************************************************

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.5.2.0 netmask 255.255.254.0 {
option routers 10.5.3.254 ; #wangguan
option domain-name-servers 202.106.0.20;
option subnet-mask 255.255.254.0;
range dynamic-bootp 10.5.2.10 10.5.2.19;
default-lease-time 21600;
max-lease-time 43200;
next-server 10.5.3.134;
class "pxeclients" {
match if substring (option vendor-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";
}
}

}

# group for Cobbler DHCP tag: default
group {
}

 
scp dhcp.template 10.5.3.133:/etc/cobbler/

# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************

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.5.6.0 netmask 255.255.254.0 {
option routers 10.5.7.254 ; #wangguan
option domain-name-servers 202.106.0.20;
option subnet-mask 255.255.254.0;
range dynamic-bootp 10.5.6.171 10.5.6.190;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-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";
}
}

}

#for dhcp_tag in $dhcp_tags.keys():
## group could be subnet if your dhcp tags line up with your subnets
## or really any valid dhcpd.conf construct ... if you only use the
## default dhcp tag in cobbler, the group block can be deleted for a
## flat configuration
# group for Cobbler DHCP tag: $dhcp_tag
group {
#for mac in $dhcp_tags[$dhcp_tag].keys():
#set iface = $dhcp_tags[$dhcp_tag][$mac]
host $iface.name {
hardware ethernet $mac;
#if $iface.ip_address:
fixed-address $iface.ip_address;
#end if
#if $iface.hostname:
option host-name "$iface.hostname";
#end if
#if $iface.netmask:
option subnet-mask $iface.netmask;
#end if
#if $iface.gateway:
option routers $iface.gateway;
#end if
#if $iface.enable_gpxe:
if exists user-class and option user-class = "gPXE" {
filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
} else if exists user-class and option user-class = "iPXE" {
filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
} else {
filename "undionly.kpxe";
}
#else
filename "$iface.filename";
#end if
## Cobbler defaults to $next_server, but some users
## may like to use $iface.system.server for proxied setups
next-server $next_server;
## next-server $iface.next_server;
}
#end for
}
#end for

 
8 启动
service httpd start
service xinetd start
service dhcpd start
service cobblerd start
 
9 检查环境 cobbler check

10  修复: cobbler get-loaders

11  再检查 cobbler check

 12 在重启:

service httpd restart
service xinetd restart
service dhcpd restart
service cobblerd restart

13  cobbler sync

安装完成

 #####################################################################################################################################

 
 

1. 挂载ISO光盘镜像
# mount /dev/cdrom /mnt
2. 开始导入光盘镜像
# cobbler import --path=/mnt --arch=x86_64 --name=CentOS-6.6
cobbler将镜像拷贝一份放在/var/www/cobbler/ks_mirrors/CentOS-6.6-x86_64目录下

 

1 倒入镜像:

2 查看镜像 cobbler profile report  ,     cobbler list:

 

3 修改ks 文件位置:

touch /var/lib/cobbler/kickstarts/ks.cfg

cobbler profile edit --name=CentOS-6.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks.cfg 

cobbler profile edit --name=CentOS-6.6-x86_64 --kopts='net.ifnames=0 biosdevname=0'

4 编辑ks.cfg

 

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use CDROM installation media
cdrom
key --skip
# Root password qazwsx
rootpw --iscrypted $1$/IsFrAxK$BnR/s2heEiWt0RULQya9a0
# System authorization information
auth --useshadow --passalgo=md5
# 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
url --url=http://10.5.6.170/cobbler/ks_mirror/CentOS-6.6-x86_64/
# System timezone
timezone Asia/Shanghai
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part / --fstype="ext4" --size=20480
part /usr --fstype="ext4" --size=20480
part swap --fstype="swap" --size=8196
part /export1 --fstype="ext4" --size=100 --grow

%packages
@backup-client
@base


%post
# Set default language
[ -f /etc/sysconfig/i18n ] && cp /etc/sysconfig/i18n /etc/sysconfig/i18n.ksbak
cat < < EOF > /etc/sysconfig/i18n
LANG="en_US"
SUPPORTED="en_US.UTF-8:en_US:en"
SYSFONT="latarcyrheb-sun16"
EOF

## Disable ipv6
#/bin/cat >> /etc/modprobe.conf < < EOF #alias net-pf-10 off #alias ipv6 off #EOF /bin/sed -i 's/NETWORKING_IPV6.*$/NETWORKING_IPV6=no/' /etc/sysconfig/network #disable ctrl-alt-del sed -i 's/^ca/#ca/' /etc/inittab # Set default run level to 3 sed -i 's/^id:5/id:3/' /etc/inittab cat >> /etc/yum.repos.d/163.repo < < EOF [base] name=CentOS-$releasever - Base - 163.com baseurl=http://mirrors.163.com/centos/6/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6 EOF # Tune snmp settings [ -d /etc/snmp ] || mkdir /etc/snmp if [ -f /etc/snmp/snmpd.conf ]; then cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ksbak fi # stop unuseful services # nsrvs is the list for stop for i in `ls /etc/rc3.d/S*` do CURSRV=`echo $i|cut -c 15-` echo $CURSRV case $CURSRV in crond | irqbalance | network | sshd | syslog ) echo "Base services, Skip!" ;; *) echo "change $CURSRV to off" chkconfig --level 235 $CURSRV off service $CURSRV stop ;; esac done echo "kernel.core_uses_pid = 1" > /etc/sysctl.conf
echo "kernel.msgmax = 65536" >> /etc/sysctl.conf
echo "kernel.msgmnb = 65536" >> /etc/sysctl.conf
echo "kernel.shmall = 4294967296" >> /etc/sysctl.conf
echo "kernel.shmmax = 68719476736" >> /etc/sysctl.conf
echo "kernel.sysrq = 0" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.accept_source_route = 0" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.rp_filter = 1" >> /etc/sysctl.conf
echo "net.ipv4.ip_forward = 0" >> /etc/sysctl.conf
echo "net.ipv4.tcp_retrans_collapse = 0" >> /etc/sysctl.conf
echo "net.ipv4.tcp_syncookies = 1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_tw_buckets = 6000 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_sack = 1 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_window_scaling = 1 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4096 87380 4194304 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 4096 16384 4194304 " >> /etc/sysctl.conf
echo "net.core.wmem_default = 8388608 " >> /etc/sysctl.conf
echo "net.core.rmem_default = 8388608 " >> /etc/sysctl.conf
echo "net.core.rmem_max = 16777216 " >> /etc/sysctl.conf
echo "net.core.wmem_max = 16777216 " >> /etc/sysctl.conf
echo "net.core.netdev_max_backlog = 262144 " >> /etc/sysctl.conf
echo "net.core.somaxconn = 262144 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_orphans = 3276800 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_syn_backlog = 262144 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_timestamps = 0 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_synack_retries = 1 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_syn_retries = 1 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_recycle = 1 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_reuse = 1 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_mem = 94500000 915000000 927000000 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_fin_timeout = 1 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_keepalive_time = 1200 " >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65535 " >> /etc/sysctl.conf


echo "* soft nofile 65535" >> /etc/security/limits.conf
echo "* hard nofile 65535" >> /etc/security/limits.conf
echo "* soft nproc 65535" >> /etc/security/limits.conf
echo "* hard nproc 65535" >> /etc/security/limits.conf

%end

 

 

5  同步数据  cobbler sync

 

6 测试:

####################################################################################################################################################

 mount /dev/cdrom /mnt

cobbler import --path=/mnt --arch=x86_64 --name=ESXI-5.5

cobbler profile report
 
cobbler profile edit --name=ESXI-5.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/esxi5-ks.cfg
#######################################################################################
vim /var/lib/cobbler/kickstarts/esxi5-ks.cfg

# set for install esxi55
vmaccepteula
# 注意如果密码长度小于7位,安装的时候会有报错的(可惜忘记截图了)
rootpw redhat123456
clearpart --firstdisk=local --overwritevmfs
install --firstdisk=local --overwritevmfs
# 注意网卡名称为vmnic0
network --bootproto=dhcp --device=vmnic0
reboot --noeject

###########################################################################
vim  /etc/cobbler/pxe/pxeprofile_esxi.template

LABEL $profile_name
kernel $kernel_path
$menu_label
ipappend 2
append -c $img_path/cobbler-boot.cfg ks=http://10.5.6.170/cobbler/ks_mirror/esxi5-ks.cfg

##############################################################################

sed -i 's@/@@g' /var/www/cobbler/ks_mirror/ESXI-5.5-x86_64/boot.cfg 

###############################################################################
cp /var/lib/cobbler/kickstarts/esxi5-ks.cfg /var/www/cobbler/ks_mirror/
##########################################################################
service cobblerd restart
cobbler sync
################################################################################
测试
 
 

 

 

 

 

 

 

posted @ 2017-11-02 15:47  晴天下大雨  阅读(309)  评论(0编辑  收藏  举报