Linux NFS Application Case Analysis

Source: Internet
Author: User

In LInux applications, we will mainly explain the NFS configuration this time. First, let's take a look at the Linux NFS applications in this regard. Next we will analyze and solve the problem from a specific project. I hope to help you understand this aspect.

Project requirements

In the production environment, we sometimes need to deploy a large number of servers with the same system. When the number reaches a certain level, it is very time-consuming and tedious to install each server separately, therefore, automatic installation of network boot is an important solution to the problem.

Project Analysis

To achieve unattended network installation, first of all, the networks between these computers are not faulty and can be guided from the network. Next, we need a server where the source files are installed, it provides services such as DHCP, PXE, TFTP, Linux NFS, Kickstart, HTTP (optional), and DNS (optional. The following lists the roles of each service in this project:

PXE: Works in the C/S network mode. It allows workstation to download images from remote servers over the network, and thus supports the startup process of operating systems from the network. (This service is provided by the NIC of our client by default.) DHCP: the IP address must be assigned to the client because the PXE is based on the TCP/IP protocol, the location of the client TFTP Server is also shown here.

TFTP: During PXE boot, we need to use the TFTP protocol to download our kernel and initrd files, as well as the related startup selection configuration file menus. Our server TFTP service provides these two files. With these two files, we can boot the system and install it over the network (such as FTP and NFS ).

Kickstart: Linux NFS system installation configuration file. When we manually install the file, the configuration in each step is saved as a ks file, which records the settings required for installing the entire system, this includes a large amount of information such as installed packages and partitions. When the client installs the system with this configuration file, we do not have to manually complete the installation every time.

Linux NFS: After the system starts to boot, we use Linux NFS as the installation source for ease of configuration and ease of use ), you only need to share the installation file directory with Linux NFS on the server. DNS: if we want to automatically set the hostname of each client after it is installed, we can use reverse DNS resolution to let the client obtain its own hostname. HTTP: here we use the HTTP method to obtain the client ks file for multiple exercises. If you are in trouble, you can use the NFS method.

Implementation Process

Configure DHCP first to ensure that your DHCP service has been installed. Run vim to enable/etc/dhcpd. conf. Add the following content to it: allow bootp; allow booting; # It doesn't matter if it is not added here. It will be available by default.

 
 
  1. Option domain-name "lenovo.cn ";
  2. Option domain-name-servers ns.lenovo.cn;
  3. Default-lease-time 600; # default lease time
  4. Max-lease-time 7200; # maximum lease time
  5. Next-server 192.168.0.32; # TFTP server address, which is still specified as the Local Machine
  6. Filename "pxelinux.0"; # a configuration file loaded by the NIC ROM
  7. Subnet 192.168.0.0 netmask 255.255.255.0 {
  8. Range 192.168.0.100 192.168.0.110; # IP Address allocation range
  9. Option domain-name-servers 192.168.0.32; # DNS server address
  10. Option routers 192.168.0.1; # gateway address}

To configure TFTP, you must first install the TFTP service: tftp. i386 0: 0. 49-1.fc10 tftp-server-0.49-1.fc10.i386 because it will go to/tftpboot by default to find the file, so we find that the directory is not created. First, copy a file:/usr/lib/syslinux/pxelinux.0 to/tftpboot.

Next, we will copy all the files in isolinux under the CD directory to the/ftpboot directory, and modify the two file names (to expand the function in the future, we will change the name of each system kernel separately ). Mv initrd. img initrd. fc10.img mv vmlinuz. fc10

Then, create the/tftpboot/pexlinux. cfg directory, create the default file below, and edit it: default bootlocal # Start from local by default

 
 
  1. Prompt 1
  2. Timeout 60 # timeout
  3. Label bootlocal
  4. Localboot 0
  5. Label fedora

Kernel vmlinuz. fc10 # kernel and initialization image append initrd = initrd. fc10.img ramdisk_size = 65536 ks = http: // 192.168.0.32/fc10Install. ks # specifies the ks File Retrieval path. Here I have made a simple configuration.

For details, refer to the wiki on the Internet. Finally, let's start the TFTP service and modify/etc/xinetd. d/tftp: Modify two of them: disable = no # enable the TFTP service
Server_args =-s/tftpboot # Set the root directory of the server to/tftpboot

Configure NFS to share the files required for installation. You need to share the directory of the installation files (copy all files under the CD to that directory). The configuration is as follows: /FC10Install 192.168.0.0/24 (ro, sync) Configure DNS (optional) reverse resolution of the network segment allocated by DHCP In the DNS. For details, see DNS service setup.

After the ks file is installed in our system, there is a anaconda-ks.cfg in the root home directory, we install a Configuration Tool system-config-kickstart. Use this tool to open our existing anaconda-ks.cfg file, pay attention to the selected text installation interface and automatically restart after installation.

In addition, if you need to run some scripts after Installation, you can modify the Post-Installation section. After modification, save it as a file. If HTTP is provided to the client, it can be saved to the/var/www/html/directory. Note that the permission is changed to 644. Here is an example of my ks file:

6. Configure apache (optional) If you have previously performed a VM or changed the default website home directory, you can change it back to the default status.

7. Start various services:

 
 
  1. service dhcpd restart  
  2. service xinetd restart  
  3. service nfs restart  
  4. service named restart   
  5. service httpd restart  

Restart the client and set the BIOS to start from the network. Observe the startup process. Summary This article describes how to set up an automatic installation process for a network-based Linux system, which is used in actual production environments and can save a lot of human resources, in addition, it can expand the network-building system rescue mode, and even build a Linux system diskless workstation started from the network.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.