61 lines
2.2 KiB
Bash
61 lines
2.2 KiB
Bash
#!/bin/bash
|
|
|
|
install_basic_utilities() {
|
|
sudo apt update && sudo apt upgrade -y
|
|
sudo apt install -y vim curl wget pv python3 python3-dev build-essential git byobu
|
|
}
|
|
|
|
create_new_user() {
|
|
echo "Please enter the desired username:"
|
|
read username
|
|
if id "$username" &>/dev/null; then
|
|
echo "User $username already exists!"
|
|
else
|
|
sudo adduser $username
|
|
sudo usermod -aG sudo $username
|
|
fi
|
|
}
|
|
|
|
install_zsh() {
|
|
sudo apt install -y zsh
|
|
sudo chsh -s $(which zsh) $username
|
|
}
|
|
|
|
install_docker() {
|
|
sudo apt install -y apt-transport-https ca-certificates gnupg
|
|
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
|
|
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
|
|
sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin
|
|
sudo systemctl enable docker
|
|
sudo systemctl start docker
|
|
sudo docker run hello-world
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
install_distrobox() {
|
|
su - $username -c "curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh"
|
|
}
|
|
|
|
install_syncthing() {
|
|
sudo curl -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
|
|
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
|
|
sudo apt-get update
|
|
sudo apt-get install -y syncthing
|
|
sudo systemctl enable syncthing@$username.service
|
|
sudo systemctl start syncthing@$username.service
|
|
}
|
|
|
|
# Main script execution
|
|
install_basic_utilities
|
|
create_new_user
|
|
install_zsh
|
|
install_docker
|
|
install_portainer
|
|
install_distrobox
|
|
install_syncthing
|
|
|
|
echo "All tasks completed! You can now access Portainer at http://your-server-ip:9000."
|