找不到原创的地址了,原创联系我吧。在原创基础上实战修改的,感谢原创。
tftp端口69 tcp
nfs端口2049 tcp/udp
一、Centos6.5安装系统。
1.vmware12安装略
2.Centos6.5安装系统略
1)最简版
3.配置Centos6.5
1)配置网卡
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:94:4F:E0
TYPE=Ethernet
UUID=7798830d-228d-4096-a6c4-fc1e374608a3
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=stat
IPADDR=192.168.44.253
GATEWAY=192.168.44.2
NETMASK=255.255.255.0
DNS1=114.114.114.114
2)安装yum
yum install yum -y
3)安装kickstart
yum -y install system-config-kickstart
system-config-kickstart
4)安装dhcp
闭关防火墙
service iptables stop
关闭SELINUX
setenforce 0
IP地址和DHCP的地址和next-server的IP地址有关系
yum install -y dhcp
vim /etc/dhcp/dhcpd.conf
DHCP Server Configuration file.
see /usr/share/doc/dhcp*/dhcpd.conf.sample
see 'man 5 dhcpd.conf'
dgcod,cibf
dhcpd.conf
Sample configuration file for ISC dhcpd
log-facility local7;
A slightly different configuration for an internal subnet.
subnet 192.168.44.0 netmask 255.255.255.0 {
range 192.168.44.146 192.168.44.200;
option domain-name-servers 114.114.114.114;
option routers 192.168.44.145; #本机的IP地址
option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.44.145;
filename "pxelinux.0";
}
DHCP如果有问题,可以查看日志 tail -f /var/log/messages
5)安装TFTP服务
yum install -y tftp-server
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 = -s /var/lib/tftpboot
disable = no #yes 改成no
per_source = 11
cps = 100 2
flags = IPv4
}
配置说明:共享路径为/var/lib/ftfpboot
service xinetd restart
6)安装客户端启动文件
yum -y install syslinux
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
umount /dev/cdrom
mount /dev/cdrom /media/
mount -o loop -t iso9660 /centos6.5/centos-6.5.iso /media
cd /media/
cp /media/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg
cp /media/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
chmod 644 /var/lib/tftpboot/pxelinux.cfg/default
修改default配置文件
vim /var/lib/tftpboot/pxelinux.cfg/default
default linux
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.5!
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=nfs:192.168.44.145:/ks/20160620ks.cfg
append initrd=initrd.img ks=nfs:10.10.10.150:/ks/20160713.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 -
service xinetd restart
chkconfig xinetd on
service iptables stop
7)安装linux桌面环境
yum groupinstall -y "Desktop" "Desktop Platform" "Desktop Platform Development" "Fonts" "General Purpose Desktop" "Graphical Administration Tools" "Graphics Creation Tools" "Input Methods" "X Window System" "Chinese Support [zh]" "Internet Browser"
8)安装kickstart
yum install -y system-config-kickstart
system-config-kickstart
mkdir /ks/
nfs server服务器地址是:192.168.44.145共享目录是:/media 共享目录要和kickstart服务器上一致。
这里通过图形生成的Kickstart文件无法使用LVM逻辑卷分区,如果需要使用LVM逻辑卷分区,则要手动修改生成后的Kickstart文件。
选择安装包
可以写入在安装系统前需要运行的脚本,若没有特殊需要,该脚本可以为空。
生成的kickstart文件
Save保存,选存处位置和文件名称。
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --enabled --http --ssh
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=192.168.44.145 --dir=/media
# Root password
rootpw --iscrypted $1$g6r97Pwb$APhmzh8uX4mTY0fpyR7DJ1
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --enforcing
# 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
# Partition clearing information
clearpart --all
# Disk partitioning information
part / --fstype="ext4" --size=50000
part /boot --fstype="ext4" --size=2000
part /swap --fstype="ext4" --size=16000 #不是LVM分区的
# most install manial
%packages --nobase
@core
%end
# reboot system
reboot
LVM分区的
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --enabled --http --ssh
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=192.168.44.145 --dir=/media
# Root password
rootpw --iscrypted $1$g6r97Pwb$APhmzh8uX4mTY0fpyR7DJ1
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --enforcing
# 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
# Partition clearing information
clearpart --all
# Disk partitioning information
part /boot -fstype ext3 -size=150
part swap -size=1024
part pv.01 -size=1 -grow
volgroup vg_root pv.01
logvol / -vgname=vg_root -size=8192 -name=lv_root
logvol /var -vgname=vg_root -size=4096 -name=lv_var
logvol /tmp -vgname=vg_root -size=2048 -name=lv_tmp
logvol /spare -vgname=vg_root ?size=1 -grow -name=lv_spare #不是LVM分区的
# most install manial
%packages --nobase
@core
%end
# reboot system
reboot
9)将Centos6.5光盘ISO的镜像考入Centos6.5系统中。
mkdir /centos6.5
winscp 连接centos之后复制文件。
mount -o loop -t iso9660 /centos6.5/centos-6.5.iso /media
10)NFS安装配置
yum -y install nfs-utils rpcbind
service rpcbind restart
mkdir /ks
vim /etc/exports
/ks 192.168.0.0/255.255.0.0(ro)
/media/CentOS_6.5_Final 192.168.0.0/255.255.0.0(ro)
service nfs restart
service xinetd restart
service dhcpd restart
chkconfig xinetd on
chkconfig dhcpd on
chkconfig nfs on
chkconfig rpcbind on