Re: Installing Packages (e.g. docker-ce) from a 3rd Party Repository

2018-03-09 Diskussionsfäden Thomas Lange
> On Wed, 14 Feb 2018 13:18:23 -0600, Itamar Gal  
> said:

> Here is my solution attempt. I decided to create an FAI class called 
DOCKER for this installation.

>     # Add the Docker repository
>     sudo add-apt-repository \
>     "deb [arch=amd64] https://download.docker.com/linux/$(. 
/etc/os-release; echo "$ID") \
>     $(lsb_release -cs) \
>     stable"
I guess this installs a source.list file on the host, but not into the
chroot where it must be.

-- 
regards Thomas


Installing Packages (e.g. docker-ce) from a 3rd Party Repository

2018-02-14 Diskussionsfäden Itamar Gal
Dear FAI Users:

Here's the abridged version of my question: How do I add a 3rd party
package repository and then install software from it?

Now here's the longer version.

I want to install Docker CE (https://www.docker.com/community-edition) on a
Debian Stretch system using FAI. The official Docker documentation
recommends that you install Docker using their package repository (
https://docs.docker.com/install/linux/docker-ce/debian/#install-using-the-repository).
I'm not sure how do this with FAI.


The given instructions for installing Docker are as follows.

1. Install packages to allow apt to use a repository over HTTPS:

sudo apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common

2. Add Docker's official GPG key to APT:

curl \
-fsSL \
https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg \
| sudo apt-key add -

3. Add the Docker repository to APT:

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(.
/etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"

4. Update the APT package index:

sudo apt-get update

5. Install the docker-ce package:

sudo apt-get install docker-ce


Here is my solution attempt. I decided to create an FAI class called DOCKER
for this installation.

First I create the following hook for the DOCKER class
(/srv/fai/config/hooks/repository.DOCKER):

#!/bin/bash

# Install required packages for add-apt-repository utility
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common

# Add the Docker repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(.
/etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"

Next I download the Docker repository public key and placed it in the FAI
package configuration directory at the following path:

/srv/fai/config/package_config/DOCKER.asc

Then I create the following package configuration file for the DOCKER class
(/srv/fai/config/package_config/DOCKER):

# Install Docker CE (Community Edition)
PACKAGES install
docker-ce

Finally I perform a dirinstall/chroot installation using the DOCKER class:

sudo fai \
--verbose \
--cfdir '/etc/fai' \
--class 'FAIBASE DEBIAN DOCKER' \
--cspace 'file:///srv/fai/config' \
dirinstall 'docker'

Then I enter the chroot environment to check whether or not the
installation was successful:

sudo chroot docker

Unfortunately when I check for docker it does not appear to be installed:

root@faiserver:/# which docker
root@faiserver:/# dpkg -l | grep -i docker

Checking the log files for evidence of the docker-ce package yields the
following:

root@faiserver:/# grep -Fir docker-ce
/var/log/fai/faiserver/last/fai.log
WARNING: These unknown packages are removed from the installation list:
docker-ce

I also look for evidence that the add-apt-repository command was executed,
but don't find any:

root@faiserver:/# grep -Firl add-apt-repository /var/log/fai
root@faiserver:/#

However I am able to verify that the key was added to APT successfully:

root@faiserver:/# apt-key list 2>/dev/null | grep -i -B2 -A1 docker
pub   rsa4096 2017-02-22 [SCEA]
  9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid   [ unknown] Docker Release (CE deb) 
sub   rsa4096 2017-02-22 [S]


Any suggestions would be greatly appreciated.

Cheers,
Itamar