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的安装脚本的主要内容,如果未能解决你的问题,请参考以下文章

Amazon linux:创建 ami 映像时更改默认 ec2-user

Amazon Linux AMI 上的“bash: jstack: command not found”错误

sh 使用Crontab和Amazon EC2上的s3cmd.Red Hat Linux对Amazon S3进行MongoDB自动备份

从 EC2 上的自定义 AMI 创建 AWS Opsworks 实例时未启动

如何检查 Amazon Linux 机器 (AMI) 上的 Tomcat 版本?

在 java 中使用 amazon sdk 创建 amazon ec2 windows AMI