diff --git a/debian-bootstrap.sh b/debian-bootstrap.sh new file mode 100644 index 0000000..4503acb --- /dev/null +++ b/debian-bootstrap.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# Update and upgrade existing packages +sudo apt update && sudo apt upgrade -y + +# Install some basic utilities +sudo apt install -y vim curl wget pv python3 python3-dev build-essential git byobu + +# 1. Create a new user and prompt for a username +echo "Please enter the desired username:" +read username + +# Check if user already exists +if id "$username" &>/dev/null; then + echo "User $username already exists!" +else + sudo adduser $username +fi + +# 2. Give that user sudo privileges +sudo usermod -aG sudo $username + +# 3. Install zsh and make it the default shell for the user +sudo apt install -y zsh +sudo chsh -s $(which zsh) $username + +# 4. Install Docker CE + +# a. Install prerequisites +sudo apt install -y apt-transport-https ca-certificates gnupg + +# b. Add Docker's official GPG key +curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg + +# c. Add Docker's stable repository +echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + +# d. Install Docker +sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin + +# e. Ensure Docker is active in systemd and run the hello-world container to verify the installation +sudo systemctl enable docker +sudo systemctl start docker +sudo docker run hello-world + +# 5. Install Portainer +sudo docker volume create portainer_data +sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce + +# 6. Install distrobox for the user +su - $username -c "curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh" + +echo "All tasks completed! You can now access Portainer at http://your-server-ip:9000."