利用Cobbler批量快速网络安装CentOS(3)
时间:2014-11-29 15:15 来源:www.it.net.cn 作者:IT网
13.为导入的CentOS5.6镜像文件使用新的配置文件
-
[root@server1 ~]# cobbler profile edit --name=centos5.6-i386 --distro=centos5.6-i386 --kickstart=/var/lib/cobbler/kickstarts/centos5.6-i386.ks
/var/lib/cobbler/kickstarts/centos5.6-i386.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 zh_CN.UTF-8
-
-
# 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 Asia/Shanghai
-
-
# Install OS instead of upgrade
-
install
-
-
# Clear the Master Boot Record
-
zerombr
-
-
# Allow anaconda to partition the system as needed
-
# autopart
-
-
#NO LVM 这里的分区没有配置LVM
-
part /boot --bytes-per-inode=4096--fstype="ext3"--size=200
-
part swap --bytes-per-inode=4096--fstype="swap"--size=800
-
part / --bytes-per-inode=4096--fstype="ext3"--size=5000
-
part /data --bytes-per-inode=4096--fstype="ext3" --grow --size=1
-
-
#LVM Setting 这的分区有配置LVM
-
#part /boot --bytes-per-inode=4096--fstype="ext3"--size=200
-
#part swap --bytes-per-inode=4096--fstype="swap"--size=800
-
#part pv.01 --size=1 --grow
-
#volgroup myvg pv.01
-
#logvol / --vgname=myvg--size=5000--name=rootvol--bytes-per-inode=4096--fstype="ext3"
-
#logvol /data --vgname=myvg--size=1 --grow --name=datavol--bytes-per-inode=4096--fstype="ext3"
-
-
# network configure
-
network --bootproto=dhcp--device=eth0 --noipv6 --onboot=on --hostname=test.com
-
# network --bootproto=static--device=eth1--ip=192.168.1.2 --netmask=255.255.255.0 --gateway=192.168.1.1 --noipv6 --onboot=on
-
-
%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')
-
@base
-
@editors
-
@development-libs
-
@development-tools
-
@x-software-development
-
@system-tools
-
@text-internet
-
@chinese-support
-
imake
-
expect
-
-
%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
-
-
%post
-
echo "ulimit -SHn 102400" >> /etc/rc.local
-
-
sed -i 's/HISTSIZE\=1000/HISTSIZE\=50/' /etc/profile
-
sed -i "s/ca::ctrlaltdel:\/sbin\/shutdown -t3 -r now/#ca::ctrlaltdel:\/sbin\/shutdown -t3 -r now/" /etc/inittab
-
sed -i '48,50 s/^/#/' /etc/inittab
-
/sbin/init q
-
-
sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
-
-
cat >> /root/.vimrc <<EOF
-
syntax on
-
set number
-
set autoindent
-
set shiftwidth=4
-
set encoding=utf-8 fileencodings=ucs-bom,utf-8,cp936
-
EOF
-
-
sed -i -e '74 s/^/#/' -i -e '76 s/^/#/' /etc/ssh/sshd_config
-
sed -i "s/#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config
-
sed -i -e '44 s/^/#/' -i -e '48 s/^/#/' /etc/ssh/sshd_config
-
-
for i in `ls /etc/rc3.d/S*`
-
do
-
CURSRV=`echo $i|cut -c 15-`
-
echo $CURSRV
-
case $CURSRV in
-
crond | irqbalance | microcode_ctl | network | random | sshd | syslog | local )
-
echo "Base services, Skip!"
-
;;
-
*)
-
echo "change $CURSRV to off"
-
chkconfig --level 235 $CURSRV off
-
service $CURSRV stop
-
;;
-
esac
-
done
-
-
true > /etc/sysctl.conf
-
cat >> /etc/sysctl.conf <<EOF
-
kernel.sysrq = 0
-
kernel.core_uses_pid = 1
-
kernel.msgmnb = 65536
-
kernel.msgmax = 65536
-
kernel.shmmax = 68719476736
-
kernel.shmall = 4294967296
-
-
net.core.wmem_default = 8388608
-
net.core.rmem_default = 8388608
-
net.core.rmem_max = 16777216
-
net.core.wmem_max = 16777216
-
net.core.netdev_max_backlog = 262144
-
net.core.somaxconn = 262144
-
-
net.ipv4.ip_forward = 0
-
net.ipv4.conf.default.rp_filter = 1
-
net.ipv4.conf.default.accept_source_route = 0
-
net.ipv4.tcp_syncookies = 1
-
net.ipv4.tcp_max_tw_buckets = 6000
-
net.ipv4.tcp_sack = 1
-
net.ipv4.tcp_window_scaling = 1
-
net.ipv4.tcp_rmem = 4096 87380 4194304
-
net.ipv4.tcp_wmem = 4096 16384 4194304
-
net.ipv4.tcp_max_orphans = 3276800
-
net.ipv4.tcp_max_syn_backlog = 262144
-
net.ipv4.tcp_timestamps = 0
-
net.ipv4.tcp_synack_retries = 1
-
net.ipv4.tcp_syn_retries = 1
-
net.ipv4.tcp_tw_recycle = 1
-
net.ipv4.tcp_tw_reuse = 1
-
net.ipv4.tcp_mem = 94500000 915000000 927000000
-
net.ipv4.tcp_fin_timeout = 1
-
net.ipv4.tcp_keepalive_time = 1200
-
net.ipv4.ip_local_port_range = 1024 65535
-
EOF
-
/sbin/sysctl -p
修改完成后,重启cobblerd,然后cobbler sync做一次同步,再次新建虚拟机测试。
14.错误收集:
[root@server1 ~]# service dhcpd start
启动 dhcpd: [失败]
查看/var/log/message 看到启动dhcp的过程中发现以下错误,
Dec 9 06:19:23 server1 dhcpd: ** You must add a global ddns-update-style statement to /etc/dhcpd.conf.
Dec 9 06:19:23 server1 dhcpd: To get the same behaviour as in 3.0b2pl11 and previous
Dec 9 06:19:23 server1 dhcpd: versions, add a line that says "ddns-update-style ad-hoc;"
Dec 9 06:19:23 server1 dhcpd: Please read the dhcpd.conf manual page for more information. **
主要原因是:
文件/etc/cobbler/settings里面
manage_dhcp: 0 没有修改为1 造成的
修改为1之后,
重启cobblerd,然后做一次 cobbler sync(cobbler会把dhcp.template里面的内容复制到了/etc/dhcpd.conf),就会自动的把dhcpd启动起来.
(责任编辑:IT)
13.为导入的CentOS5.6镜像文件使用新的配置文件
/var/lib/cobbler/kickstarts/centos5.6-i386.ks 内容如下,红色部分为修改或者添加的:
修改完成后,重启cobblerd,然后cobbler sync做一次同步,再次新建虚拟机测试。
14.错误收集:
[root@server1 ~]# service dhcpd start
启动 dhcpd: [失败]
查看/var/log/message 看到启动dhcp的过程中发现以下错误,
Dec 9 06:19:23 server1 dhcpd: ** You must add a global ddns-update-style statement to /etc/dhcpd.conf.
Dec 9 06:19:23 server1 dhcpd: To get the same behaviour as in 3.0b2pl11 and previous Dec 9 06:19:23 server1 dhcpd: versions, add a line that says "ddns-update-style ad-hoc;" Dec 9 06:19:23 server1 dhcpd: Please read the dhcpd.conf manual page for more information. **
主要原因是:
文件/etc/cobbler/settings里面
manage_dhcp: 0 没有修改为1 造成的
修改为1之后,
重启cobblerd,然后做一次 cobbler sync(cobbler会把dhcp.template里面的内容复制到了/etc/dhcpd.conf),就会自动的把dhcpd启动起来.
(责任编辑:IT) |