[1] 설치 확인 완료 시 echo
#!/bin/bash
if [ -x "$(command -v nginx)" ]; then
echo "Check: Nginx Installed."
else
sudo apt update && sudo apt install nginx -y
fi
if [ -x "$(command -v docker)" ]; then
echo "Check: Docker Installed."
else
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | sudo apt-key add -
echo "" | sudo add-apt-repository "deb [arch=amd64] <https://download.docker.com/linux/ubuntu> $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo usermod -aG docker $(whoami)
sudo su - ${USER}
fi
[2] echo 없이 설치만
#!/bin/bash
if ! [ -x "$(command -v nginx)" ]; then
sudo apt update && sudo apt install nginx -y
fi
if ! [ -x "$(command -v docker)" ]; then
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | sudo apt-key add -
echo "" | sudo add-apt-repository "deb [arch=amd64] <https://download.docker.com/linux/ubuntu> $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo usermod -aG docker $(whoami)
sudo su - ${USER}
fi