Skip to content

Commit

Permalink
[CE-49] Adapt setup script to multiple linux distros
Browse files Browse the repository at this point in the history
Linux distribution is extracted from /etc/os-release file where a line
ID= "distro" gives the mnemonic of the distribution

The main change in the script is to define installation procedure with
the proper packet manager (yum,zypper,cnf,apt-get..). The procedure will
install Docker, python-pip and eventually docker-compose

To test, a make setup was done followed by make start and the cello web
interface was verified as available through a browser . All tests are
conducted on VMs running on virtualBox

Testing has been done on the following distributions:
Opensuse (openSUSE Leap 42.2)
Fedora   (Fedora 25-1.3 server edition)
Debian   (debian 8.8.0)
Ubuntu   (ubuntu 16.04.2 server)
Mint     (linuxmint-18.1-cinnamon)

Issue: CE-49
Change-Id: I9bcc7dd0f2814efda46aa7881dfd5d39871e9493
Signed-off-by: Daniel Vielvoye <dvielvoye@gmail.com>
  • Loading branch information
aemlin committed May 23, 2017
1 parent 67f6a3e commit 208c470
Showing 1 changed file with 62 additions and 3 deletions.
65 changes: 62 additions & 3 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,72 @@
# It should be triggered at the upper directory, and safe to repeat.

source scripts/header.sh
# collect ID from /etc/os-release as distribution name
# tested on debian,ubuntu,mint , centos,fedora ,opensuse
function get_distribution {
distribution="Unknown"
while read -r line
do
element=$(echo $line | cut -f1 -d=)
if [ "$element" = "ID" ]
then
distribution=$(echo $line | cut -f2 -d=)
fi
done < "/etc/os-release"
echo "${distribution//\"}"
}

USER=`whoami`

DISTRO=$(get_distribution)
DB_DIR=/opt/${PROJECT}/mongo

sudo apt-get update && sudo apt-get install -y -m curl docker-engine python-pip

case $DISTRO in
ubuntu)
sudo apt-get update && sudo apt-get install -y curl docker-engine python-pip
;;
linuxmint)
sudo apt-get install apt-transport-https ca-certificates -y
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo deb https://apt.dockerproject.org/repo ubuntu-xenial main >> /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get purge lxc-docker
sudo apt-get install python-pip
sudo apt-get install linux-image-extra-$(uname -r) -y
sudo apt-get install docker-engine cgroup-lite apparmor -y
sudo service docker start
;;
debian)
sudo apt-get install apt-transport-https ca-certificates -y
sudo sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-get update
sudo apt-cache policy docker-engine
sudo apt-get install docker-engine curl python-pip -y
sudo service docker start
;;
centos)
sudo yum install -y epel-release yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast
sudo yum update && sudo yum install -y docker-ce python-pip
sudo systemctl enable docker
sudo systemctl start docker
;;
fedora)
sudo dnf -y update
sudo dnf -y install docker python-pip --allowerasing
sudo systemctl enable docker
sudo systemctl start docker
;;
opensuse)
sudo zypper refresh
sudo zypper install docker docker-compose python-pip
sudo systemctl restart docker
;;
*)
echo "Linux distribution not identified !!! skipping docker & pip installation"
;;
esac
sudo pip install --upgrade pip

sudo pip install --upgrade tox
Expand Down

0 comments on commit 208c470

Please sign in to comment.