Commit faa93d71 authored by bigbing's avatar bigbing

add docker install scripts

parent 8b16d1e4
...@@ -4,21 +4,8 @@ This is forked from Eurecom Gitlab OAI5G-CN ...@@ -4,21 +4,8 @@ This is forked from Eurecom Gitlab OAI5G-CN
# How to RUN # How to RUN
1. OAI CN5G pre-requisites 1. OAI CN5G pre-requisites
``` ```
sudo apt install -y git net-tools putty cd scripts
sudo ./install.sh -I
# https://docs.docker.com/engine/install/ubuntu/
sudo apt install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Add your username to the docker group, otherwise you will have to run in sudo mode.
sudo usermod -a -G docker $(whoami)
reboot
``` ```
2. Pull OAI CN5G docker images 2. Pull OAI CN5G docker images
......
#!/bin/bash
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
#echo "$THIS_SCRIPT_PATH"
source ${THIS_SCRIPT_PATH}/install_help
function help()
{
echo_info " "
echo_info "Usage: build_allinone -I"
echo_info " "
echo_info "Options:"
echo_info "Mandatory arguments to long options are mandatory for short options too."
echo_info " -I, --install-deps Check installed software necessary to build and run Docker."
echo_info " -h, --help Print this help."
echo_info " "
}
function main()
{
if [ $# -lt 1 ]; then
echo_error "$0 \"-h\" Or \"--help\""
fi
until [ -z "$1" ]
do
case "$1" in
-I | --install-deps)
dv=$(docker -v)
until [ "${dv:0:14}" = "Docker version" ]
do
apt-get update
apt-get install -y docker.io
dv=$(docker -v)
done
echo_success "already installed docker"
# install curl
cv=$(curl -V)
until [ "${cv:0:4}" = "curl" ]
do
apt-get install -y curl
cv=$(curl -V)
done
echo_success "already installed curl"
# install docker-compose
dcv=$(docker-compose --version)
until [ ${dcv:24:6} = 2.23.3 ]
do
echo_info "install docker-compose v2.23.3"
# curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
cp $THIS_SCRIPT_PATH/../libs/docker-compose /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
rm /usr/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
dcv=$(docker-compose --version)
done
echo_success "already installed docker-compose"
shift
;;
-h | --help)
help
shift
return 0
;;
*)
echo_error "Unknown option $1"
help
return 1
;;
esac
done
}
main "$@"
###############################
## echo and family
###############################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[1;34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
reset_color='\E[00m'
COLORIZE=1
#-------------------------------------------------------------------------------
cecho() {
# Color-echo
# arg1 = message
# arg2 = color
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$green}
[ "$COLORIZE" = "1" ] && message="$color$message$reset_color"
echo -e "$message"
return
}
echo_error() { cecho "$*" $red ;}
echo_fatal() { cecho "$*" $red; exit -1 ;}
echo_warning() { cecho "$*" $yellow ;}
echo_success() { cecho "$*" $green ;}
echo_info() { cecho "$*" $blue ;}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment