-
-
Save srghma/15d08c4c3d5dc9e6407555185b49a2d2 to your computer and use it in GitHub Desktop.
Setup script for golang, docker and docker-compose on Amazon Linux AMI 2017.09.0 (HVM) on EC2
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
#!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.19.0/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 |
Author
srghma
commented
Apr 17, 2018
cat ~/.ssh/id_rsa.pub | ssh -i ~/key.pem USER@HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Install gitlab ci runner
https://github.com/ayufan/gitlab-ci-multi-runner/blob/master/docs/install/linux-repository.md
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash
sudo yum install gitlab-ci-multi-runner
gitlab-runner --version
# goto project settings -> runners
sudo gitlab-runner register
# if docker executor
sudo usermod -a -G docker gitlab-runner
# if dind
sudo vim /etc/gitlab-runner/config.toml # to add priviliged flag (https://gitlab.com/gitlab-org/gitlab-runner/issues/1544#note_13439656)
sudo gitlab-runner restart
sudo yum install gcc-c++ openssl-devel openssl
git clone https://github.com/AGWA/git-crypt.git
cd git-crypt
make
sudo make install
# To install to a custom location:
# sudo make install PREFIX=<location>
# This should validate that it's installed correctly
git-crypt --version
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment