diff options
| author | netop://ウィビ <paul@webb.page> | 2026-04-14 11:21:14 -0700 |
|---|---|---|
| committer | netop://ウィビ <paul@webb.page> | 2026-04-14 11:21:14 -0700 |
| commit | 1bf3e0e6f119976bedfbe96037bb95bd161b7d2b (patch) | |
| tree | 193980e3b1cda72fa3351f0f3e8ee606860bb1cc | |
| download | script-primary.tar.gz script-primary.zip | |
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | server.sh | 120 |
2 files changed, 121 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/server.sh b/server.sh new file mode 100644 index 0000000..33f9bf4 --- /dev/null +++ b/server.sh @@ -0,0 +1,120 @@ +#!/bin/sh + +# HOW TO USE: +# sh -c "$(curl -fsSL https://script.webb.page/server.sh)" + +# exit script if something fails +set -e + +# disable "pending kernel upgrade" popup | https://askubuntu.com/a/1424249 +sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf + +# ignore "daemons using outdated libraries" popup | https://stackoverflow.com/a/73397110#comment131834051_73397970 +sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf + +# suppress interactive prompts from apt (keep existing configs, don't ask) +export DEBIAN_FRONTEND=noninteractive +export NEEDRESTART_MODE=a + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Setting timezone to US Pacific… +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +ln -fs /usr/share/zoneinfo/US/Pacific /etc/localtime +dpkg-reconfigure -f noninteractive tzdata + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Setting locale to US English… +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections +echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | debconf-set-selections +rm "/etc/locale.gen" +dpkg-reconfigure --frontend noninteractive locales + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Updating and upgrading packages… +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +apt update +apt upgrade -y -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Installing packages we like to use… +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +apt install eza unzip -y + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Installing caddy… +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +apt install debian-keyring debian-archive-keyring apt-transport-https curl -y +curl -1sLf "https://dl.cloudsmith.io/public/caddy/stable/gpg.key" | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg +curl -1sLf "https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt" | tee /etc/apt/sources.list.d/caddy-stable.list +apt update -y +apt install caddy -y + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Installing zsh/ohmyzsh… +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +apt install zsh -y +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended + +# make zsh default shell +command -v zsh | tee -a /etc/shells +chsh -s $(which zsh) $USER + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Installing deno… +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +curl -fsSL https://deno.land/install.sh | sh + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Installing bun… +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +curl -fsSL https://bun.sh/install | bash + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Installing avahi… +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +if ! command -v avahi-daemon > /dev/null 2>&1; then + apt install avahi-daemon -y + systemctl enable --now avahi-daemon +fi + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Package cleanup +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" + +apt autoremove -y + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Server setup complete! You should reboot now +" +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +echo "" |