Skip to content

Instantly share code, notes, and snippets.

@dhh
Last active April 30, 2024 09:11
Show Gist options
  • Save dhh/159b129f511f76db3ae8adb463f70d05 to your computer and use it in GitHub Desktop.
Save dhh/159b129f511f76db3ae8adb463f70d05 to your computer and use it in GitHub Desktop.
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
# UI apps
sudo snap install 1password spotify vlc zoom-client signal-desktop typora pinta
sudo apt install xournalpp
sudo snap install code --classic
# Tuxedo specific setup
# https://deb.tuxedocomputers.com/ubuntu/pool/main/t/tuxedo-control-center/
# https://deb.tuxedocomputers.com/ubuntu/pool/main/t/tuxedo-drivers/
# Install Tactile Window Manager via Gnome Extensions
sudo apt install -y gnome-browser-connector
open https://chromewebstore.google.com/detail/gnome-shell-integration/gphhapmejobijbbhgpjhcjognlahblep
open https://extensions.gnome.org/extension/4548/tactile/
# Install debs
cd ~/Downloads
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
wget -O dropbox_2020.03.04_amd64.deb https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_2020.03.04_amd64.deb
sudo apt install libpango1.0-0 -y
sudo dpkg -i dropbox_2020.03.04_amd64.deb
cd -
# Install Cascadia Nerd Font (and use it in the terminal)
cd ~/Downloads
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/CascadiaMono.zip
unzip CascadiaMono.zip -d CascadiaFont
mkdir -p ~/.local/share/fonts
cp CascadiaFont/*.ttf ~/.local/share/fonts
fc-cache
PROFILE_ID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d "'\n")
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$PROFILE_ID/ font 'CaskaydiaMono Nerd Font 10'
cd -
# Install ulauncher
sudo add-apt-repository universe -y && sudo add-apt-repository ppa:agornostal/ulauncher -y && sudo apt update && sudo apt install ulauncher
# Install iA Writer theme for Typora
cd ~/Downloads
git clone https://github.com/dhh/ia_typora
mkdir -p ~/.local/share/fonts
cp ia_typora/fonts/iAWriterMonoS-* ~/.local/share/fonts/
fc-cache
cp ia_typora/ia_typora*.css ~/snap/typora/88/.config/Typora/themes/
cd -
# Ruby
echo 'eval "$(/usr/bin/rbenv init - bash)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
rbenv install 3.3.0
rbenv global 3.3.0
# No root PW for MySQL for development
sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY ''"
# Binstubs
cat << EOF >> ~/.bashrc
export PATH="./bin:$PATH"
set +h
alias r='./bin/rails'
EOF
# Setup git aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global pull.rebase true
cat << EOF >> ~/.bashrc
alias g='git'
alias gcm='git commit -m'
alias gcam='git commit -a -m'
alias gcad='git commit -a --amend'
EOF
source ~/.bashrc
# Setup GitHub CLI
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
gh auth login
# Setup GitHub Desktop
wget -qO - https://apt.packages.shiftkey.dev/gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/shiftkey-packages.gpg > /dev/null
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/shiftkey-packages.gpg] https://apt.packages.shiftkey.dev/ubuntu/ any main" > /etc/apt/sources.list.d/shiftkey-packages.list'
sudo apt update && sudo apt install github-desktop
# Setup nodenv
git clone https://github.com/nodenv/nodenv.git ~/.nodenv
sudo ln -vs ~/.nodenv/bin/nodenv /usr/local/bin/nodenv
cd ~/.nodenv
src/configure && make -C src || true
cd ~/
mkdir -p "$(nodenv root)"/plugins
git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
git clone https://github.com/nodenv/nodenv-aliases.git $(nodenv root)/plugins/nodenv-aliases
nodenv install 20.11.1
nodenv global 20.11.1
sudo ln -vs $(nodenv root)/shims/* /usr/local/bin/
echo 'eval "$(nodenv init -)"' >> ~/.bashrc
source ~/.bashrc
# Setup Docker accessories
echo "alias d='sudo docker'" >> ~/.bashrc
source ~/.bashrc
d run -d --restart unless-stopped -p 3308:3306 --name=mysql8 -e MYSQL_ROOT_PASSWORD= -e MYSQL_ALLOW_EMPTY_PASSWORD=true mysql:8
d run -d --restart unless-stopped -p 6379:6379 --name=redis redis
@steelbrain
Copy link

echo "alias d='sudo docker'" >> ~/.bashrc

Instead of doing this, you could add your user to docker group in linux and run it without sudo, ie

sudo usermod -aG docker $USER

@americos
Copy link

I'm curious why you prefer to run rbenv and nodeenv instead something like asdf to manage both Ruby and Node versions?

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