Last active
May 26, 2023 19:01
-
-
Save froop/95ce03bbe156c076f5be757b7a01a524 to your computer and use it in GitHub Desktop.
[Linux][EC2] Docker環境構築(Amazon Linux 2023用)
This file contains hidden or 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/bash -eu | |
# Docker環境構築(Amazon Linux 2023用) | |
# locale | |
localectl set-locale LANG=ja_JP.UTF-8 | |
# timezone | |
echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock | |
rm -f /etc/localtime | |
ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime | |
# swap file | |
dd if=/dev/zero of=/swapfile bs=128M count=8 | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo '/swapfile swap swap defaults 0 0' >> /etc/fstab | |
# docker | |
yum install -y docker | |
systemctl enable docker | |
systemctl start docker | |
usermod -a -G docker ec2-user | |
# docker-compose | |
curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/libexec/docker/cli-plugins/docker-compose | |
chmod +x /usr/libexec/docker/cli-plugins/docker-compose | |
#curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
#chmod +x /usr/local/bin/docker-compose | |
# git | |
yum install -y git | |
# ssh | |
sed -i '1s/^/PubkeyAcceptedAlgorithms=+ssh-rsa\n/' /etc/ssh/sshd_config | |
systemctl restart sshd | |
yum clean all |
This file contains hidden or 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/bash -eu | |
cd /home/ec2-user | |
wget https://gist.github.com/froop/95ce03bbe156c076f5be757b7a01a524/raw/configure-docker-al2023.sh | |
chmod +x configure-docker-al2023.sh | |
./configure-docker-al2023.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment