pex網絡安裝linux系統

PXE遠程網絡安裝linux系統
剛進公司,新人學習各種方式裝linux系統。U盤安裝已經安裝了,現在該網絡安裝系統了。
首先把實驗的環境。如圖:

首先把環境搭建起來,
1、搭建DHCPF服務器
各種方法找到dhcpd-* .rpm,最好在系統ios裏那個。

[root@localhost Desktop]#rpm -ivh dhcpd-* .rpm
[root@localhost Desktop]#rpm -ql dhcpd //查看我們裝了那些dhcpd相關的

[root@localhost isolinux]# vi /etc/dhcpd.conf 
內容:

ddns-update-style interim;
ignore client-updates;

subnet 192.168.3.0 netmask 255.255.0.0 {

# --- default gateway
        option routers                  192.168.0.1;
        option subnet-mask              255.255.255.0;

        server-name "192.168.3.12";
        option nis-domain               "domain.org";
        option domain-name              "domain.org";
        option domain-name-servers      192.168.0.1;

        option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#       option netbios-node-type 2;

        range dynamic-bootp 192.168.3.1 192.168.3.254;
        default-lease-time 21600;
        max-lease-time 43200;
}
         group pxe{
        filename "/pxelinux.0";  //方便找到pxe
        # we want the nameserver to appear at a fixed address
        host test{
                next-server 192.168.3.12;  //nfs服務器
                hardware ethernet E0:CB:4E:CE:6A:17;
                fixed-address 192.168.3.5;   //待安裝主機

        }

}

[root@localhost Desktop]#service dhcpd start

2、配置tftp服務器
安裝就不寫了。修改配置;

[root@localhost isolinux]# vi /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             = -u nobody -s /tftpboot
        disable                 = no             //默認是yes修改爲no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
[root@localhost Desktop]#chkconfig xinetd on
[root@localhost Desktop]#chkconfig  --list | grep tftp

[root@localhost Desktop]#service xinetd start


3、安裝nfs

[root@localhost tftpboot]#mkdir /instsvr

[root@localhost tftpboot]# ll /instsvr/    //放安裝文件
total 3041648
-rwxr-xr-x 1 root root 3111600128 Apr 19 16:05 rhel-server-5.5-i386-dvd.iso

[root@localhost tftpboot]# vi /etc/exports 


/instsvr   *(ro,no_root_squash,sync)

啓動服務

檢測目錄/instsrv是否已被正確共享
[root@localhost tftpboot]# showmount -e localhost
Export list for localhost:
/instsvr *
[root@localhost tftpboot]# service nfs restart

4、引導文件
掛載ios文件
[root@localhost Desktop]# mount -o loop,ro rhel-server-5.5-i386-dvd.iso /media/ios/

[root@localhost isolinux]# cp initrd.img vmlinuz /tftpboot

從系統盤的拷貝initrd.img vmlinuz這兩個文件。

[root@localhost ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot

[root@localhost tftpboot]# cp /media/ios/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

[root@localhost ~]# cd /tftpboot/
[root@localhost tftpboot]# ll
total 9548
-rw-r--r-- 1 root root 7838075 Jun  5 16:33 initrd.img
drwxr-xr-x 3 root root    4096 Jun  5 12:30 linux-install
-rw-r--r-- 1 root root   13148 Jun  5 13:00 pxelinux.0
drwxr-xr-x 2 root root    4096 Jun  5 14:36 pxelinux.cfg
-r--r--r-- 1 root root 1875796 Jun  5 10:59 vmlinuz
[root@localhost tftpboot]# 

[root@localhost tftpboot]# cp /media/ios/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

[root@localhost tftpboot]# ll pxelinux.cfg/
total 8
-rwxr-xr-x 1 root root 366 Jun  5 14:40 default
[root@localhost tftpboot]# 
[root@localhost tftpboot]# vi pxelinux.cfg/default 

default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img
label text
  kernel vmlinuz
  append initrd=initrd.img text
label ks
  kernel vmlinuz
  append ks initrd=initrd.img
label local
  localboot 1
label memtest86
  kernel memtest
  append -


把服務器的服務啓動。安裝選擇網絡啓動就可以了。
 四 、少交互無人職守
[root@localhost ~]# vi /root/anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.

install
nfs --server=192.168.3.5 --dir=/instsvr
key --skip
lang zh_CN.UTF-8
keyboard us
xconfig --startxonboot
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$R3wtqu1.$ego8qNo6O6bXtzv  --改成123456
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --enforcing
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=sda
part /boot --fstype ext3 --size=100 --grow --maxsize=1024
part swap --size=100 --grow --maxsize=2048
part /usr/local --fstype ext3 --size=100 --grow --maxsize=8000
part /usr --fstype ext3 --size=100 --grow --maxsize=4096
part /opt --fstype ext3 --size=100 --grow --maxsize=8459
part /tmp --fstype ext3 --size=100 --grow --maxsize=4096
part /home --fstype ext3 --size=100 --grow --maxsize=2048
part / --fstype ext3 --size=100 --grow --maxsize=50000

%packages
@admin-tools
@base
@chinese-support
@core
@development-libs
@development-tools
@dialup
@editors
@gnome-desktop
@gnome-software-development
@graphical-internet
@graphics
@java
@java-development
@legacy-software-development
@legacy-software-support
@network-server
@office
@printing
@sound-and-video
@text-internet
@web-server
@x-software-development
@base-x
kexec-tools
fipscheck
device-mapper-multipath
sgpio
python-dmidecode
imake
emacs
libsane-hpaio
qt4
vnc-server
dnsmasq
dhcp
krb5-server
mesa-libGLU-devel
xorg-x11-utils
xorg-x11-server-Xnest
xorg-x11-server-Xvfb

[root@localhost ~]# cp /root/anaconda-ks.cfg  /instsvr/ks/ks.cfg

[root@localhost ~]# vi /tftpboot/pxelinucx.cfg/default
[root@localhost tftpboot]# vi pxelinux.cfg/default 

default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
  kernel vmlinuz
  append ks=nfs:192.168.3.5:/instsvr/ks/ks.cfg initrd=initrd.img
label text
  kernel vmlinuz
  append initrd=initrd.img text
label ks
  kernel vmlinuz
  append ks initrd=initrd.img
label local
  localboot 1
label memtest86
  kernel memtest
  append -

把服務開啓,把防火牆關閉!
ok!



附:
當時我會碰到安裝端的網卡引導裏並不能認到,怎麼辦呢?
思路:就是initrd.img有關了。於是上網google去initrd.img
就是把網卡驅動編譯好的加進去。

[root@localhost Desktop]# lspci
01:00.0 Ethernet controller: Atheros Communications Atheros AR8121/AR8113/AR8114 PCI-E Ethernet Controller (rev b0)

這個是我們已經裝好的驅動。都是AR8121/AR8113/AR8114 PCI-E Ethernet Controller

這個值:
[root@localhost Desktop]# vi /lib/modules/2.6.18-194.el5/modules.alias
alias pci:v00001969d00001026sv*sd*bc*sc*i* atl1e
 
[root@localhost Desktop]# ll /lib/modules/2.6.18-194.el5/kernel/drivers/net/atl1e/
total 800
-rw-r--r-- 1 root root 810366 Jun  1 11:28 atl1e.ko

找到已編譯好的網卡atl1e

把atl1e.ko拷貝出來暫時隨便放到一個你可以記的的目錄地下就可以了。我放到/根目錄下
[root@localhost Desktop]# cp /lib/modules/2.6.18-194.el5/kernel/drivers/net/atl1e/atl1e.ko /                                                                              


未完!!                                                











發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章