forked from clearcontainers/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Create CentOS/RHEL 7 installation guide
Write a document explaining how to install Clear Containers 3.0 on a CentOS 7 or RHEL 7 system. Added associated scripts and configuration files (which are lightly modified versions from https://github.com/01org/cc-oci-runtime). Fixes clearcontainers#371. Signed-off-by: James O. D. Hunt <[email protected]>
- Loading branch information
1 parent
743362f
commit 44572bc
Showing
4 changed files
with
431 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Installing Intel® Clear Containers 3.0 Alpha on CentOS version 7 or RHEL version 7. | ||
|
||
## Required Setup | ||
|
||
The installation requires the current user to run sudo without specifying a password. Verify this with the following commands: | ||
|
||
``` | ||
$ su - | ||
# echo "$some_user ALL=(ALL:ALL) NOPASSWD: ALL" | (EDITOR="tee -a" visudo) | ||
$ exit | ||
``` | ||
|
||
## Installation steps | ||
|
||
1. Ensure the system packages are up-to-date by running the following: | ||
|
||
``` | ||
$ sudo yum -y update | ||
``` | ||
2. Install Git: | ||
|
||
``` | ||
$ sudo yum install -y git | ||
``` | ||
3. Create the installation directory and clone the repository with the following commands: | ||
|
||
``` | ||
$ mkdir -p $HOME/go/src/github/clearcontainers | ||
$ cd $HOME/go/src/github/clearcontainers | ||
$ git clone https://github.com/clearcontainers/runtime | ||
$ cd runtime | ||
``` | ||
4. Run the installation script: | ||
|
||
``` | ||
$ ./installation/centos+rhel-setup.sh | ||
``` | ||
|
||
## Verify the installation was successful | ||
|
||
1. Check the `cc-runtime` version with the following command: | ||
|
||
``` | ||
$ cc-runtime --version | ||
``` | ||
|
||
2. Run an example with the following command: | ||
|
||
``` | ||
$ sudo docker run -ti busybox sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
#!/bin/bash | ||
|
||
# This file is part of cc-runtime. | ||
# | ||
# Copyright (C) 2017 Intel Corporation | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
||
# Description: This script installs a usable version of qemu on a | ||
# CentOS 7 or RHEL 7 system. | ||
|
||
SCRIPT_PATH=$(dirname "$(readlink -f "$0")") | ||
source "${SCRIPT_PATH}/installation-setup.sh" | ||
source "${SCRIPT_PATH}/../versions.txt" | ||
|
||
# List of packages to install to satisfy build dependencies | ||
pkgs="" | ||
|
||
mnl_dev_pkg="libmnl-devel" | ||
|
||
# general | ||
pkgs+=" zlib-devel" | ||
pkgs+=" gettext-devel" | ||
pkgs+=" libtool-ltdl-devel" | ||
pkgs+=" libtool-ltdl" | ||
pkgs+=" glib2-devel" | ||
pkgs+=" bzip2" | ||
pkgs+=" m4" | ||
|
||
# for yum-config-manager | ||
pkgs+=" yum-utils" | ||
|
||
# runtime dependencies | ||
pkgs+=" libuuid-devel" | ||
pkgs+=" libmnl" | ||
pkgs+=" ${mnl_dev_pkg}" | ||
pkgs+=" libffi-devel" | ||
pkgs+=" pcre-devel" | ||
|
||
# qemu lite dependencies | ||
pkgs+=" libattr-devel" | ||
pkgs+=" libcap-devel" | ||
pkgs+=" libcap-ng-devel" | ||
pkgs+=" pixman-devel" | ||
|
||
pkgs+=" gcc-c++" | ||
|
||
if [ "$os_distribution" = rhel ] | ||
then | ||
# RHEL doesn't provide "*-devel" packages unless the "Optional RPMS" | ||
# repository is enabled. However, to make life fun, there isn't a | ||
# clean way to determine if that repository is enabled (the output | ||
# format of "yum repolist" seems to change frequently and | ||
# subscription-manager's output isn't designed for easy script | ||
# consumption). | ||
# | ||
# Therefore, the safest approach seems to be to check if a known | ||
# required development package is known to yum(8). If it isn't, the | ||
# user will need to enable the extra repository. | ||
# | ||
# Note that this issue is unique to RHEL: yum on CentOS provides | ||
# access to developemnt packages by default. | ||
|
||
yum info "${mnl_dev_pkg}" >/dev/null 2>&1 | ||
if [ $? -ne 0 ] | ||
then | ||
echo >&2 "ERROR: You must enable the 'optional' repository for '*-devel' packages" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
source /etc/os-release | ||
|
||
major_version=$(echo "${VERSION_ID}"|cut -d\. -f1) | ||
|
||
if [ "$os_distribution" = rhel ] | ||
then | ||
distro="RHEL" | ||
elif [ "$os_distribution" = centos ] | ||
then | ||
distro="CentOS" | ||
else | ||
echo >&2 "ERROR: Unrecognised distribution: $os_distribution" | ||
echo >&2 "ERROR: This script is designed to work on CentOS and RHEL systems only." | ||
exit 1 | ||
fi | ||
|
||
cc_repo_url="http://download.opensuse.org/repositories/home:/clearcontainers:/clear-containers-3/${distro}_${major_version}/home:clearcontainers:clear-containers-3.repo" | ||
|
||
sudo yum -y update | ||
eval sudo yum -y install "$pkgs" | ||
|
||
sudo yum groupinstall -y 'Development Tools' | ||
|
||
pushd "$deps_dir" | ||
|
||
# Install pre-requisites for gcc | ||
curl -L -O ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-${gmp_version}.tar.bz2 | ||
compile gmp gmp-${gmp_version}.tar.bz2 gmp-${gmp_version} | ||
|
||
curl -L -O ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-${mpfr_version}.tar.bz2 | ||
compile mpfr mpfr-${mpfr_version}.tar.bz2 mpfr-${mpfr_version} | ||
|
||
curl -L -O ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-${mpc_version}.tar.gz | ||
compile mpc mpc-${mpc_version}.tar.gz mpc-${mpc_version} | ||
|
||
# Install glib | ||
glib_setup | ||
|
||
# Install json-glib | ||
json_glib_setup | ||
|
||
# Install gcc | ||
gcc_setup | ||
|
||
# Install qemu-lite | ||
qemu_lite_setup | ||
|
||
popd | ||
|
||
# Install docker | ||
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | ||
sudo yum -y install docker-ce | ||
|
||
# Install Clear Containers components and their dependencies | ||
sudo yum-config-manager --add-repo "${cc_repo_url}" | ||
sudo yum -y install cc-runtime cc-proxy cc-shim | ||
|
||
# Override runtime configuration to use hypervisor from prefix_dir | ||
# rather than the OBS default values. | ||
sudo -E prefix_dir=$prefix_dir sed -i -e \ | ||
"s,^path = \"/usr/bin/qemu-system-x86_64\",path = \"${prefix_dir}/bin/qemu-system-x86_64\",g" \ | ||
/etc/clear-containers/configuration.toml | ||
|
||
# Configure CC by default | ||
sudo mkdir -p /etc/systemd/system/docker.service.d/ | ||
cat <<EOF|sudo tee /etc/systemd/system/docker.service.d/clear-containers.conf | ||
[Service] | ||
ExecStart= | ||
ExecStart=/usr/bin/dockerd -D --add-runtime cc-runtime=/usr/bin/cc-runtime --default-runtime=cc-runtime | ||
EOF | ||
sudo systemctl daemon-reload | ||
sudo systemctl restart docker | ||
sudo systemctl enable cc-proxy.socket | ||
sudo systemctl start cc-proxy.socket |
Oops, something went wrong.