UPDATE: 29-07-2023 - use native method for Amazon Linux 2023 at https://docs.docker.com/engine/install/centos/
UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker
now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.
Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
Make docker auto-start
sudo chkconfig docker on
Because you always need it....
sudo yum install -y git
Reboot to verify it all loads fine on its own.
sudo reboot
Copy the appropriate docker-compose
binary from GitHub:
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
Fix permissions after download:
sudo chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
Verify success:
docker compose version
sudo yum install -y gcc gcc-c++ make openssl-devel git
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
sudo yum install nodejs
cd ~
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
nano .bashrc
add:
export PATH=~/.npm-global/bin:$PATH
and save
source .bashrc
Install Node Process Manager PM2
sudo npm install pm2@latest -g
cd ~
pm2 init
sudo nano ecosystem.config.js