Install Linux diskless workstation

Source: Internet
Author: User
Tags nfsd

In those days, the diskless DOS Workstation Under Novell was very popular. Later, Win95 diskless workstation was popular, but due to a lot of problems, Microsoft stopped its support for diskless Windows. With the increasing popularity of Linux, more and more people are using Linux. In fact, Linux supports remote boot very well. The Linnx kernel itself supports network file systems, so it is very suitable for non-disk workstation, this document describes how to install a diskless Linux workstation by using an instance.
This network is a small LAN, with one server and four Linux diskless workstations connected to each other using twisted pair wires through the HUB. The IP address of the server is 192.168.0.80 and the name is server, the addresses of the five diskless workstation are dynamically allocated by the server. The addresses range from 192.168.0.1 to 192.168.0.4, And the names are c1, c2, c3, c4, and the server and diskless workstation use NE2000 compatible NICs, the BOOTROM boot chip is installed on the NIC used by the diskless workstation. The RedHat Linux 6.0 is installed on the server operating system. During installation, you can choose custom installation and install all the software.
Linux Remote Boot has two ways, one is to use the Bootp protocol, there is a dedicated project EtherBoot to provide support (http://www.slug.org.au/etherboot/), this way to guide Linux is the fastest, however, the biggest problem with this method is that the BOOTROM boot chip that supports this Remote Boot Protocol cannot be found on the market unless it is burned by itself ), because almost all BOOTROM boot chips on the market follow the NOVELL Remote Boot Protocol, some people propose another method, that is, the server uses the NetWare server, the client can use the existing BOOTROM to start the chip. Everyone must be confused here. Isn't a Linux diskless workstation still a NetWare server? No, because the vast majority of Linux can simulate NetWare servers, just like Samba can simulate Linux as NT, mars_nwe can simulate Linux as NetWare, not only providing NetWare File and printing services, we can also provide Remote Boot support (know how powerful Linux is). This article describes how Linux diskless workstation uses this method for Remote Boot.
Prepare a boot disk

Since there is no tool in Linux that complies with the NetWare Remote Boot Protocol to start the image, you can only use the tool provided by earlier Win95 (sorry ). Find a machine with Win95 and press F8 to enter the pure DOS mode. format a:/s and copy loadlin.exe under the dosutils directory on the RedHat Linux installation disc to the boot disk, make an autoexec on the boot disk. bat file. The Code contains only one line of loadlin.exe bzImage root =/dev/nfsroot. Extract rplboot from the cab file in the Win95 directory of the Windows 95 installation disc. run the following command to place the sys file on the boot disk:
Extract.exe/a/l a: \ The win95-27.cab rplboot. sys
A boot disk is ready for the startup image. It is saved and will be used for the startup image later.
Compile the kernel
The Linux kernel for a diskless workstation is different from the Linux kernel for booting from a local hard disk. The kernel for a diskless workstation must support NFS as the root file system, that is, the remote root file system, therefore, the dedicated kernel of the diskless workstation must be compiled. The kernel code version used by the author is 2.2.16. decompress the kernel source code to/usr/src, and run cd/usr/src/linux to enter the kernel subdirectory. Run make menuconfig to compile and configure the kernel, the following items must be set as required:
Processor type and features the options under this project must be set based on the CPU type of the diskless workstation, rather than based on the CPU type of the server
Loadable module support all options under this project are prohibited, that is, the module function is not supported.
Plug and Play support is set to valid
Block devices
Loopback device support
Network block device support
Set to valid
Networking option
Kernel level autoconfiguration
DHCP support (NEW)
Set to valid
Network device support the options under this project must be set according to the NIC used by the diskless workstation. In this example, the NE2000 compatible Nic is used.
Ethernet (10 or 100 Mbit)
Other ISA cards
NE2000/NE1000 support (NEW)
Set to valid
Filesystems under the Network File Systems sub-project under this project
NFS filesystem support
Root file system on NFS (NEW)
Set to valid
After the preceding settings are complete, exit the kernel compilation setup program and a dialog box is displayed: Do you wish to save your new kernel configuration?
Then execute make dep & make bzImage to compile the kernel. This process takes a little time, especially if the computer is not fast, it takes a longer time. If no kernel compilation error occurs, the kernel image file/usr/src/linux/arch/i386/boot/bzImage will be obtained, and the boot floppy disk will be inserted into the computer, run the following command: mount-t vfat/dev/fd0/mnt/floopy cp/usr/src/linux/arch/i386/boot/bzImage/mnt/floppy umount/dev/fd0.
All right, the files on the boot disk are ready. Use it to create a startup image in the Win95 environment later. Server Settings
The server needs to run several service processes such as nfsd, dhcpd, and mars_new. These software are available in the ReHat Linux release kit. If you choose to install all the software when installing Linux, these software will be installed along with the installation of the operating system. Next we will set these software. Note that the following operations should be performed as root.
1. NFS Daemon nfsd
First, create several directories for the diskless workstation and export them through nfsd. The command is as follows:
Mkdir/tftpboot
Edit the/etc/hosts file and add the following content.
192.168.0.80 server. domain
192.168.0.1 c1 c1.domain
192.168.0.2 c2 c2.domain
192.168.0.3 c3 c3.domain
192.168.0.4 c4 c4.domain
The working directory of the first workstation is set as follows:
Mkdir/tftpboot/192.168.0.1
Cd/tftpboot/192.168.0.1
C000p-a/bin.
Cp-a/dev.
Mknod dev/nd0 B 43 0
Chmod 600 dev/nd0
Cp-a/etc.
Cp-a/home.
Cp-a/lib.
Rm-rf lib/modules
Cp-a/root.
Cp-a/sbin.
Cp-a/var.
Mkdir proc
Mkdir usr
Mkdir tmp
Chmod 777 tmp
Touch fastboot
Chattr + I fastboot
Cd etc edit file sysconfig/network-scripts/ifcfg-eth0
Retain
DEVICE = eth0
ONBOOT = yes
Delete all other rows and add one row
BOOTPROTO = dhcp
Edit the rc. d/rc. sysinit file and add two lines at the end of the file.
Mount-t nfs server:/usr
/Usr/X11R6/bin/xfs
Edit file fstab
Retain
None/proc defaults0 0
Delete all other rows and add one row
Server:/tftpboot/192.168.0.1/nfs defaults1 1
Setting the working directory of other workstations is much easier.
Cd/tftpboot
Cp-a 192.168.0.1 192.168.0.2
Cp-a 192.168.0.1 192.168.0.3
Cp-a 192.168.0.1 192.168.0.4
Edit the/etc/exports file and add the following content:
/Usr (ro, no_root_squash)
/Tftpboot/192.168.0.1 (rw, no_root_squash)
/Tftpboot/192.168.0.2 (rw, no_root_squash)
/Tftpboot/192.168.0.3 (rw, no_root_squash)
/Tftpboot/192.168.0.4 (rw, no_root_squash)

2. Dynamic Host Configuration Protocol server dpchd
Check whether the/etc/dhcpd. leases file exists. If it does not exist, run the touch/etc/dhcpd. leases command to create a file, edit the file/etc/dhcpd. conf, and add the following content.
Subnet 192.168.0.0 netmask 255.255.255.0 {
Range 192.168.0.1 192.168.0.4;
}
3. NetWare simulator marsw_nwe
Edit the/etc/nwserv. conf file and find the following line.
#40x10 eth0 802.3 1
Remove '#' at the beginning of the row and then find
40x0*802.3 1
Add '#' at the beginning of the row '#'
Create startup Image
Enter Win95, copy the admin \ nettools \ netsetup \ rplimage.exe file on the installation disc to the hard disk, and insert the boot floppy disk into the soft drive, then execute rplimage a in the pure MSDOS mode: the startup image net $ dos will be obtained. sys, and then start the image net $ dos. copy sys to the boot disk (if there is not enough space for the boot disk, You can first delete some files on the boot disk to leave space ).
Start the Linux server, log on as the root user, and insert the boot floppy disk into the soft drive, run the following command mount-t vfat/dev/fd0/mnt/floppy cp/mnt/floppy/net \ $ dos. sys/var/mars_nwe \ sys \ login umount/dev/fd0 and then execute setup. Move the light stick to the System services option and press Enter. The Services setting screen appears. Set dhcpd, nfs, if both mars-nwe are valid, exit the setup program and run the following command to start the above service process:
/Etc/rc. d/rc3.d/* mars-nwe restart
/Etc/rc. d/rc3.d/* dhcpd restart
/Etc/rc. d/rc3.d/* nfs restart
The preceding service process is automatically executed when the server is restarted next time.
So far, all the settings have been completed. After connecting the network to open a diskless workstation, wait a moment and the Remote Boot information will appear. Then, Win95 will be started, and Linux will soon be loaded, after a lot of Linux Startup information, if you see the Linux logon prompt, it indicates that the remote startup is successful.
Although the Linux diskless workstation is running, another problem is the exchange problem, because Linux is an operating system that supports virtual storage. When the machine memory is insufficient, linux will swap out the data temporarily not used in the memory to the swap device, and then change it back when necessary. We didn't set the swap zone just now. We will find that the swap zone is zero by running the free command on the diskless workstation, if the diskless workstation has a large memory and runs some small programs without a swap zone, the problem may occur if it runs large programs, the following describes how to set a swap zone, that is, a remote swap, on the server.
For kernels earlier than version 2.1.101, it is a little troublesome to implement remote exchange. You have to download the patches from the network to modify the kernel code, and then compile the kernel image. The kernel after version 2.1.101 supports Network Block devices, which makes it easy to implement remote switching. First, make the Network block device support option valid when compiling the kernel (this was just done when the kernel was compiled), and then use http: // atrey. karlin. mff. cuni. cz /~ Pavel/nbd/nbd.html download utility nbd.14.tar.gz and execute the following command
Tar zxvf nbd.14.tar.gz
Cd nbd
./Configure
Make
After compilation, the files nbd-server and nbd-client will be obtained and copied to/usr/sbin:
Cp nbd-server nbd-client/usr/sbin
Edit the file/etc/rc. d/rc. sysinit and add a line at the end of the file.
/Usr/sbin/nbd-server 7999/tftpboot/% s/swap>/dev/null &
Run the preceding command to activate the nbd service:
/Usr/sbin/nbd-server 7999/tftpboot/% s/swap>/dev/null &
The preceding command is automatically executed at the next server startup.
Create a swap file for each diskless workstation in the directory of each workstation on the server (/tftpboot/192.168.0.1,/tftpboot/192.168.0.2, etc.). The command is as follows (in this example, the swap area is 32 MB):
Dd if =/dev/zero of = swap count = 32768 bs = 1024
Mkswap swap
Add the last two lines of the file/etc/rc. d/rc. sysinit under each workstation directory
/Usr/sbin/nbd-client server 7999/dev/nd0
Swapon/dev/nd0
In this simple way, open the diskless workstation and try to log on to the system after the startup is successful. Execute the free command and you will see the following line at the end of the display information:
Swap: 32764XX XXXX
This indicates that the swap zone is successfully set.
Through the above steps, a complete Linux diskless workstation network is ready, and the usage of Linux diskless workstation is flexible, which can be used like a common diskless workstation, the diskless workstation can also be used as a terminal for other Unix hosts, especially X terminals, to run X applications on remote Unix hosts.


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.