With the continuous development of embedded card Publishing, it is common to add NFS services and ftp protocols to the platform. How can we build such a platform? The following describes the implementation steps in detail.
I. Introduction
Brief Introduction: the non-optical drive server starts with the PXE Nic, obtains the IP address from the dhcp server, downloads the pxelinux.0 file through tftp, and finds the pxelinux. in the configuration file of cfg, find vmlinuz from the configuration file to guide centos to the installation interface, and then select NFS service mode to install the system.
In addition, if you need to install the Kickstart Software Package automatically, this article does not discuss how to install and configure it.
II. Environment Description
Test environment and software used in this article
Server: centos 5.2 dhcp nfs tftp ip: 192.168.1.133 (this IP address only needs to be connected to the Server Nic, No matter what)
Iii. installation and configuration process and basic explanation:
Install the appropriate software: yum-y install dhcp * nfs * tftp *
1. Configure tftp more/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.
- # Trad: liuyu
- # Blog: liuyu.blog.51cto.com
- # Bbs: www.linuxtone.org
- Service tftp
- {
- Disable = no # The default value is yes to no.
- Socket_type = dgram
- Protocol = udp
- Wait = yes
- User = root
- Server =/usr/sbin/in. tftpd
- Server_args =-u nobody-s/tftpboot # Add nobody for access
- Per_source = 11
- CPIs = 100 2
- Flags = IPv4
- }
Restart the xinetd service:/etc/init. d/xinetd restart
Check whether tftp is Enabled: # chkconfig -- list | grep tftp
Tftp: on
2. Configure the nfs service
- Mount/iso/CentOS-5.2-i386-bin-1of6.iso/mnt-o loop # I am mounting the image file, you can mount the optical drive
- Echo "/tftpboot * (ro, sync)">/etc/exports
- Echo "/mnt * (ro, sync)">/etc/exports # Set the shared directory in this step.
- Exportfs-a # Make the configuration take effect
- /Etc/init. d/portmap start &/etc/init. d/nfs start # restart the service
- Showmount-e localhost # view shared directories
- Export list for localhost:
- /Mnt *
- /Tftpboot *
3. Configure dhcp
Copy my configurations directly
- # 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.1.0 netmask 255.255.255.0 {
- Option routers 192.168.1.htm;
- Option subnet-mask limit 255.0;
- Option domain-name-servers 192.168.1.20.; # local IP Address
- Option time-offset-18000; # Eastern Standard Time
- Range dynamic-bootp 192.168.1.12 192.168.1.254; # IP address to be partitioned
- Default-lease-time 21600;
- Max-lease-time 43200;
- # Group the PXE bootable hosts together
- # PXE-specific configuration directives...
- Next-server 192.168.1.htm;
- Filename "/pxelinux.0"; # Easy to find configuration files
- }
- /Etc/init. d/dhcpd start service
4. Configure the file Mkdir/tftpboot/pxelinux. cfg required by pxe.
- 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
Iv. Test
Start the server. Generally, press F12 to start the PXE network. Then, the IP address is automatically obtained and the Boot interface is displayed. Press linux text to enter. Then select NFS to install the system.
5. Detailed description of the configuration file
Descriptions of dhcpd. conf configuration:
Parameters ):
Ddns-update-style configure DHCP-DNS interactive update mode
Default-lease-time specifies the length of the default lease time, in seconds
Max-lease-time specifies the maximum lease time length, in seconds
Hardware specifies the NIC interface type and MAC address
Server-name notifies DHCP Client server name
Get-lease-hostnames flag check the IP address used by the client
The fixed-address ip address is assigned to the client as a fixed address.
Authritative rejects incorrect IP address requirements
Declarations statement ):
Shared-network is used to tell if some sub-networks share the same network.
Subnet describes whether an IP address belongs to this subnet.
Range starting IP address termination IP address range that provides dynamic IP Address Allocation
For host names, refer to special hosts.
Group provides a declaration for a group of parameters.
Whether the allow unknown-clients or deny unknown-client dynamically allocates IP addresses to unknown users
Whether or not allow bootp or deny bootp responds to the activation Query
Whether allow booting or deny booting responds to user queries
The name of the file whose filename starts to start. It is applied to the diskless workstation.
Next-server: sets the host name to be installed on the server from the boot file and applies to diskless workstation.
Option ):
Subnet-mask Sets the subnet mask for the client
Domain-name specifies the DNS name for the client
Domain-name-servers specifies the DNS server IP address for the client
Host-name: Specifies the host name of the client.
Routers sets the default gateway for the client
Broadcast-address: Set the broadcast address for the client.
Ntp-server sets the server IP address for the client's Network Time
Time-offset is the offset time set by the client and Greenwich Mean time, in seconds.