Files
homelogic-setup/setup_homelogic.sh

57 lines
1.7 KiB
Bash
Raw Normal View History

2026-03-27 13:11:45 -03:00
# Setup Server
echo '### Setting up Server ###'
sudo apt-get update
2026-03-20 20:17:21 -03:00
sudo ufw allow 22/tcp
2026-03-27 13:11:45 -03:00
sudo ufw allow 443/tcp
2026-03-21 12:21:02 -03:00
sudo ufw allow 8123/tcp
sudo ufw allow 8123/udp
sudo ufw allow 3000/tcp
sudo ufw allow 3001/tcp
2026-03-21 10:09:59 -03:00
# Setup Docker
2026-03-21 10:38:31 -03:00
echo '### Setting up Docker ###'
2026-03-27 13:11:45 -03:00
sudo apt -y install lsb-release gnupg apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
2026-03-20 20:17:21 -03:00
sudo systemctl enable --now docker.service
2026-03-21 10:20:22 -03:00
if ! getent group docker > /dev/null 2>&1; then
sudo groupadd docker
fi
if ! id -nG "$USER" | grep -qw "docker"; then
sudo usermod -aG docker "$USER"
fi
2026-03-21 11:05:31 -03:00
sudo docker network create homelogic 2>/dev/null || true
2026-03-20 20:17:21 -03:00
2026-03-21 10:09:59 -03:00
# Setup ZSH
2026-03-21 10:38:31 -03:00
echo '### Setting up ZSH ###'
2026-03-27 13:11:45 -03:00
touch ../.hushlogin
cp -f .zshrc.base ../.zshrc
2026-03-21 11:46:38 -03:00
2026-03-27 13:11:45 -03:00
sudo apt install zsh
ZSH_PATH=$(command -v zsh)
if [ "${SHELL##*/}" != "zsh" ] && [ -n "$ZSH_PATH" ]; then
chsh -s "$ZSH_PATH"
fi
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2026-03-20 20:17:21 -03:00
2026-03-21 10:09:59 -03:00
# Setup Tailscale
2026-03-21 10:38:31 -03:00
echo '### Setting up Tailscale ###'
2026-03-27 13:44:11 -03:00
printf "Do you want to install and setup Tailscale? [Y/n] "
read choice
case "$choice" in
n|N|no|No|NO )
echo "Skipping Tailscale setup."
;;
* )
if ! command -v tailscale > /dev/null 2>&1; then
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
fi
;;
esac