Skip to content

Instantly share code, notes, and snippets.

@kevgathuku
Forked from dhh/linux-setup.sh
Created May 18, 2024 16:57
Show Gist options
  • Save kevgathuku/d01a045b9aea0318b2e3fcf2f6a5a4f6 to your computer and use it in GitHub Desktop.
Save kevgathuku/d01a045b9aea0318b2e3fcf2f6a5a4f6 to your computer and use it in GitHub Desktop.
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl btop \
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 nautilus-dropbox
sudo snap install code --classic
# 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
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
mkdir -p ~/snap/typora/88/.config/Typora/themes/
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.1
rbenv global 3.3.1
# 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 Docker
echo "Add user to docker group (needs restart to become effective)"
sudo usermod -aG docker ${USER}
echo "alias d='docker'" >> ~/.bashrc
source ~/.bashrc
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
d run -d --restart unless-stopped -p 3306: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
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment