-->

# Install Cases

Contents

- Installation in a chrooted Environment
  - Setting up the chrooted root directory
  - Configure `schroot`
  - Installing Packages in Debian 9
  - Creating a Duplicate User
  - Installation of Alliance / Coriolis

## Installation in a chrooted Environment

In this case, we will setup a Debian 9 installation of Alliance/Coriolis under a Scientific Linux 7 os. This should also work for rhel or CentOS.

Debian 9 will be referred as the guest OS or the chrooted. Scientific Linux will be referred as the host OS.

### Setting up the chrooted root directory

We need the `debootstrap` and `schroot` packages (from the epel repository).

    root@pc:~# yum install debootstrap schroot

On the host os, as the root user, create the directory into which the whole chrooted os will reside:

    root@pc:~# mkdir -p /home/chroot/debian9.coriolis
    root@pc:~# debootstrap stretch /home/chroot/debian9.coriolis http://ftp.us.debian.org/debian
    root@pc:~# echo "debian9.coriolis" > /home/chroot/debian9.coriolis/etc/debian_chroot

Then, we need to give access the chrooted distribution to some kernel filesystem of the host, namely `dev`, `proc`, `sys` & `tmp`. On the host filesytem, add to `/etc/fstab`:

    # Your host normal mounts.
    # ...
    # For Jail chroot of Debian9.
    /dev      /home/chroot/debian9.coriolis/dev      none    bind    0   0
    /dev/pts  /home/chroot/debian9.coriolis/dev/pts  none    bind    0   0
    /proc     /home/chroot/debian9.coriolis/proc     none    bind    0   0
    /sys      /home/chroot/debian9.coriolis/sys      none    bind    0   0
    /tmp      /home/chroot/debian9.coriolis/tmp      none    bind    0   0

Mount them:

    root@pc:~# mount -a

### Configure `schroot`

Edit `/etc/schroot.d/schroot.conf` as follow:

    [debian9.coriolis]
    description=Debian 9 stretch
    directory=/home/chroot/debian9.coriolis
    users=ego

Note

Users in the schrooted environment. They must exists on both the host system and in the chrooted one. It is best if they also have the same uid / gid and home directories (relative to their respectives root). For example, for a `ego` user:

On the Host | In the chrooted os
--- | ---
`/home/ego` | N/A
`/home/chroot/debian9.coriolis/home/ego` | `/home/ego`

### Installing Packages in Debian 9

Now that `schroot` is set, we can log in the guest os as `root` and add the minimal needed package set to build Alliance / Coriolis.

    root@pc:~# schroot -c debian9.coriolis -u root
    (debian9.coriolis)root@pc:~# export DEBIAN_FRONTEND=noninteractive
    (debian9.coriolis)root@pc:~# apt-get update
    (debian9.coriolis)root@pc:~# apt-get -y install build-essential binutils-dev         \
                                                    git cmake bison flex gcc python-dev  \
                                                    libboost-all-dev libboost-python-dev \
                                                    zlib1g-dev libxml2-dev rapidjson-dev \
                                                    libbz2-dev                           \
                                                    qt4-dev-tools libqwt-dev python-qt4  \
                                                    autotools-dev automake               \
                                                    libxt-dev libxpm-dev libmotif-dev    \
                                                    yosys                                \
                                                    vim
    (debian9.coriolis)root@pc:~# apt-get clean

### Creating a Duplicate User

As stated before, we must create in the guest os a user that also exist on the host os, and with the same uid and home directory. Here we assume that `ego` has an uid of 20000.

    (debian9.coriolis)root@pc:~# adduser --uid 20000 ego
                                 Adding user `ego' ...
                                 Adding new group `ego' (20000) ...
                                 Adding new user `ego' (20000) with group `ego' ...
                                 Creating home directory `/home/ego' ...
                                 Copying files from `/etc/skel' ...
                                 Enter new UNIX password:
                                 Retype new UNIX password:
                                 passwd: password updated successfully
                                 Changing the user information for ego
                                 Enter the new value, or press ENTER for the default
                                     Full Name []: Me Myself and I
                                     Room Number []: 404
                                     Work Phone []: 666 666 666
                                     Home Phone []: 3615
                                     Other []:
                                 Is the information correct? [Y/n] Y
    (debian9.coriolis)root@pc:~#

### Installation of Alliance / Coriolis

Download the installer script: socInstaller.py. And put it in the home directory of the user `ego` in the guest os.

Note

As it is more easier to download it from the host os, you may do so and just copy it under `/home/chroot/debian9.coriolis/home/ego`. As they share the same uid, the copy is allowed.

Now we can connect as the `ego` user on the guest os:

    ego@pc:~> schroot -c debian9.coriolis -u ego
    (debian9.coriolis)jpc@pc:~> ./socInstaller.py --chroot --profile=Debian9 \
                                                  --do-alliance --do-coriolis