Files
VPS_Setup/setup.sh

82 lines
2.2 KiB
Bash
Raw Normal View History

2025-10-05 03:55:18 +00:00
### Install Docker ###
# Function to check if Docker is installed
check_docker_installed() {
if command -v docker &> /dev/null; then
return 0 # Docker is installed
else
return 1 # Docker is not installed
fi
}
check_tailscale_installed() {
if command -v tailscale &> /dev/null; then
return 0 # Tailscale is installed
else
return 1 # Tailscale is not installed
fi
}
if check_docker_installed; then
echo "Docker is already installed. moving onto container start up."
else
# Add Docker's official GPG key:
echo updating docker repository
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# Install
echo install docker
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo adding current user to docker usermod
sudo usermod -aG docker $USER
fi
### Install Tailscale Locally and Mount HomeNAS ###
if check_tailscale_installed; then
echo "Tailscale is already installed. connecting server."
else
echo installing tailscale
curl -fsSL https://tailscale.com/install.sh | sh
fi
sudo tailscale up --auth-key=tskey-auth-koHiorB8cj11CNTRL-dLaNRmukCWL5BurtnvU2WLDbrv4SDhVDX --hostname=IONOS
### Docker Containers to Compose ###
declare -a arr=(
# caddy
# tailscale
# immich-app
# mysql
# gitea
)
for i in "${arr[@]}"
do
echo docker composing: "$i"
cd ./$i
docker compose up -d --build
cd ..
done
### Install Conda ###
# echo installing mini conda
# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# bash ./Miniconda3-latest-Linux-x86_64.sh
# rm ./Miniconda3-latest-Linux-x86_64.sh
echo setup complete, adios!