> CentOS > CentOS教程 >

centos6.5安装cobbler

1.安装脚本
#yum -y install wget
#wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#rpm -ivh epel-release-6-8.noarch.rpm
#/etc/cobbler/dhcp.template
yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes python-simplejson -y
sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp 
sed -i -e 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync
sed -i -e 's/#ServerName www.example.com:80/ServerName 192.168.1.231:80/g' /etc/httpd/conf/httpd.conf
chkconfig ip6tables off 
chkconfig iptables off
/etc/init.d/ip6tables stop 
/etc/init.d/iptables stop
sed -i 's/next_server: 127.0.0.1/next_server: 192.168.1.231/g' /etc/cobbler/settings
sed -i 's/bind_master: 127.0.0.1/bind_server: 192.168.1.231/g' /etc/cobbler/settings
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0
service httpd restart
/etc/init.d/cobblerd restart
/etc/init.d/xinetd restart
cobbler get-loaders
mount -o loop /dev/cdrom /mnt/c6.5/
cobbler import --path=/mnt/c6.5/ --name=centos-server-6.5-i386
cobbler distro list
/var/www/cobbler/ks_mirror/
cobbler profile edit --name=centos6.5 --distro=centos-server-6.5-i386 --kickstart=/var/lib/cobbler/kickstarts/c6.ks
cobbler sync


dhcp配置
subnet 192.168.1.0 netmask 255.255.255.0 { 
     option routers             192.168.1.1; 
     option domain-name-servers 202.106.0.20; 
     option subnet-mask         255.255.255.0; 
     range dynamic-bootp        192.168.1.10 192.168.1.50; 
     filename                   "/pxelinux.0"; 
     default-lease-time         21600; 
     max-lease-time             43200; 
     next-server                $next_server; 


service network restart


2.c6.ks
#platform=x86, AMD64, or Intel EM64T 
# System authorization information 
auth  --useshadow  --enablemd5 
# System bootloader configuration 
bootloader --location=mbr
# Use text mode install 
lang zh_CN.UTF-8 
#langsupport zh_CN.UTF-8 en_US --default=en_US
keyboard us 
#mouse generic3ps/2 
timezone Asia/Shanghai 
install 
url --url=http://192.168.1.231/cobbler/ks_mirror/centos-server-6.5-i386
text 
#zerombr yes 
# Partition clearing information 
#clearpart --all
clearpart --all --initlabel 
#Partition clearing information 
part /boot --fstype ext4 --size=100
part swap --size=2048
part pv.01 --size=1 --grow
volgroup vg_root pv.01
logvol / --fstype=ext4 --name=lv_root --vgname=vg_root --size=20480
network --bootproto static --device eth0 --ip 192.168.1.45 --netmask 255.255.255.0 --gateway=192.168.1.1 --noipv6 --hostname cobbler#network --bootproto=dhcp --device=eth0 --onboot=on
firewall --disabled 
selinux --disabled 
skipx 
# Network information 
#--- Reboot the host after installation is done   
reboot 

#Root password 
rootpw 123456 

%pre 
$SNIPPET('log_ks_pre') 
$SNIPPET('kickstart_start') 
$SNIPPET('pre_install_network_config') 
%packages 
@base 
@core 
%post 
$SNIPPET('log_ks_post') 
# Start yum configuration  
$yum_config_stanza 
# End yum configuration 
$SNIPPET('post_install_kernel_options') 
#$SNIPPET('post_install_network_config') 
echo "NETWORKING=yes" >/etc/sysconfig/network 
echo "NETWORKING_IPV6=no" >>/etc/sysconfig/network 
echo "HOSTNAME=cobbler" >>/etc/sysconfig/network 
echo "nameserver  192.168.1.1" >/etc/resolv.conf 
echo "nameserver  202.106.0.20" >>/etc/resolv.conf 
for service in `chkconfig --list|awk '{print $1}'|egrep -v "^$"|awk -F ":" '{print $1}'`; do chkconfig $service off;done 
for service in crond  sshd syslog network; do chkconfig $service on;done 
ulimit -HSn 65535 
# Start final steps 
$SNIPPET('kickstart_done') 
# End final steps
#wget http://192.168.1.231/lamp 可以把脚本放这里
#sh lamp
(责任编辑:IT)