远程安装CentOS(请先把防火墙和SELinux关掉)
说明默认情况下面是Fedora是开启SELinux,如果dhcp已经开始,客户端一直获取不到,有可能是SELinux没有关闭
centos和RedHat关闭SELinux比较简单,fedora说明下
1、查看SELinux是否启动
getenforce (如果为Enforcing,表示SELinux已经启动)
2、进入 vim /etc/selinux/config
SELINUX=disabled
下次启动的时候,selinux就关掉了
3、停止 SELinux
setenforce 0
getenforce(显示为Permissive)e
一、配置服务
1、安装dhcpd 服务(本机的ip为:192.168.5.2,如果不同做相应的修改)
rpm -qa|grep dhcp
rpm -ivh dhcp-3.0.5-23.el5.i386.rpm
vim /etc/dhcpd.conf
option space PXE; #DHCP对PXE的TFTP(琐碎文件传输协议)应答选项
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;
class “pxeclients” {
match if substring (option vendor-class-identifier, 0, 9) = “PXEClient”;
option vendor-class-identifier “PXEClient”;
vendor-option-space PXE;
option PXE.mtftp-ip 0.0.0.0;
filename “pxelinux.0”; #指定客户端所需要的的bootstrap(引导器)文件名
next-server 192.168.5.2; #指定TFTP服务器的IP地址
}
ddns-update-style interim;
ignore client-updates;
default-lease-time 1200;
max-lease-time 9200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.5.255;
option routers 192.168.5.254;
option domain-name-servers 192.168.5.254;
subnet 192.168.5.0 netmask 255.255.255.0 {
range 192.168.5.100 192.168.5.150;
}
2、安装tftpboot
rpm -qa|grep tftp
tftp-server-0.49-2.el5.centos
rpm -ivh tftp-server-0.49-2.el5.centos.i386.rpm
(说明如果xinetd没有安装,要先把xinetd安装)
修改配置:disable = yes(改为no)
查看server_args 目录,如果不是/tftpboot,改为/tftpboot目录
vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
3、安装vsftp
rpm -qa|grep vsftp
vsftpd-2.0.5-16.el5_4.1
测试vsftp:
[root@GD-CentOS ~]# ftp 127.0.0.1
Connected to 127.0.0.1.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (127.0.0.1:root): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
二、远程安装
1、DHCP篇:
拷贝pxelinux.0(启动镜像)到/tftpboot (CentOS在/usr/lib/syslinux目录下面)
2、FTP篇:
创建目录:mkdir /networkdisc/cent5.6-64
把安装介质放入该目录中CentOS-5.6-x86_64-bin-DVD-1of2.iso、CentOS-5.6-x86_64-bin-DVD-2of2.iso
创建目录:/var/ftp/cent5.6-64/disc1 /var/ftp/cent5.6-64/disc1 这点和RedHat是一样的
挂载目录:mount -o loop /networkdisc/cent5.6-64/CentOS-5.6-x86_64-bin-DVD-1of2.iso /var/ftp/cent5.6-64/disc1
mount -o loop /networkdisc/cent5.6-64/CentOS-5.6-x86_64-bin-DVD-2of2.iso /var/ftp/cent5.6-64/disc2
3、TFTP篇:
进入目录:/var/ftp/CentOS-5.6/disc1/isolinux/ 下面把vmlinuz、initrd.img和所有的.msg文件拷贝到/tftpboot目录下面,
并将vmlinuz改名为vmlinuz.cent5.6-64,initrd.img改为initrd.cent5.6.img
创建目录 /tftpboot/pxelinux.cfg/ ,增加文件default
vim default
default cent5.6-64
prompt 1
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
F7 snake.msg
label cent5.6-64
kernel vmlinuz.cent5.6-64
append initrd=initrd.cent5.6-64.img text ramdisk_size=8192
到/tftpboot目录下,修改boot.msg,在最中间添加如下红色字段
vi /tftpboot/boot.msg
^L
^Xsplash.lss
– To install or upgrade in graphical mode, press the ^O0f<ENTER>^O07 key.
– To install or upgrade in text mode, type: ^O0flinux text <ENTER>^O07.
– Use the function keys listed below for more information.
label
as5u2-32
^O02[F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue]^O07
后记:这次安装中不小心把32位的错当成64位的,导致出现在ftp结束以后出现了: The centos installation tree in that directory does not seem to match your boot media