原系统无法启动的就想借这个机会,放弃伟大windows os完全的投入linux的怀抱中。U盘安装的方法一下没有安装成的,这个以后还是要测试的。
正常今天的linux运维之道的书到了,开始就讲了系统的基本安装与无人值守安装的,我只测试了前一段的安装方法。无人值守安装还没有进行实验的。
主体流程:PXE网络启动--DHCP分配IP--TFTP网络引导--NFS安装
1.安装TFTPSERVER
tftp服务是在xinetd.d 下的一个TFTP程序的。安装方法:
[[email protected] Desktop]# yum install -y tftp-server
安装完成,验证一下安装的文件
[[email protected] Desktop]# rpm -qa | grep tftp-server
tftp-server-0.49-7.el6.x86_64 #查看RPM包已安装
[[email protected] Desktop]# yum info tftp-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.opencas.cn
* updates: mirrors.opencas.cn
Installed Packages
Name : tftp-server
Arch : x86_64
Version : 0.49
Release : 7.el6
Size : 57 k
Repo : installed #安装成功
From repo : base
Summary : The server for the Trivial File Transfer Protocol (TFTP)
URL : http://www.kernel.org/pub/software/network/tftp/
License : BSD
Description : The Trivial File Transfer Protocol (TFTP) is normally used only
: for booting diskless workstations. The tftp-server package
: provides the server for TFTP, which allows users to transfer files
: to and from a remote machine. TFTP provides very little security,
: and should not be enabled unless it is expressly needed. The TFTP
: server is run from /etc/xinetd.d/tftp, and is disabled by default.
配置TFTP 配置文件位置:/etc/xinetd.d/tftp
[[email protected] Desktop]# 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 启动TFTP服务
per_source = 11
cps = 100 2
flags = IPv4
}
配置文件完成,启动服务
[[email protected] Desktop]# service xinetd start
Starting xinetd: [ OK ]
查看一下端口
[[email protected] Desktop]# netstat -naudp | grep :69
udp 0 0 0.0.0.0:69 0.0.0.0:* 5748/xinetd
[[email protected] Desktop]#
已经成功启动服务
2.安装配置DHCP服务
DHCP安装 [[email protected] Desktop]# yum install -y dhcp
这里就验证的,需要验证的同学可以参加步骤1的验证方法 使用rpm & yum info命令。
编辑配置文件,文件路径:/etc/dhcp/dhcpd.conf 简单写了一下配置的满足基本需求就好了。
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see ‘man 5 dhcpd.conf‘
#
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.20;
option routers 192.168.1.1;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.1.1; # TFTP服务器的地址,我这里本机,DHCP与TFTP不在一台机可更换
filename "pxelinux.0"; #设置在TFTP下载的启动文件
}
验证一下配置文件是否正确
[[email protected] dhcp]# service dhcpd configtest
Syntax: OK
启动DHCP服务
[[email protected] dhcp]# service dhcpd start
Starting dhcpd: [FAILED]
启动失败查看了LOG文件
错误提示如下:May 19 22:59:18 xxr dhcpd: Not configured to listen on any interfaces!
错误的原因:机器上是双NIC,需要指定一个监听的NIC
修改配置文件:
[[email protected] Desktop]# cat /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS="wlan0"
有时候还可能是权限的问题的修改配置文件:[[email protected] dhcp]# vim /etc/rc.d/init.d/dhcpd
修改USER与GROUP 用户为ROOT
[[email protected] dhcp]# service dhcpd restart
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
现在已经配置完成DHCP服务。
3.开始准备安装文件与引导启动文件的
将客户端所需的启动文件复制到TFTP服务器上
[[email protected] Desktop]# yum install -y syslinux #最小化安装linux的时候可能找不到pxelinux.0这个引导文件,所以需要安装一下支持文件:syslinux
复制pxelinux.0到TFTP共享目录中
[[email protected] Desktop]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
然后挂载光盘或ISO文件到系统中,复制启动镜像文件与启动配置文件
[[email protected] Desktop]# monut /dev/cdrom /mnt
[[email protected] ~]#cd /mnt
[[email protected] ~]#cp -rf * /var/www/html # 复制光盘文件到目录中
[[email protected] ~]# cp /var/www/html/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/
[[email protected] ~]# cd /var/lib/tftpboot/
[[email protected] ~]# mkdir pxelinux.cfg #一定要在TFTP的共享目录下创建这个文件
[[email protected] ~]# cp /var/www/html/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[[email protected] ~]#chmod 644 default
[[email protected] ~]# vim default
#default vesamenu.c32 #原文件
default linux #修改
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.6!
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 不配置就是网络安装
#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 -
4.配置NFS
创建共享文件:
[[email protected] ~]# vim /etc/exports
/var/www/html 192.168.8.0/24
验证共享文件
[[email protected] pxelinux.cfg]# exportfs
/var/www/html 192.168.1.0/24
启动NFS服务
[[email protected] pxelinux.cfg]# service nfs start
5.关闭防火墙
[[email protected] pxelinux.cfg]# service iptables stop
按上配置方法,网络安装OS一定可以成功的。如果过程有问题的可以详细查看一下自己的配置是否有错误或者遗漏。
明天有时间把KICKSTART无人值守的配置实验一下。请后续关注。谢谢。有错误的地方欢迎大家给指出。