话说上回遭遇黑店老板的恶意敲诈后,虽然完成了任务,但是事后想想,还是恨恨不已,一把鼻涕辛酸泪啊,有道是男儿流血不流泪,可是,那可是我的血汗钱啊,怎么能不心疼啊,一面骂现在的奸商太黑心,开始为自己的学艺不精找理由,想来想去,没啥好理由,最好得出的结论是,只能怪DELL的机器个性化太强了。
难道安装LINUX非要光盘吗,以前我在自己的机器上硬盘安装过LINUX,但是遇到实际中的场面是该如何解决呢,于是就有了这一篇文章的出生的理由了,我要学会网络安装,这是每个网络管理员必须要会的一个技巧,万一遇到上百台机器的时候,难道一台台的用光盘安装吗,那是不可能的,也会给老板留下不好的。。。
于是乎,开始拿出我的法宝,百度大法,搜了下,网络安装的文章还真不少,我参考了
www.linuxtone.org上的一篇文章,这个文章出来好久了,我也看了N遍了,就是没有实践过,今天有空,一定要试验下,原文链接地址是
只不过文章的环境是CENT OS 5.3,我的环境是RHEL5.4,我几乎是照抄了这个地址上的配置文件,只不过我的IP地址和他的不一样,(哈哈,看到这里,估计有人要开始骂了,说是自己原创的,99%都是山寨别人的,哈哈,所谓天下文章一大抄吗,不抄白不吵,再说了动机不一样啊,我这不是为了个人的利益啊,是学习啊,原创作者别扔臭鸡蛋啊,要仍的话,可以选择含金量高点的东西。。。),扯远了,下面开始正题。
想要网络安装,首先你必须要几个服务,NFS,TFTP,DHCP.
简单原理介绍:无光软驱PC通过PXE网卡启动,从dhcp
服务器获取IP 通过tftp
下载pxe
linux.0
文件找到pxelinux.cfg里的配置文件,按配置文件找着vmlinuz引导centos进入安装界面,之后选择NFS方式安装
系统。
第一步:检查并安装nfs服务软件包
Last login: Fri Oct 23 06:35:15 2009 from 192.168.100.2
[root@rhel5 ~]# rpm -qa |grep nfs-utils
nfs-utils-1.0.9-42.el5
nfs-utils-lib-devel-1.0.8-7.6.el5
nfs-utils-lib-1.0.8-7.6.el5
[root@rhel5 ~]# rpm -ivh protmap......
Last login: Fri Oct 23 06:35:15 2009 from 192.168.100.2
[root@rhel5 ~]# rpm -qa |grep nfs-utils
nfs-utils-1.0.9-42.el5
nfs-utils-lib-devel-1.0.8-7.6.el5
nfs-utils-lib-1.0.8-7.6.el5
[root@rhel5 ~]# rpm -ivh protmap......
以上是安装NFS,然后启动服务验证下。
接着是挂载光驱,也可以是挂载安装的镜像文件。
mount /dev/cdrom /mnt 我是直接把光驱挂载在/mnt下。
第二步:检查并安装TFTP服务。
[root@rhel5 ~]#
[root@rhel5 ~]# cd /media/RHEL_5.4 i386 DVD/Server/
[root@rhel5 Server]# rpm -ivh tftp-
tftp-0.49-2.i386.rpm tftp-server-0.49-2.i386.rpm
[root@rhel5 Server]# rpm -ivh tftp-
[root@rhel5 ~]#
[root@rhel5 ~]# cd /media/RHEL_5.4 i386 DVD/Server/
[root@rhel5 Server]# rpm -ivh tftp-
tftp-0.49-2.i386.rpm tftp-server-0.49-2.i386.rpm
[root@rhel5 Server]# rpm -ivh tftp-
看到了吧,我是把上面的两个安装包都安装上的。安装好之后就要配置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 #添加nobody可以 访问
disable = no #默认是YES,改为NO
per_source = 11
cps = 100 2
flags = IPv4
}
# 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 #添加nobody可以 访问
disable = no #默认是YES,改为NO
per_source = 11
cps = 100 2
flags = IPv4
}
这样就配置好TFTP了。
重启下xinetd服务: /etc/init.d/xinetd restart, 检查下tftp服务的状态是否已经启动了,#chkconfig --list |grep tftp,如果是已经启动那就没问题了。
第三步:前面我们已经安装好NFS服务和TFTP的服务了,接下来我们要配置下NFS服务。之前我们已经把光驱挂载上去了,mount /dev/cdrom /mnt -o loop
接下来需要配置下NFS的配置文件,
echo "/tftpboot *(ro,sync)" > /etc/exports
echo "/mnt *(ro,sync)" > /etc/exports #此二步 设置共享的 目录
exportfs –a #使配置生效
echo "/mnt *(ro,sync)" > /etc/exports #此二步 设置共享的 目录
exportfs –a #使配置生效
好,让我们看下配置好之后的样子
~
[root@rhel5 Server]# vi /etc/exports
/tftpboot *(ro,sync)
/mnt *(ro,sync)
上面就是配置好的NFS配置文件,具体路径你可以按照你的要求自己来安排,不必拘泥于原文。
[root@rhel5 Server]# vi /etc/exports
/tftpboot *(ro,sync)
/mnt *(ro,sync)
上面就是配置好的NFS配置文件,具体路径你可以按照你的要求自己来安排,不必拘泥于原文。
第四步:配置DHCP,如何安装就不说了,我只贴下我的配置文件,大都是抄袭的,呵呵,见笑了
[root@rhel5 Server]#
[root@rhel5 Server]# vi /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# more /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# trad: liuyu
# blog: liuyu.blog.51cto.com
# bbs: www.linuxtone.org
[root@rhel5 Server]# vi /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# more /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# trad: liuyu
# blog: liuyu.blog.51cto.com
# bbs: www.linuxtone.org
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.100.0 netmask 255.255.255.0 {
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.100.1; #..IP
option time-offset -18000; # Eastern Standard Time
"/etc/dhcpd.conf" 31L, 813C
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# more /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# trad: liuyu
# blog: liuyu.blog.51cto.com
# bbs: www.linuxtone.org
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.100.1; #..IP
option time-offset -18000; # Eastern Standard Time
"/etc/dhcpd.conf" 31L, 813C
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# more /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# trad: liuyu
# blog: liuyu.blog.51cto.com
# bbs: www.linuxtone.org
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.100.0 netmask 255.255.255.0 {
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.100.1; #..IP
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.100.12 192.168.100.25; #....IP
default-lease-time 21600;
max-lease-time 43200;
# Group the PXE bootable hosts together
# PXE-specific configuration directives...
next-server 192.168.100.1;
filename "/pxelinux.0"; #........
}
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# more /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# trad: liuyu (我参考的文章的原作者:刘宇)
# blog: liuyu.blog.51cto.com
# bbs: www.linuxtone.org
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.100.1; #..IP
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.100.12 192.168.100.25; #....IP
default-lease-time 21600;
max-lease-time 43200;
# Group the PXE bootable hosts together
# PXE-specific configuration directives...
next-server 192.168.100.1;
filename "/pxelinux.0"; #........
}
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# more /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
# trad: liuyu (我参考的文章的原作者:刘宇)
# blog: liuyu.blog.51cto.com
# bbs: www.linuxtone.org
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.100.0 netmask 255.255.255.0 {
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.100.1; #..IP
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.100.12 192.168.100.25; #....IP
default-lease-time 21600;
max-lease-time 43200;
# Group the PXE bootable hosts together
# PXE-specific configuration directives...
next-server 192.168.100.1;
filename "/pxelinux.0"; #........
}
我只是修改了其中几个IP地址,和原作者的都一样,原文有详细的说明,需要深入学习的可以去看原文。然后我们启动服务,/etc/init.d/dhcpd start
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.100.1; #..IP
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.100.12 192.168.100.25; #....IP
default-lease-time 21600;
max-lease-time 43200;
# Group the PXE bootable hosts together
# PXE-specific configuration directives...
next-server 192.168.100.1;
filename "/pxelinux.0"; #........
}
我只是修改了其中几个IP地址,和原作者的都一样,原文有详细的说明,需要深入学习的可以去看原文。然后我们启动服务,/etc/init.d/dhcpd start
第五步:配置PXE所需的文件,下面的我都是照抄的,呵呵,
Mkdir /tftpboot/pxelinux.cfg
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
cp /mnt/isolinux/vmlinuz /tftpboot/
cp /mnt/isolinux/initrd.img /tftpboot/
cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
cp /mnt/isolinux/vmlinuz /tftpboot/
cp /mnt/isolinux/initrd.img /tftpboot/
cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
配置好了之后,重启下所有服务,我又在VM里面新建了个虚拟机,启动下,居然就成功了,
,那个激动啊。。。。
![](https://i-blog.csdnimg.cn/blog_migrate/3f759ce9e8f2b69c2579fb7845544aa9.png)
本文99%系山寨别人的作品,写在我的博客里面只是为了做个笔记,以备他日不时只需,若能给别人带来帮助,亦感欣慰。。。
最好声明下,我是照着原文作者在虚拟机下试验室成功的,如果你没有成功,需要检查下配置文件,希望和大家一起进步。。。