通过网络安装Linux
时间:Jan.11, 2008 | 分类:Linux
如果你的电脑没有光驱或者光驱丢了,抑或是像我一样光驱坏了。那么就有可能用到这篇文章的内容,翻译自PolishLinux。原文。
但是需要两台电脑,另外一台电脑(本文成为服务器)已安装上了Linux(Windows应该也可以吧,就找到下面要使用的软件的Windows版本应该也可以),并且连接了互联网。
1. 开始下载netboot文件(在服务器上操作)。
比如Ubuntu7.10的netboot文件的获取需要运行命令:
http://archive.ubuntu.com/ubuntu/dists/gutsy/main/installer-i386/current/images/.
netboot/netboot.tar.gz
2. 下载TFTP(在服务器上操作)。
apt-get install tftpd-hpa xinetd
然后创建一个文件/etc/xinetd.d/tftp,写入如下类似的内容
service tftp{disable = nosocket_type = dgram wait = yes user = root server = /usr/sbin/in.tftpd server_args = -v -s /var/lib/tftpboot //共享目录,将netboot文件拷贝到此目录中 only_from = 192.168.1. 127.0.0.1 //这两个IP代表两个IP网段。一般的局域网使用这两个就够用了}
然后重新启动xinetd:
/etc/init.d/xinetd restart
3. 配置DHCP(服务器上操作)
DHCP会帮助我们给我们的客户端自动分配一个IP地址。
安装:
apt-get install dhcp3-server
编辑配置文件/etc/dhcp3/dhcpd.conf
# router localization option routers 192.168.1.254; # network mask option subnet-mask 255.255.255.0; # main DNS server to be used option domain-name-servers 194.74.65.68;# set up if our DHCP server is supposed to be the default one in the network authoritative; # ping allowed ping-check = 1; # important! this is the location of the installation file! filename = "pxelinux.0"; //netboot文件名以及路径,这样在客户端设置为PXE后,会自动从服务器上下载该文件 # subnet IP address subnet 192.168.1.0 # accepted IDs in the netmask netmask 255.255.255.0 { range 192.168.1.10 192.168.1.254; }
这个时候打开要安装Linux的电脑,在BIOS中设置好启动选项为netboot之类的,然后reboot,如果一切正常,客户机会自动链接服务器然后下载DHCP配置文件中指定的文件pxelinux.0,并且通过服务器从互联网上下载安装文件开始安装。
如果运气不好怎么办?GOogLE解决办法。第一次翻译有关PXE的文件,自己还没有尝试过。所以翻译的很不在行。这里有用PXE引导安装SUSE。