Batch deployment of linux machines (redhat5.4/centos5.3)

Source: Internet
Author: User
Tags nameserver
Summarize the previously used thing system: centos5/redhat5 software package: wgethttp: // response

Summarize the previously used items
System: centos5/redhat5
Software package:
Wget http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.86.tar.gzor
Wget http://ftp.ntu.edu.tw/linux/boot/syslinux/3.xx/syslinux-3.86.tar.gz
1. syslinux compilation and installation, pxe Startup directory and file creation
Tar zxvf syslinux-3.86.tar.gz
Cd syslinux-3.86
Make
Mkdir/tftpboot/pxelinux. cfg-p
Mkdir/tftpboot/ks-p
Mkdir/tftpboot/centos5.3
Mkdir/tftpboot/redhat5.4
Chmod 755/tftpboot
# Cd gpx/gpxelinux.0/tftpboot
# Cp gpx/pxelinux. gpxe/tftpboot
# Cp com32/menu/*. c32/tftpboot/pxelinux. cfg
# Cp com32/modules/reboot. c32/tftpboot/pxelinux. cfg
# Cp com32/modules/chain. c32/tftpboot/pxelinux. cfg
Copy two important files vmlinuz and initrd. img in the isolinux Directory of the installation disk to the TFTP root directory/tftpboot.
Cp/data/centos5.3/isolinux/vmlinuz/tftpboot/centos5.3
Cp/data/centos5.3/isolinux/initrd. img/tftpboot/centos5.3
Cp/data/redhat5.4/isolinux/vmlinuz/tftpboot/redhat5.4
Cp/data/redhat5.4/isolinux/initrd. img/tftpboot/redhat5.4

Copy all the files in the isolinux Directory of the installation disk. msg File (boot. msg, initrd. msg, param. msg, general. msg, options. msg, rescue. msg) to the TFTP root directory/tftpboot
Command:
Cp/data/centos5.3/isolinux/*. msg/tftpboot/centos5.3/
Cp/data/redhat5.4/isolinux/* msg/tftpboot/redhat5.4/
Copy the isolinux. cfg file in the isolinux directory to default in tftpboot/pxelinux. cfg.
Cp/data/centos5.3/isolinux. cfg/tftpboot/pxelinux. cfg/default

2. dhcpd configuration
Yum-y install dhcp-devel
Edit the DHCP configuration file/etc/dhcpd. conf, which can be obtained from/usr/share/doc/dhcp */dhcpd. conf. sample: Copy the sample of the configuration file to make it faster.
Descriptions of dhcpd. conf configuration:

Parameters (parameter ):
Ddns-update-style configure DHCP-DNS interactive update mode
Default-lease-time specifies the length of the default lease time, in seconds
Max-lease-time specifies the maximum lease time length, in seconds
Hardware specifies the Nic interface type and MAC address
Server-name notifies DHCP client server name
Get-lease-hostnames flag check the IP address used by the client
The fixed-address ip address is assigned to the client as a fixed address.
Authritative rejects incorrect IP address requirements

Declarations (declaration ):
Shared-network is used to tell if some sub-networks share the same network.
Subnet describes whether an IP address belongs to this subnet.
Range starting IP address termination IP address range that provides dynamic IP address allocation
For host names, refer to special hosts.
Group provides a declaration for a group of parameters.
Whether the allow unknown-clients or deny unknown-client dynamically allocates IP addresses to unknown users
Whether or not allow bootp or deny bootp responds to the activation query
Whether allow booting or deny booting responds to user queries
The name of the file whose filename starts to start. it is applied to the diskless workstation.
Next-server: sets the host name to be installed on the server from the boot file and applies to diskless workstation.

Option ):
Subnet-mask sets the subnet mask for the client
Domain-name specifies the DNS name for the client
Domain-name-servers specifies the DNS server IP address for the client
Host-name: specifies the host name of the client.
Routers sets the default gateway for the client
Broadcast-address: Set the broadcast address for the client.
Ntp-server sets the server IP address for the client's network time
Time-offset is the offset time set by the client and Greenwich Mean time, in seconds.

Command:
Cp/usr/share/doc/dhcp */dhcpd. conf. sample/etc/dhcpd. conf
Vim/etc/dhcpd. conf
# -------------- Global ------------------------------------------
Option domain-name-servers 192.168.1.199;
Ddns-update-style none;
Default-lease-time 14400;
Max-lease-time 43200;
# ---------- Tftp ------------------------------------------
Ignore client-updates;
Allow booting;
Allow bootp;
Class "pxeclients "{
Match if substring (option vendor-class-identifier,) = "PXEClient ";
Filename "gpxelinux.0 ";
Next-server 192.168.1.199;
}
# ---------- Subnet ---------------------------------------------
Subnet 192.168.1.0 netmask 255.255.255.0 {
Option routers 192.168.1.1;
Option subnet-mask limit 255.0;
Range dynamic-bootp 192.168.1.200 192.168.1.254;
}

Check the file/var/lib/dhcpd. leases. the file exists.

To ensure security, you can edit the/etc/sysconfig/dhcpd file on the machine with multiple NICs to enable the DHCP service on that device.
Command:
Vim/etc/sysconfig/dhcpd
The edited content is as follows:
# Command line options here
DHCPDARGS = eth0
Restart DHCP service
Service dhcpd restart or/etc/rc. d/ini. d/dhcpd restart

3. tftp configuration
Yum-y install xinetd tftp-server
Edit the TFTP configuration file
Vim/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 =-u nobody-s/tftpboot
Disable = no
Per_source = 11
CPIs = 100 2
Flags = IPv4
}
To restart the TFTP service, restart the xinetd daemon.
Service xinetd restart


4. nfs configuration:
Yum-y install nfs-utils-lib

Edit the NFS configuration file
Command:
Vim/etc/exports
/Tftpboot * (ro, sync)
/Data/centos5.3 * (ro, sync)

Restart the nfs service:
Service nfs restart
Service portmap restart

Alternatively, you do not need to restart the entire service. run the following command to update the NFS service:
Exportfs-arv

Check whether the directory settings are correct:
Showmount-e localhost

You only need to define the cfg file according to your business:

Ceentos5.3.cfg and redhat5.4.cfg under/tftpboot/ks
#########/Tftpboot/pxelinux. cfg/default #######
Default ct53_32
Prompt 1
Timeout 600
Display boot. msg
F1 boot. msg
F2 options. msg
F3 general. msg
F4 param. msg
F5 rescue. msg
Label linux
Kernel vmlinuz
Append initrd = initrd. img
Label text
Kernel vmlinuz
Append initrd = initrd. img text
Label local
Localboot 1
Label memtest86
Kernel memtest
Append-

Label ct53_32
Kernel centos5.3/vmlinuz
Append initrd = centos5.3/initrd. img ks = nfs: 192.168.1.199:/tftpboot/ks/ct53_32.cfg devfs = nomount ramdisk_size = 4096 nofb text
Label rh54_32
Kernel redhat5.4/vmlinuz
Append initrd = redhat5.4/initrd. img ks = nfs: 192.168.1.199:/tftpboot/ks/fig = nomount ramdisk_size = 4096 nofb text
###########/Tftpboot/ks/rh54_32.cfg #############
# Kickstart file automatically generated by anaconda.

Install
Nfs -- server = 192.168.1.199 -- dir =/data/redhat5.4
Lang en_US.UTF-8
Langsupport -- default = en_US.UTF-8 en_US.UTF-8
Keyboard us
Key -- skip
Network -- bootproto = dhcp -- device = eth0 -- onboot = on
Rootpw -- iscrypted $1 $ XPr0sv0o $1. XsUW0h36ZdWetQOefR21
Firewall -- disabled
Selinux -- disabled
Authconfig -- enableshadow -- enablemd5
Timezone Asia/Shanghai
Bootloader -- location = mbr
# Disk
Clearpart -- all -- initlabel
Part/boot -- fstype ext3 -- size = 100
Part/-- fstype ext3 -- size = 12000
Part swap -- fstype swap -- size = 1024

% Packages
@ Admin-tools
@ Editors
# @ Emacs
@ Base
@ System-tools
@ Dialup
@ Server-cfg
@ Development-tools
@ Ruby
@ Text-internet
Net-snmp

% Post
/Sbin/chkconfig -- level 2345 anacron off
/Sbin/chkconfig -- level 2345 apmd off
/Sbin/chkconfig -- level 2345 atd off
/Sbin/chkconfig -- level 2345 gpm off
/Sbin/chkconfig -- level 2345 httpd off
/Sbin/chkconfig -- level 2345 identd off
/Sbin/chkconfig -- level 2345 ipchains off
/Sbin/chkconfig -- level 2345 isdn off
/Sbin/chkconfig -- level 2345 keytable off
/Sbin/chkconfig -- level 2345 kudzu off
/Sbin/chkconfig -- level 2345 linuxconf off
/Sbin/chkconfig -- level 2345 lpd off
/Sbin/chkconfig -- level 2345 netfs off
/Sbin/chkconfig -- level 2345 nfslock off
/Sbin/chkconfig -- level 2345 pcmcia off
/Sbin/chkconfig -- level 2345 portmap off
/Sbin/chkconfig -- level 2345 random off
/Sbin/chkconfig -- level 2345 rawdevices off
/Sbin/chkconfig -- level 2345 rhnsd off
/Sbin/chkconfig -- level 2345 sgi_fam off
/Sbin/chkconfig -- level 2345 sshd off
/Sbin/chkconfig -- level 2345 xfs off
/Sbin/chkconfig -- level 2345 xinetd off
/Sbin/chkconfig -- level 2345 cups off
/Sbin/chkconfig -- level 2345 hpoj off
/Sbin/chkconfig -- level 2345 mdmpd off
/Sbin/chkconfig -- level 2345 firstboot off
/Sbin/chkconfig -- level 2345 arptables_jf off
/Sbin/chkconfig -- level 2345 mdmonitor off
/Sbin/chkconfig -- level 2345 smartd off
/Sbin/chkconfig -- level 2345 messagebus off
/Sbin/chkconfig -- level 2345 acpid off
/Sbin/chkconfig -- level 2345 avahi-daemon off
/Sbin/chkconfig -- level 2345 rpcsvcgssd off
/Sbin/chkconfig -- level 2345 rpcgssd off
/Sbin/chkconfig -- level 2345 rpcidmapd off
/Sbin/chkconfig -- level 2345 irqbalance on
/Sbin/chkconfig -- level 2345 bluetooth off
/Sbin/chkconfig -- level 2345 psacct on
/Sbin/chkconfig -- level 2345 sshd on
/Sbin/chkconfig -- level 2345 snmpd on
Echo "**/5 ***/usr/sbin/ntpdate 210.72.145.44>/dev/null 2> & 1">/etc/crontab
Echo "nameserver 202.106.46.151">/etc/resolv. conf
Echo "nameserver 202.106.196.115">/etc/resolv. conf
 
Author: "Larry's Learning Path"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.