Kickstart Recovery
Backupserver Configuration(192.168.0.100)
一、配置http服务器
web服务器的发布目录:
/var/www/html/rhas
/var/www/html/rhas/RedHat/base
/var/www/html/rhas/RedHat/RPMS
把第一张盘里的base 目录里的内容copy到/var/www/html/rhas/RedHat/base
把第一张盘里的RPMS目录里的内容copy到/var/www/html/rhas/RedHat/RPMS
把第二张盘里的RPMS目录里的内容copy到/var/www/html/rhas/RedHat/RPMS
把第三张盘里的RPMS目录里的内容copy到/var/www/html/rhas/RedHat/RPMS
把第四张盘里的RPMS目录里的内容copy到/var/www/html/rhas/RedHat/RPMS
二、配置kickstart无人值守安装脚本:
copy /root/anaconda.cfg /var/www/html/rhas/ks.cfg
Vi /var/www/html/rhas/ks.cfg
# Kickstart file automatically generated by anaconda.
install
cdrom
lang zh_CN.UTF-8
langsupport --default=zh_CN.UTF-8 zh_CN.UTF-8
keyboard us
xconfig --card "VMWare" --videoram 16384 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16 --startxonboot --defaultdesktop gnome
network --device eth0 --bootproto dhcp --hostname asmboy001
rootpw --iscrypted $1$oYItZY.C$4JDb7VdZjTZN.lmb07K85/
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone Asia/Shanghai
bootloader --location=mbr --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --all --drives=sda
#part /boot --fstype "ext3" --size=100 --ondisk=sda
#part pv.3 --size=0 --grow --ondisk=sda
#volgroup VolGroup00 --pesize=32768 pv.3
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=256 --grow --maxsize=512
%packages
@ admin-tools
@ editors
@ emacs
@ system-tools
@ gnome-software-development
@ text-internet
@ x-software-development
@ gnome-desktop
@ dialup
@ smb-server
@ base-x
@ chinese-support
@ server-cfg
@ development-tools
@ graphical-internet
lvm2
grub
kernel-smp
kernel-smp-devel
e2fsprogs
%post
需要做的修改就是把红色字体的注释去掉
:wq保存退出
三、配置tftp-server
# vi /etc/xinetd.d/tftp
service tftp
{
disable = no (默认是yes,这里改成no,启用它)
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot //-s 表示用/tftpboot作为tftp目录的根目录.
per_source = 11
cps = 100 2
flags = IPv4
}
tftp是由xinted来启动的,修改完后要记得service xinetd restart
四、配置支持PXE启动:
# mkdir /tftpboot
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot
复制引导内核(vmlinuz)、驱动(initrd.img)和安装配置文件(isolinux.cfg)到/tftpboot/目录下。这三个文件都在第一张安装光盘上的/isolinux/目录里
cp /mnt/isolinux/vmlinuz /tftpboot/
cp /mnt/isolinux/initrd.img /tftpboot/
isolinux.cfg需要放到tftpboot/pxelinux.cfg/目录下,并改名default
cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
# vi default
default linux
prompt 1
timeout 30
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
F7 snake.msg
label local
localboot 0
label linux
kernel vmlinuz
append ks= initrd=initrd.img devfs=nomount
ramdisk_size=9216
label text
kernel vmlinuz
append initrd=initrd.img text devfs=nomount ramdisk_size=9216
label expert
kernel vmlinuz
append expert initrd=initrd.img devfs=nomount ramdisk_size=9216
label ks
kernel vmlinuz
append ks initrd=initrd.img devfs=nomount ramdisk_size=9216
label nofb
kernel vmlinuz
append initrd=initrd.img devfs=nomount nofb ramdisk_size=9216
label lowres
kernel vmlinuz
append initrd=initrd.img lowres devfs=nomount ramdisk_size=9216
kernel vmlinuz
修改的为红色标注的部分
五、配置DHCP服务
安装DHCP服务的软件包:
rpm -ihv dhcp-3.0.1-12_EL.i386.rpm dhcp-devel-3.0.1-12_EL.i386.rpm –aid
配置DHCP服务:
cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf
vi /etc/dhcpd.conf
# vi /etc/dhcpd.conf
=============+==========+===========+============+============
ddns-update-style interim;
ignore client-updates;
default-lease-time 21600;
max-lease-time 43200;
authourtative;
next-server 192.168.0.100;
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
range 192.168.0.1 192.168.1.255;
default-lease-time 21600;
max-lease-time 43200;
filename "/pxelinux.0";
option domain-name-servers 192.168.0.100;
}
六、从网络启动机器以完成安装
安装前确定dhcp http ssh rsync服务开启
service dhcpd restart
service httpd restart
service sshd restart
service xinetd restart
在待安装机器上通过网络以无人值守的方式来安装Red Hat Enterprise Linux AS 4
1. 启动待安装机器,选择从网卡启动。
2.开始安装
Recovery
一、:
在192.168.0.100上,以root登录。执行如下命令:
ssh-keygen -d
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id.dsa): (采用缺省值,回车)
Enter passphrase (empty for no passphrase): (不用密码了,回车)
Enter same passphrase again: (回车)
Your identification has been saved in /root /.ssh/id_dsa.
Your public key has been saved in /root /.ssh/id_dsa.pub.
The key fingerprint is:
b2:a4:92:12:7f:15:9b:89:48:2a:7c:3a:d6:17:ea:ab ldomain
这样,在root的.ssh目录下生成如下两个文件:
id_dsa
id_dsa.pub
在用户的.ssh目录下,将id_dsa.pub复制一份成 authorized_keys2 文件, 并将 authorized_keys2 的属性改为 600 即文件所属用户有读和写的权限,组用户和其它用户禁止读写。
cp id_dsa.pub authorized_keys2
chmod 600 authorized_keys2
然后在192.168.0.9上,也以root登录,也执行上面的一次操作。
这样,两台服务器上都生成了用户的公钥和私钥,接下来就是进行互相认证了。即把公钥放到对方服务器。
192.168.0.9信认192.168.0.100,即192.168.0.100登录192.168.0.9不用输入密码:
复制192.168.0.100上的id_dsa.pub到192.168.0.9(不要覆盖server2上的id_dsa.pub),复制成id_dsa.pub_192.168.0.100。然后将id_dsa.pub_192.168.0.100的内容添加到192.168.0.9上的root用户.ssh目录下的authorized_keys2文件中
cat id_dsa.pub_192.168.0.100 >> authorized_keys2
现在你在192.168.0.100上以dboper用户来登录192.168.0.9,将不再需要密码了。
按上面的方法,把192.168.0.9上的id_dsa.pub中的内容添加到192.168.0.100上用户.ssh目录下的authorized_keys2文件中。
二、【192.168.0.100】
192.168.0.100【backupserver】---------------192.168.0.9【dbserver】
rsync -avz -e ssh /osbak/boot/ root@192.168.0.9:/boot/
rsync -avz -e ssh /osbak/etc/ root @192.168.0.9:/etc/
rsync -avz -e ssh /osbak/home/app/ root@192.168.0.9:/home/app/
rsync -avz -e ssh /osbak/usr/local/bin/ /usr/local/bin/