作者:容置 2013-04-02 9:38:21
kickstart 安装配置
安装system-config-kickstart图形界面配置命令
rpm -ivh pykickstart-0.43.9-1.el5.noarch.rpm system-config-kickstart-2.6.19.9-2.el5.noarch.rpm
安装后可以通过图形化的界面配置 ks.cfg 文件
一、配置tftp服务
1)安装软件
rpm -ivh xinetd-2.3.14-16.el5.x86_64.rpm
rpm -ivh tftp-server-0.49-2.el5.centos.x86_64.rpm
2)配置tftp服务(tftp安装后默认会建立/tftpboot/目录,做为tftp服务的根目录)
[root@hadoop-master nagios]# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
3)准备pxe启动文件
1、 cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
将 RedHat 安装光盘目录中的 '''images/pxeboot/{vmlinuz,initrd.img}''' 启动文件复制到某个安装目录,比如:'''/tftpboot/ '''
2、 cp -rf /media/images/pxeboot/* /tftpboot/
3、 mkdir /tftpboot/pxelinux.cfg/
4、 [root@hadoop-master pxelinux.cfg]# cat /tftpboot/pxelinux.cfg/default chmod 755 /tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 60
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append ks=nfs:192.168.4.60:/pxe/ks.cfg initrd=initrd.img ksdevice=link
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks=nfs:192.168.4.60:/pxe/ks.cfg initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -
二、配置DHCP服务
1)安装软件
rpm -ivh dhcp-3.0.5-31.el5.x86_64.rpm
2)配置内容如下
[root@hadoop-master nagios]# cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.4.0 netmask 255.255.255.0 {
option routers 192.168.4.1;
option subnet-mask 255.255.255.0;
# option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.4.80 192.168.4.100;
default-lease-time 3600;
max-lease-time 7200;
next-server 192.168.4.60;
filename "pxelinux.0";
}
三、配置nfs
说明 /pxe 是用来放置系统安装软件
/nagios是用来安装后的脚本安装内容
[root@hadoop-master pxe]# cat /etc/exports
/pxe *(ro,sync)
/nagios *(ro,sync)
四、将第一张安装盘中的全部内容拷贝到/pxe目录中
五、在/pxe 目录中添加ks.cfg文件,内容如下
[root@hadoop-master pxe]# cat ks.cfg
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
graphical
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.4.60 --dir=/pxe
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
#Root password
rootpw --iscrypted $1$huMQaTLL$kJTscoT.P1lnwI9TGIMHs/
# SELinux configuration
selinux --disabled
# System timezone
timezone --isUtc Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=32 --resolution=800x600
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=8192
part /tmp --bytes-per-inode=4096 --fstype="ext3" --size=4096
part /app --bytes-per-inode=4096 --fstype="ext3" --size=40960
part /var --bytes-per-inode=4096 --fstype="ext3" --size=6144
part / --asprimary --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
reboot
%packages
@base
@core
@development-libs
@development-tools
@editors
@gnome-desktop
@graphical-internet
@text-internet
@base-x
keyutils
iscsi-initiator-utils
trousers
fipscheck
device-mapper-multipath
sgpio
imake
emacs
xorg-x11-utils
xorg-x11-server-Xnest
xorg-x11-server-Xvfb
libaio-devel-0.3.106-5
libaio-devel-0.3.106-5
sysstat-7.0.2-11.el5
compat-libstdc++-33-3.2.3-61
compat-libstdc++-33-3.2.3-61
unixODBC-2.2.11-10.el5
unixODBC-libs-2.2.11-10.el5
unixODBC-devel-2.2.11-10.el5
unixODBC-libs-2.2.11-10.el5
unixODBC-2.2.11-10.el5
iotop-0.4.3-4.el5
xinetd-2.3.14-16.el5
python-ctypes-1.0.2-3.el5
libXp-1.0.0-8.1.el5
%post --interpreter=/bin/bash
(
export RH_MOUNT='/tmp/bootstrap'
mkdir -p $RH_MOUNT
groupadd -g 1001 dba
useradd -u 1001 -g dba oracle
groupadd -g 1002 monitor
useradd -u 1002 -g monitor monitor
/etc/init.d/portmap start #备注,该服务必须启动,否则无法挂载NFS共享
mount -t nfs -o ro 192.168.4.60:/nagios $RH_MOUNT
cp -rf $RH_MOUNT/* /opt
cd /opt
umount $RH_MOUNT
tar -zxvf nagios-plugins.tar.gz
cd nagios-plugins-1.4.15/
./configure --with-nagios-user=root --with-nagios-group=root
make && make install
cd /opt
tar xzf nrpe-2.13.tar.gz
cd nrpe-2.13/
./configure --with-nrpe-user=monitor --with-nrpe-group=monitor --with-nagios-user=root --with-nagios-group=root
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
cp /etc/services /etc/services.bak
echo "nrpe 5666/tcp #NRPE">>/etc/services
cat /opt/nrpe.txt >/etc/xinetd.d/nrpe
mv /usr/local/nagios/libexec/check_load /usr/local/nagios/libexec/check_load.bin
cp -rf /opt/plug/* /usr/local/nagios/libexec/
cat /opt/nrpe.cfg > /usr/local/nagios/etc/nrpe.cfg
cat /opt/ntp.ser >> /etc/ntp.conf
chkconfig --level 35 bluetooth off
chkconfig --level 35 avahi-daemon off
chkconfig --level 35 ip6tables off
chkconfig --level 35 atd off
chkconfig --level 35 cups off
chkconfig --level 345 pcscd off
chkconfig --level 345 hidd off
chkconfig --level 345 avahi-daemon off
chkconfig --level 35 microcode_ctl off
chkconfig --level 35 restorecond off
chkconfig --level 35 mcstrans off
chkconfig --level 345 yum-updatesd off
cat /opt/init.txt > /etc/inittab
) 2>&1 >>/root/post-install.log
%end
One Response