Last active
September 23, 2020 15:40
-
-
Save hizkifw/4fea08701b27f08eede9ddb8dd494e4a to your computer and use it in GitHub Desktop.
Auto setup script for fresh Ubuntu installations
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/bash | |
USERNAME=hizkifw | |
# Install packages | |
apt update | |
apt upgrade -y | |
apt install -y axel vim openvpn python3 python3-pip cloudflared cmake build-essential git tmux fail2ban gimp mplayer vlc cmus ffmpeg pv qbittorrent keepassxc chromium-browser xclip | |
# Install node | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash | |
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
command -v nvm | |
nvm install --lts | |
pip3 install thefuck | |
fuck --yeah | |
# Generate SSH key | |
ssh-keygen -f id_rsa -t rsa -N '' | |
# .tmux.conf | |
cd /home/$USERNAME | |
wget https://gist.githubusercontent.com/HizkiFW/72f9d0506d950f0025ac520448b2a357/raw/faa44cb3148874a1858d51b1aa4c8eb9833f937f/.tmux.conf | |
# Install vimrc | |
git clone https://github.com/HizkiFW/dotvim.git | |
mv dotvim/ .vim/ | |
vim -c ':PlugInstall' -c ':qa' | |
# Some bash aliases | |
cat <<EOF | tee /home/$USERNAME/.bash_aliases | |
alias d='cd ..' | |
EOF | |
# DNS settings | |
# Unlink systemd's resolv.conf and replace with local resolver (cloudflared) | |
cp /etc/resolv.conf /tmp/resolv.conf | |
rm /etc/resolv.conf | |
cat /tmp/resolv.conf | tee /etc/resolv.conf | |
sed -i 's/53/1/' /etc/resolv.conf | |
# Useful tools | |
mkdir -p /home/$USERNAME/bin | |
# clip-unclip | |
# stdin -> clipboard -> stdout | |
cat << EOF | tee /home/$USERNAME/bin/clip | |
xclip -selection clipboard | |
EOF | |
cat <<EOF | tee /home/$USERNAME/bin/unclip | |
xclip -selection clipboard -o | |
EOF | |
# yoink-yeet | |
# useful for copying files between terminals | |
cat <<EOF | tee /home/$USERNAME/bin/yoink | |
#!/bin/bash | |
realpath "\$@" | tee /tmp/yoink | |
EOF | |
cat <<EOF | tee /home/$USERNAME/bin/yeet | |
#!/bin/bash | |
if [ -f /tmp/yoink ]; then | |
if [ \$# -eq 0 ]; then | |
cp -rv \$(cat /tmp/yoink) . | |
else | |
cp -rv \$(cat /tmp/yoink) \$@ | |
fi | |
else | |
echo "Source file not found" | |
fi | |
EOF | |
# Update permissions | |
chmod +x /home/$USERNAME/bin/* | |
chown -R $USERNAME:$USERNAME /home/$USERNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment