Installation using a lxc container

From TASTE
Jump to: navigation, search

Introduction

This chapter gives the steps to create an lxc container from a Debian buster installation, and install TASTE inside.

Install and configure LXC

You can skip this part if you are already familiar with LXC containers.

$ apt install lxc dnsmasq-base

Then setup the network: edit /etc/lxc/default.conf and replace everything with the following

lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx

Then edit or create /etc/default/lxc-net and put only the following line inside:

USE_LXC_BRIDGE = "true"

Once this is done, type:

$ systemctl restart lxc-net

After that, if you run the command:

$ ip a

you should see in the list an interface named "lxcbr0" with an ip address.

Create a new container

as sudo:

$ lxc-create -t download -n taste

select a linux distribution: debian buster amd64 Alternatively you could have built it directly:

$ lxc-create -t debian -n hello

You can then run the container:

$ lxc-start -n taste

If you later want to stop it and destroy it:

$ lxc-stop -n taste
$ lxc-destroy -n taste

Enter the container and install TASTE

To enter the running container type the following:

$ lxc-attach -n taste


This is a bare debian installation, missing nearly everything. Before installing TASTE, you must install git and sudo:

$ apt install git sudo

You must also replace dash with regular bash in Debian:

$ cd /bin ; rm sh ; ln -s bash sh ; cd -


Create a new user in the container

It is important to create a user, because if you later want to remotely access your container with ssh, you may have trouble connecting to the root account (the openssh default configuration prevents it for security reasons).

$ adduser taste   # it will prompt for a password, you may ignore the other questions

You should then grant passwordless sudo access to the new user by adding the following line to the file /etc/sudoers:

taste  ALL=(root) NOPASSWD: ALL
$ su - taste      # log in as taste

Then clone TASTE repos

$ git clone https://gitrepos.estec.esa.int/taste/taste-setup tool-src
$ cd tool-src

VERY IMPORTANT AT THIS POINT: CHOOSE THE BRANCH FOR TASTE - DON'T REMAIN IN MASTER

The current version of taste for Debian is "feature_buster"

$ git checkout feature_buster
$ ./Update-TASTE.sh

If you didn't grant sudo to the taste user before, at some point it will break asking you to do it. Just follow the instructions then run Update-TASTE again to resume the installation.

It will take a few minutes to complete the installation of all dependencies and TASTE tools in the container.

After that, one last thing to do is add all the PATH updates, by adding the following line into the ~/.bashrc file:

source ~/.bashrc.taste

Voilà: TASTE is installed.

Except that... only the command line tools will work.

In order to use the GUIs you must install an X forwarding server.

Install x2go

The easiest option to get a full, fast and secure remote access to your newly-created TASTE container is to install the x2go server in the container, and x2go client on the host machine (clients exist for Linux, Windows and Mac).

x2go server in the container

Run this command:

 $ sudo apt install ssh x2goserver

In some situations, you may need to change the password rules for the ssh server in this file: /etc/ssh/sshd_config, and you may need to restart the server using:

$ sudo service sshd restart 

... but most of the time, the ssh connection should work out of the box.

Take note of the IP address of the server like this:

 $ ip a | grep global
   inet 10.0.3.169/24 brd 10.0.3.255 scope global dynamic eth0

x2g client on the host (or any machine on the network)

On Debian and Ubuntu (starting from 18.04) you can install the client in one command:

$ sudo apt install x2goclient

and run it:

$ x2goclient

Create a new session by specifying your container user name, password, and select Terminal session.

ClipCapIt-200729-143229.PNG


When you launch the session, type in your password and you will see an xterm session open.

ClipCapIt-200729-143114.PNG

You are ready to work with TASTE !

ClipCapIt-200729-143144.PNG