Last active
June 4, 2024 22:13
-
-
Save NetOpWibby/4b8c4729b18171a1c3d322837835cf68 to your computer and use it in GitHub Desktop.
server setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/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 | |
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 "+ Updating and upgrading packages… +" | |
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" | |
echo "" | |
apt update && apt upgrade -y | |
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 "+ Package cleanup +" | |
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" | |
echo "" | |
apt autoremove -y | |
echo "" | |
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" | |
echo "+ Server setup complete! You should reboot now +" | |
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" | |
echo "" |
Ubuntu needs chsh -s /usr/bin/zsh
apparently (instead of chsh -s $(which zsh)
), to change default shell to zsh.
Why do I need to enter chsh -s /usr/bin/zsh
AFTER the script runs and the server reboots, for it to stick?
Okay, entering zsh
and then chsh -s /usr/bin/zsh
after the script finishes works.
Rebooting makes zsh
the default shell at least
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sh -c "$(curl -fsSL https://gist.githubusercontent.com/NetOpWibby/4b8c4729b18171a1c3d322837835cf68/raw/858f4aa997e73fa831785c792b36adb1f25c5033/install.sh)"
Reboot after.