sh EC2上的Amazon Linux AMI 2017.09.0(HVM)上的golang,docker和docker-compose的安装脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh EC2上的Amazon Linux AMI 2017.09.0(HVM)上的golang,docker和docker-compose的安装脚本相关的知识,希望对你有一定的参考价值。
#!bin/sh
# Update installed packages and package cache
sudo yum update -y
# make sure in the home folder
cd ~/
# Golang installation
# specify go version to install
VERSION=go1.9.linux-amd64.tar.gz
# download the go archive for the specified version
sudo curl -O https://storage.googleapis.com/golang/$VERSION
# extract the downloaded archive into the /usr/local folder
sudo tar -C /usr/local -xzf $VERSION
# setup the default GOPATH workspace
mkdir -p ~/go/bin
# set necessary go env variables
cat > ./go-env.sh <<EOL
export GOPATH=~/go
export PATH=$PATH:/usr/local/go/bin:~/go/bin
EOL
chmod +x ./go-env.sh
sudo mv ./go-env.sh /etc/profile.d/
# install git for go get command
# Docker installation
# http://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
# install docker
sudo yum install -y git docker
# download the docker compose binary
curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` > ./docker-compose
# mv docker-compose binary to usr/bin folder
sudo mv ./docker-compose /usr/bin/docker-compose
# make docker-compose binary executable
sudo chmod +x /usr/bin/docker-compose
# start the docker service
sudo service docker start
# add ec2-user to the docker group to lose the sudo command when using docker
sudo usermod -a -G docker ec2-user
以上是关于sh EC2上的Amazon Linux AMI 2017.09.0(HVM)上的golang,docker和docker-compose的安装脚本的主要内容,如果未能解决你的问题,请参考以下文章