Skip to content

Instantly share code, notes, and snippets.

@NetOpWibby
Last active February 28, 2024 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetOpWibby/4b8c4729b18171a1c3d322837835cf68 to your computer and use it in GitHub Desktop.
Save NetOpWibby/4b8c4729b18171a1c3d322837835cf68 to your computer and use it in GitHub Desktop.
server setup
#!/bin/sh
# 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
# set timezone
echo "\n—————\nSetting timezone to US Pacific…\n—————\n"
ln -fs /usr/share/zoneinfo/US/Pacific /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
# update and upgrade packages
echo "\n—————\nUpdating and upgrading packages…\n—————\n"
apt update && apt upgrade -y
# install exa
echo "\n—————\nInstalling exa…\n—————\n"
apt install exa -y
# install zsh
echo "\n—————\nInstalling zsh…\n—————\n"
apt install zsh -y
# install ohmyzsh
echo "\n—————\nInstalling ohmyzsh…\n—————\n"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
exit # exit bash to use zsh
# make zsh default shell
chsh -s /usr/bin/zsh
zsh
echo "\n—————\nServer setup complete! Reboot if you want.\n—————\n"
@NetOpWibby
Copy link
Author

NetOpWibby commented Nov 27, 2023

sh -c "$(curl -fsSL https://gist.githubusercontent.com/NetOpWibby/4b8c4729b18171a1c3d322837835cf68/raw/e797d6732113b89663d2f195c5699f8b93b2bd4b/install.sh)"

Reboot after.

@NetOpWibby
Copy link
Author

NetOpWibby commented Jan 31, 2024

Ubuntu needs chsh -s /usr/bin/zsh apparently (instead of chsh -s $(which zsh)), to change default shell to zsh.

@NetOpWibby
Copy link
Author

Why do I need to enter chsh -s /usr/bin/zsh AFTER the script runs and the server reboots, for it to stick?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment