Difference between revisions of "Installation using a lxc container"

From TASTE
Jump to: navigation, search
Line 57: Line 57:
  
  
this is a bare debian installation, missing nearly everything. Before installing TASTE, you must install git and sudo:
+
This is a bare debian installation, missing nearly everything. Before installing TASTE, you must install git and sudo:
  
 
  $ apt install git sudo
 
  $ apt install git sudo
Line 65: Line 65:
 
  $ cd /bin ; sudo rm sh ; sudo ln -s bash sh ; cd -
 
  $ cd /bin ; sudo rm sh ; sudo ln -s bash sh ; cd -
  
Then clone TASTE repos  
+
 
 +
== 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
 +
 
 +
Then clone TASTE repos
  
 
  $ git clone https://gitrepos.estec.esa.int/taste/taste-setup tool-src
 
  $ git clone https://gitrepos.estec.esa.int/taste/taste-setup tool-src
Line 76: Line 83:
 
  $ git checkout feature_buster
 
  $ git checkout feature_buster
 
  $ ./Update-TASTE.sh
 
  $ ./Update-TASTE.sh
 +
 +
At some point it will break asking you to update the sudoers file. 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.
 
It will take a few minutes to complete the installation of all dependencies and TASTE tools in the container.
Line 83: Line 92:
 
  source ~/.bashrc.taste
 
  source ~/.bashrc.taste
  
Voilà ! After that TASTE is installed.
+
Voilà: TASTE is installed.
  
 
Except that... only the command line tools will work.
 
Except that... only the command line tools will work.
Line 89: Line 98:
 
In order to use the GUIs you must install an X forwarding server.
 
In order to use the GUIs you must install an X forwarding server.
  
More precisely you must install the x2go server inside the container and x2go client in the host machine.
+
= Install x2go =
Configure the x2go client to run a terminal session. This way you can work with TASTE from any distant machine.
+
 
 +
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 and latert) 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.
 +
 
 +
When you launch the session, type in your password and you will see an xterm session open.
 +
 
 +
You are ready to work with TASTE !

Revision as of 12:30, 29 July 2020

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-run -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 ; sudo rm sh ; sudo 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

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

At some point it will break asking you to update the sudoers file. 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 and latert) 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.

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

You are ready to work with TASTE !