In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the method of starting Linux without disk". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the method of starting Linux without disk.
Diskless startup means that a client computer does not have any disk storage media when it boots the operating system. In this case, the computer can load the kernel and root file system from a remote NFS server over the network. Several different methods may be used to load the kernel and root file system from the NFS server: RARP,BOOTP or the DHCP protocol. In this tutorial, I will use the BOOTP/DHCP protocol because they are supported by most network cards.
Advantages of diskless computers
Imagine that you have 30 computers in your office, each of which needs to use the same application. What would you do if you were the administrator of these computers? If you install applications on every computer, it's just a waste of your time. On the other hand, a diskless system can solve your problem. With a diskless system, you only need to install the required programs on the central NFS server, and then start the 30 clients over the network.
What do you need?
Two or more Linux computers equipped with network cards that support the DHCP protocol. These computers that will play the role of NFS server should be equipped with hard drives, and other clients do not need any hard drives. The server and client need to connect to the same local network.
It takes five steps to set up a diskless system.
Install the required packages
Configure the TFTP server
Configure the DHCP server
Configure the NFS server
Start the diskless client
In this tutorial, I assume that the computer that starts the server is running Ubuntu. The principle is the same as how you are using other Linux distributions.
* step: install the required packages
Use the apt-get command to install all the required packages as follows.
$sudo apt-get install dhcp3-server tftpd-hpa syslinux nfs-kernel-server initramfs-tools step 2: configure the TFTP server
The TFTP server is a small FTP server that is needed to automatically transfer startup files between clients and servers on the local network.
Add the following line to / etc/default/tftpd-hpa:
RUN_DAEMON= "yes" OPTIONS= "- l-s / var/lib/tftpboot/"
Next, create a startup folder.
$sudo mkdir-p / var/lib/tftpboot/pxelinux.cfg
Copy the bootstrapper image.
$sudo cp / usr/lib/syslinux/pxelinux.0 / var/lib/tftpboot
Create a default startup configuration file as follows.
$sudo vi / tftpboot/pxelinux.cfg/defaultLABEL UbuntuKERNEL vmlinuzAPPEND root=/dev/nfs initrd=initrd.img nfsroot=10.10.101.1:/nfsroot ip=dhcp rw
Note:
"root=/dev/nfs" represents the network file system on the server (no modification is required).
"initrd=initrd.img" is a startup script for system startup.
"nfsroot=10.10.101.1/nfsroot" indicates the IP address of the server and the name of the NFS shared folder. Replace the IP address with your server address.
"ip=dhcp" means that the client computer uses the DHCP addressing scheme.
"rw" means that the NFS share is readable / writable.
* restart the TFTPD service.
Sudo / etc/init.d/tftpd-hpa restart step 3: configure the DHCP service
You also need to configure the DHCP service on the NFS server to allow startup using / var/lib/tftpboot/pxelinux.0. Assuming that you are using 10.10.101.0 as a subnet, your configuration may look like this.
$sudo vi / etc/dhcp3/dhcpd.confallow booting;allow bootp; subnet 10.10.101.0 netmask 255.255.255.0 {range 10.10.101.2 10.10.101.254; option broadcast-address 10.10.101.255; option routers 10.10.101.1; filename "/ pxelinux.0";}
Then restart the DHCP service.
$sudo service isc-dhcp-server restart step 4: configure the NFS server
Create a folder that holds the client root file system directory.
$sudo mkdir / nfsroot
Next, set up the NFS server to export the client root file system. Add the following line to / etc/exports to achieve this.
/ nfsroot * (rw,no_root_squash,async,insecure,no_subtree_check)
Run the following command to reload the modified / etc/exports.
$sudo exportfs-rv
By default, Ubuntu does not provide network startup support in initrd images. So you need to create a new initrd.img file. First add the following lines to / etc/initramfs-tools/initramfs.conf.
BOOT=nfsMODULES=netboot
Then run the following command to create a new initrd.img.
$sudo mkinitramfs-o / var/lib/tftpboot/initrd.img
Copy the new kernel image file to / var/lib/tftpboot.
$sudo cp / boot/vmlinuz- `uname-r` / var/lib/tfftpboot/vmlinuz
It's time to copy the entire root file system into / nfsroot.
Assuming you are using a completely new Ubuntu server installation, you only need to copy the file system to the root of NFS.
$sudo cp-ax / / nfsroot
Then open / nfsroot/etc/fstab through a text editor and add the following line.
/ dev/nfs / nfs defaults 1 1
The folder / var/lib/tftpboot should have global read and write permissions. Otherwise, the client cannot boot from the network.
$sudo chmod-R 777 / var/lib/tfftpboot
* * to avoid any server setting errors, I recommend using static IP for NICs running DHCP service. For example, if the network card is named eth0, the configuration in your / etc/network/interfaces should look like this:
Iface eth0 inet static address 10.10.101.1 netmask 255.255.255.0 broadcast 10.10.101.255 network 10.10.101.0 step 5: start the diskless client
After you have completed the configuration on the server, start your client from the network. To boot from the network, you only need to change the startup priority in the BIOS settings.
If the client starts successfully, your diskless environment is configured. You can add one or more client computers without making any changes.
Thank you for your reading, the above is the content of "the method of starting Linux without disk". After the study of this article, I believe you have a deeper understanding of the method of starting Linux without disk, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.