Configure Rescue/Installation From LAN
1)configrue six servcies
1@@@@nfs
@@@edit the /etc/exports files,if you don't understand the mean
@@@of the (rw,sync),you could referencing relative books.
[root@station60 pub]# yum -y install nfs*
[root@station63 ~]# cat /etc/exports
/var/ftp/pub 192.168.0.0/255.255.255.0(rw,sync)
[root@station60 Desktop]# service nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@station60 Desktop]# showmount -e
Export list for station60.example.com:
/var/ftp/pub 192.168.0.0/24
[root@station60 Desktop]# chkconfig nfs on
2@@@@vsftpd
[root@station60 pub]# yum -y install ftp*
[root@station60 Desktop]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@station60 Desktop]# chkconfig vsftpd on
3@@@@httpd
[root@station60 pub]# yum -y groupinstall 'Web Server'
[root@station60 Desktop]# service httpd start
Starting httpd: [ OK ]
[root@station60 Desktop]# chkconfig httpd on
4@@@@tftp
[root@station60 pub]# yum -y install tftp*
[root@station60 init.d]# /etc/rc.d/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@station60 init.d]# chkconfig tftp on
5@@@@dhcpd
@@@only one dhcp server in a net
@@@dhcp.conf
####begin################################
[root@station63 ~]# cat /etc/dhcp/dhcpd.conf
ddns-update-style none;
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.63;
option subnet-mask 255.255.255.0;
option domain-name "example.com";
option domain-name-servers 192.168.0.63;
default-lease-time 21600;
max-lease-time 43200;
filename "/var/ftp/pub/RHEL6.2_x86_64/kickstart.cfg";
next-server station63.example.com;
pool{
range 192.168.0.1 192.168.0.255;
}
host station9 {
hardware ethernet 52:54:00:35:33:f9;
fixed-address 192.168.0.9;
}
host station10 {
hardware ethernet FE:54:00:35:22:F9;
fixed-address 192.168.0.10;
}
host station11 {
hardware ethernet 00:16:ec:06:37:1e;
fixed-address 192.168.0.11;
}
host station12 {
hardware ethernet 00:16:EC:0B:E6:01;
fixed-address 192.168.0.12;
}
}
option space PXE;
class "PXE" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
option vendor-encapsulated-options 01:04:00:00:00:00:ff;
option boot-size 0x1;
filename "pxelinux.0";
option tftp-server-name "station63.example.com";
option vendor-class-identifier "PXEClient";
vendor-option-space PXE;
}
######end##############################
6@@@@config named
@@@named is also called by DNS.
@@@install all the packages about bind
[root@station63 ~]# yum list bind*
bind.x86_64
bind-chroot.x86_64
bind-dyndb-ldap.x86_64
bind-libs.i686
bind-libs.x86_64
bind-utils.x86_64
@@@
[root@station63 named]# ls /etc/named*
/etc/named.conf /etc/named.rfc1912.zones
/etc/named.iscdlv.key /etc/named.root.key
[root@station63 named]# ls /var/named/
192.168.0.zone dynamic named.empty slaves
chroot example.com.zone named.localhost test
data named.ca named.loopback
@@@edit /etc/named.conf as below:
####begin############################
[root@station63 named]# cat /etc/named.conf
options {
directory "/var/named";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "example.com" IN {
type master;
file "example.com.zone";
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "192.168.0.zone";
};
######end############################
@@@
@@@example.com.zone
@@@generate the parameter using the command as the following:
@@@Note: that is a whole line.
[root@station63 named]# for i in $(seq 1 254);
do echo "station$i.example.com. IN A 192.168.0.$i";
done >> test
####begin############################
[root@station63 named]# cat example.com.zone
$TTL 86400
@ IN SOA station63.example.com. root.station63.com. (
102201 ; serial (d. adams)
3H ; refresh
1H ; retry
1W ; expiry
0 ) ; minimum
@ IN NS station63.example.com.
station1.example.com. IN A 192.168.0.1
station2.example.com. IN A 192.168.0.2
station3.example.com. IN A 192.168.0.3
station4.example.com. IN A 192.168.0.4
.................
station253.example.com. IN A 192.168.0.253
station254.example.com. IN A 192.168.0.254
######end############################
@@@
@@@192.168.0.zone
@@@generate the parameter using the command as the following:
@@@Note: there are only a completed line.
[root@station63 named]# for i in $(seq 1 254);
do echo "$i.0.168.192.in-addr.arpa. IN PTR station$i.example.com.";
done >> test
####begin############################
[root@station63 named]# cat 192.168.0.zone
$TTL 86400
@ IN SOA station63.example.com. root.station63.example.com. (
102201 ; Serial
1M ; Refresh
1M ; Retry
1W ; Expire
0 ) ; Minimum
@ IN NS station63.example.com.
1.0.168.192.in-addr.arpa. IN PTR station1.example.com.
2.0.168.192.in-addr.arpa. IN PTR station2.example.com.
3.0.168.192.in-addr.arpa. IN PTR station3.example.com.
......................
252.0.168.192.in-addr.arpa. IN PTR station252.example.com.
253.0.168.192.in-addr.arpa. IN PTR station253.example.com.
254.0.168.192.in-addr.arpa. IN PTR station254.example.com.
######end#############################
@@@
[root@station63 named]# service named restart
Stopping named: . [ OK ]
Starting named: [ OK ]
@@@
@@@check the named service forward area.
[root@station63 named]# dig station1.example.com
; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> station1.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63416
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;station1.example.com. IN A
;; ANSWER SECTION:
station1.example.com. 86400 IN A 192.168.0.1
;; AUTHORITY SECTION:
example.com. 86400 IN NS station63.example.com.
;; ADDITIONAL SECTION:
station63.example.com. 86400 IN A 192.168.0.63
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Mar 12 01:26:41 2012
;; MSG SIZE rcvd: 94
@@@
@@@check the named service reverse area.
[root@station63 named]# dig -x 192.168.0.1
; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> -x 192.168.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19403
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;1.0.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
1.0.168.192.in-addr.arpa. 86400 IN PTR station1.example.com.
;; AUTHORITY SECTION:
0.168.192.in-addr.arpa. 86400 IN NS station63.example.com.
;; ADDITIONAL SECTION:
station63.example.com. 86400 IN A 192.168.0.63
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Mar 12 01:27:21 2012
;; MSG SIZE rcvd: 116
@@@Note:
@@@if you have some errors,check the /var/logs/messages
2)deploy the install files
1@@@@/var/lib/tftpboot
@@@"pxelinux.0" is used by all the versions of RedHat Operation System
@@@"vmlinuz, initrd.img" are spceified kernel version.
@@@"boot.msg" is message you would client to see.
@@@"pxelinux.cfg" is a directory.
@@@"default" is a critial file which is used for guide.
[root@station63 tftpboot]# ls /var/lib/tftpboot/
boot.msg initrd.img pxelinux.0 pxelinux.cfg vmlinuz
[root@station63 pxelinux.cfg]# ls /var/lib/tftpboot/pxelinux.cfg
default
@@@
@@@see the file default as below:
@@@Note: append .....this a completed line without "Enter" and so on.
####begin##################################
[root@station63 pxelinux.cfg]# cat default
default RHEL6.2_rescue
prompt 1
timeout 3600
display boot.msg
label RHEL6.2_rescue
kernel vmlinuz
append load_ramdisk=1 initrd=initrd.img rescue
label RHEL6.2_push
kernel vmlinuz
append ksdevice=eth0 load_ramdisk=1 initrd=initrd.img network ks=http://192.168.0.63/pub/RHEL6.2_x86_64/ks.cfg
######end##################################
@@@
@@@see the file boot.msg as below:
####begin##################################
[root@station63 tftpboot]# cat boot.msg
####Note:
timeout 3600 would use default option RHEL6.2_rescue
####Manu:
Please input option given as the below:
RHEL6.2_rescue
RHEL6.2_push
######end##################################
@@@
@@@Note:
@@@change right and selinux context
#chmod 775 /var/lib/tftpboot
#restorecon -R /var/lib/tftpboot/*
@@@
[root@station63 named]# cd /var/lib/tftpboot/
[root@station63 tftpboot]# ls -Zd *
-rwxrwxr-x. root root unconfined_u:object_r:tftpdir_rw_t:s0 boot.msg
-rwxrwxr-x. root root unconfined_u:object_r:tftpdir_rw_t:s0 initrd.img
-rwxrwxr-x. root root unconfined_u:object_r:cobbler_var_lib_t:s0 pxelinux.0
drwxrwxr-x. root root unconfined_u:object_r:cobbler_var_lib_t:s0 pxelinux.cfg
-rwxrwxr-x. root root unconfined_u:object_r:tftpdir_rw_t:s0 vmlinuz
@@@
@@@open the selinux
[root@station63 tftpboot]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
@@@
[root@station63 tftpboot]# getenforce
Enforcing
2@@@@/var/ftp/pub/RHEL6.2_x86_64
[root@station63 RHEL6.2_x86_64]# pwd
/var/ftp/pub/RHEL6.2_x86_64
[root@station63 RHEL6.2_x86_64]# ls -Zd *
drwxrwxr-x. root root unconfined_u:object_r:public_content_t:s0 images
-rwxrwxr-x. root root unconfined_u:object_r:public_content_t:s0 ks.cfg
drwxrwxr-x. root root unconfined_u:object_r:public_content_t:s0 Packages
drwxrwxr-x. root root unconfined_u:object_r:public_content_t:s0 repodata
drwxrwxr-x. root root unconfined_u:object_r:public_content_t:s0 Server
@@@generate a ks.cfg file.
@@@install the packages system-config-kickstart.noarch
[root@station63 ~]# yum list system-config-kickstart
Installed Packages
system-config-kickstart.noarch
[root@station63 ~]# system-config-kickstart
@@@Note:
@@@all the files the above, you could find in the office RHEL of iso.
#chmod 775 /var/ftp/pub/RHEL6.2_x86_64/*
#restorecon -R /var/lib/tftpboot/*
3@@@@httpd use soft linking to connect vsftpd
[root@station63 html]# cd /var/www/html
[root@station63 html]# ln -s /var/ftp/pub
[root@station63 RHEL6.2_x86_64]# ls /var/www/html/pub/RHEL6.2_x86_64
images ks.cfg Packages repodata Server
3)maintenance
1@@@@push.sh
@@@Note: iptables would stop tftp server
#./push.sh open
#sh push.sh close
####begin############################
[root@station63 ~]# cat push.sh
#!/bin/sh
case $1 in
open)
service rpcbind restart
chkconfig rpcbind on
service xinetd restart
chkconfig tftp on
service nfs restart
chkconfig nfs on
service vsftpd restart
chkconfig vsftpd on
service dhcpd restart
chkconfig dhcpd on
service httpd restart
chkconfig httpd on
service named restart
chkconfig named on
service iptables stop
showmount -e
;;
close)
service xinetd stop
chkconfig tftp off
service nfs stop
chkconfig nfs off
service vsftpd stop
chkconfig vsftpd off
service dhcpd stop
chkconfig dhcpd off
service httpd stop
chkconfig httpd off
service named stop
chkconfig named off
;;
*)
echo "please input{open|close}"
;;
esac
######end##########################
本文出自 “Oracle+Linux=>Majesty” 博客,谢绝转载!