PXE+TFTP+HTTP+DDNS(dhcp+bind)
一 yum
[root@localhost yum.repos.d]# mount /dev/cdrom /media/
[root@localhost yum.repos.d]# ls
CentOS-Base.repobak
CentOS-Media.repo
CentOS-Debuginfo.repo CentOS-Vault.repo
[root@localhost yum.repos.d]# cat CentOS-Media.repo
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-6. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[root@localhost yum.repos.d]#
二 install windwos-X
[root@localhost yum.repos.d]# yum groupinstall "Desktop"
三 fireware selinux
[root@localhost yum.repos.d]# service iptables stop
[root@localhost yum.repos.d]# setenforce 0
四 install tftp,httpd
[root@localhost yum.repos.d]# yum install tftp-server httpd
[root@localhost syslinux]# yum install syslinux-4.02-7.el6.x86_64.rpm
[root@localhost yum.repos.d]# 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 /var/lib/tftpboot
disable = yes
per_source = 11
cps = 100 2
flags = IPv4
}
[root@localhost yum.repos.d]#
[root@localhost syslinux]# cp pxelinux.0 /var/lib/tftpboot/
[root@localhost syslinux]# cp vesamenu.c32 /var/lib/tftpboot/
[root@localhost syslinux]# cp /media/images/pxeboot/initrd.img /var/lib/tftpboot/
[root@localhost syslinux]# cp /media/images/pxeboot/vmlinuz /var/lib/tftpboot/
[root@localhost syslinux]# cp /media/isolinux/boot.msg /var/lib/tftpboot/
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# ls
boot.msg initrd.img pxelinux.0 pxelinux.cfg vesamenu.c32 vmlinuz
[root@localhost tftpboot]# cp /media/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@localhost tftpboot]# ls
boot.msg initrd.img pxelinux.0 pxelinux.cfg vesamenu.c32 vmlinuz
[root@localhost pxelinux.cfg]# vi default
[root@localhost pxelinux.cfg]# cat default
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.3!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.0.237/ks.cfg
label vesa
menu label Install system with ^basic video driver
kernel vmlinuz
append initrd=initrd.img xdriver=vesa nomodeset
label rescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue
label local
menu label Boot from ^local drive
localboot 0xffff
label memtest86
menu label ^Memory test
kernel memtest
append -
[root@localhost pxelinux.cfg]#
[root@localhost www]# cp -rf /media/* /var/www/html
五 install dhcpd bind
Caution :chown
[root@localhost Packages]# yum install bind bind-chroot
[root@localhost Packages]# yum install dhcp
[root@localhost etc]# service named start
[root@localhost etc]# vi /etc/named.conf
[root@localhost named]# cat /etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
include "/etc/rndc.key";
controls {
inet 192.168.0.237 allow { 192.168.0.237; } keys { "rndckey"; };
};
options {
listen-on port 53 { any; };
#
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
[root@localhost named]#
[root@localhost named]# vim /etc/named.rfc1912.zones
[root@localhost named]# nslookup aa-config-01
Server:
127.0.0.1
Address:
127.0.0.1#53
** server can't find aa-config-01: NXDOMAIN
[root@localhost named]#
[root@localhost named]# vi /etc/named.rfc1912.zones
[root@localhost named]# cat /etc/named.rfc1912.zones
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "puppet.com" IN{
type master;
file "puppet.com";
allow-update { key rndckey; };
};
#zone "0.168.192.in-addr.arpa" IN{
#
type master;
#
file "r.puppet.com";
#
allow-update{ key rndckey; };
#};
zone "localhost.localdomain" IN {
type master;
file "named.localhost";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "named.localhost";
allow-update { none; };
};
zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};
zone "1.0.0.127.in-addr.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.empty";
allow-update { none; };
};
[root@localhost named]#
[root@localhost named]# cat /etc/rndc.key
key "rndckey" {
algorithm hmac-md5;
secret "dmOSfSwIG+q5PjVzVcvhbw==";
};
[root@localhost named]#
[root@localhost named]# cat r.puppet.com
$TTL
86400
@
IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS puppet.com.
227
IN PTR aa-config-01.puppet.com.
[root@localhost named]#
[root@localhost named]# cat /etc/resolv.conf
# Generated by NetworkManager
search puppet.com
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
[root@localhost named]#
##server
host hudson{
hardware ethernet 00:0c:29:9f:ce:2c;
fixed-address 192.168.0.242;
ddns-hostname "hudson";
filename "/pxelinux.0";
}
zone puppet.com.{
primary 192.168.0.239;
key rndckey;
}
#zone 0.168.192.in-addr.arpa.{
#
primary 192.168.0.239;
#
key rndckey;
#}
[root@localhost named]# cat /etc/dhcp/dhcpd.conf
authoritative;
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
get-lease-hostnames on;
update-static-leases on;
ddns-updates on;
include "/etc/rndc.key";
ddns-domainname "puppet.com";
ddns-rev-domainname "in-addr.arpa";
option domain-name-servers 192.168.0.237;
filename "/pxelinux.0";
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.249;
option subnet-mask 255.255.255.0;
option nis-domain "puppet.com";
option domain-name "puppet.com";
option domain-search "puppet.com";
option domain-name-servers 192.168.0.237;
option time-offset -18000; # Eastern Standard Time
#
range dynamic-bootp 192.168.0.210 192.168.0.230;
default-lease-time 21600;
max-lease-time 43200;
}
##server
host hudson{
hardware ethernet 00:0c:29:9f:ce:2c;
fixed-address 192.168.0.242;
ddns-hostname "hudson";
filename "/pxelinux.0";
}
zone puppet.com.{
primary 192.168.0.237;
key rndckey;
}
zone 0.168.192.in-addr.arpa.{
primary 192.168.0.237;
key rndckey;
}
[root@localhost named]#
[root@localhost named]#
七 install ks
[root@localhost Packages]# yum install system-config-kickstart
[root@localhost html]# ls
CentOS_BuildTag isolinux
RPM-GPG-KEY-CentOS-6
EFI
ks.cfg RPM-GPG-KEY-CentOS-Debug-6
EULA
Packages RPM-GPG-KEY-CentOS-Security-6
GPL
RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Testing-6
images
repodata TRANS.TBL
[root@aa-config-01 html]# cat ks.cfg
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://192.168.0.237/"
# Root password
rootpw --iscrypted $1$XgXBu2uS$j9rSJhPawC612ogc3DAQc.
# System authorization information
auth --useshadow --passalgo=sha512
# Use text mode install
text
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Africa/Abidjan
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part / --fstype="ext4" --size=12000
part swap --fstype="swap" --size=1000
[root@aa-config-01 html]#