Make compute server diskless with LTSP

Introduction

I manage a calculation server for students at a certain laboratory of a certain university. Maintenance has not kept pace with the increase in computing servers, and software updates are also intense. In the first place, the root of all evil is that the OS is installed on each server. Reduce management costs with Preboot eXecution Environment (PXE) Boot, which boots the OS from a LAN. Use Linux Terminal Server Project (LTSP) to manage hosts.

What can you do with PXE / LTSP?

https://ltsp.org/ Roughly speaking, what you can do

It's super easy to make a copy of a pre-configured server.

is. There is no need to install the copy destination OS. There is no need to set up SSH or HDD in the first place.

0. Preparation

Things to prepare

--LAN environment --Two PCs

environment

DHCP settings are required for PXE boot, but this time we will use a function called DHCP proxy. The DHCP server that comes with the router is used as it is, and there are no special settings.

In my environment, accounts are managed by NIS and NFS. I will explain so that it can be used even without these management systems. However, from the viewpoint of availability, we recommend using NIS or NFS for account management and data redundancy.

In this article, we will check the operation on ʻUbuntu Server 18.04.3`. Host a reasonably good workstation. Dependency troubles are a hassle, so I'll start with a clean install.

When deploying a GPU environment, plug the GPU into both the host and the client. Due to the GPU driver's convenience, it may be necessary to turn off Secure Boot in the BIOS. It may work without a GPU on the host, but it's unconfirmed.

Internet <--> Router(DHCP) <--(HUB)--> Host
                                |--> Client_1
                         NIS <--|--> Client_2
                         NFS <--|--> Client_n

1. Introduction of LTSP

Installation

Deploy LTSP on the host machine. Follow the LTSP Installation Page (https://ltsp.org/docs/installation/).

$ sudo apt -y purge --auto-remove indicator-application mate-hud snapd
$ sudo apt -y install synaptic
$ sudo add-apt-repository -y ppa:ltsp
$ sudo apt update
$ sudo apt -y install --install-recommends ltsp ltsp-binaries dnsmasq nfs-kernel-server openssh-server squashfs-tools ethtool net-tools epoptes

LTSP initial settings

There are small options, but in most environments the default settings are fine. See the LTSP Installation Page (https://ltsp.org/docs/installation/) and Documentation (https://ltsp.org/man/) for more information.

$ sudo ltsp dnsmasq
$ sudo install -m 0660 -g sudo /usr/share/ltsp/common/ltsp/ltsp.conf /etc/ltsp/ltsp.conf
$ sudo ltsp image /
$ sudo ltsp ipxe
$ sudo ltsp nfs
$ sudo ltsp initrd

At this point, you are ready to boot. Let's start from the client and check if you can log in. Enable Network Boot (PXE BOOT) from the BIOS settings and give priority to LAN in the boot order. By default, / home is already mounted with NFS, so this may be sufficient for your environment.

2. SSH remote access settings (Option)

The compute server must be connected via SSH. Enable SSH and set static IP. You need the MAC address of each server.

Create an SSH host key for the client

$ sudo mkdir -p /etc/ltsp/etc/ssh
$ sudo ssh-keygen -A -f /etc/ltsp
$ sudo mv /etc/ltsp/etc/ssh/ssh_host_* /etc/ltsp/ #Move because the key is not generated where you expected
$ sudo rm -r /etc/ltsp/etc/

Add SSH settings

$ sudo vim /etc/ltsp/ltsp.conf
[clients]
KEEP_SYSTEM_SERVICES="ssh"
POST_INIT_CP_KEYS="mv /etc/ltsp/ssh_host_* /etc/ssh/"

Add static IP settings for each client

$ sudo vim /etc/ltsp/ltsp.conf
[00:11:22:33:44:55]
HOSTNAME="client1"
KERNEL_PARAMETERS="ip=192.168.0.10:\${srv}:\${gateway}:\${netmask}"

3. GPU Settings (Option)

If you use Nvidia GPU, install nvidia-driver on the host. Install CUDA as well. No additions are required to the LTSP settings. However, when I connect the display to the GPU, the screen sticks out. (investigation in progress)

$ wget https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.105_418.39_linux.run
$ sudo sh cuda_10.1.105_418.39_linux.run --silent --driver --toolkit

4. NIS and NFS Settings (Option)

Configure NIS on the host. No NFS is configured on the host. You need to add a description of FSTAB to enable NFS on the client. This article CentOS 7 (new server in the laboratory) setting memo may be helpful.

$ sudo vim /etc/ltsp/ltsp.conf
[clients]
FSTAB_HOME="file-server:/home /home nfs defaults"

5. Operation

If you change the host environment or LTSP settings, you need to do the following: Then restart the client and it will take effect.

$ sudo ltsp image /
$ sudo ltsp ipxe
$ sudo ltsp nfs
$ sudo ltsp initrd

at the end

I will write a memorandum here as a material to be handed over to my successor. If you have any questions or mistakes, please leave a comment.

Recommended Posts

Make compute server diskless with LTSP
Make PLEN Control Server compatible with ViVi PLEN2
Tftp server with Docker
Make Lambda Layers with Lambda
Make Yubaba with Discord.py
How to make an HTTPS server with Go / Gin
Proxy server with Docker
Make slides with iPython
Local server with python
Let's make Othello with wxPython
Easy to make with syntax
Make Puyo Puyo AI with Python
Let's make dice with tkinter
Make a fortune with Python
Easy HTTP server with Python
Server management with Jupyter (1) import
Make a fire with kdeplot
Make Slack chatbot with Errbot