Last active
October 31, 2022 11:32
-
-
Save andrefcdias/8374ed834fe0da107fdbc230b157c1b2 to your computer and use it in GitHub Desktop.
Setup a Linux dev environment
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 | |
# Update and upgrade packages | |
sudo apt-get update | |
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y | |
#region ohmyzsh | |
# Install | |
sudo apt-get install zsh -y | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | |
# Add to source script | |
echo "" >> ~/.zshrc | |
# echo "ZSH_DISABLE_COMPFIX=true" >> ~/.zshrc | |
#endregion | |
#region brew | |
# Install dependencies | |
sudo apt-get install build-essential gcc -y | |
# Install | |
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) | |
# Add to path | |
echo "# brew" >> ~/.zshrc | |
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.zshrc | |
echo "" >> ~/.zshrc | |
#endregion | |
#region zsh tools | |
#region zsh-completions (https://github.com/zsh-users/zsh-completions) - Additional completion definitions | |
# Install | |
brew install zsh-completions | |
# Postinstall | |
# rm -f ~/.zcompdump; compinit | |
# chmod -R go-w "/home/linuxbrew/.linuxbrew/share/zsh" | |
# Add to path | |
echo "# zsh-completions" >> ~/.zshrc | |
echo "if type brew &>/dev/null; then" >> ~/.zshrc | |
echo " FPATH=\$(brew --prefix)/share/zsh-completions:\$FPATH" >> ~/.zshrc | |
echo " autoload -Uz compinit" >> ~/.zshrc | |
echo " compinit" >> ~/.zshrc | |
echo "fi" >> ~/.zshrc | |
echo "" >> ~/.zshrc | |
#endregion | |
#region zsh-autosuggestions (https://github.com/zsh-users/zsh-autosuggestions) - Fish-like fast/unobtrusive autosuggestions for zsh. | |
# Install | |
brew install zsh-autosuggestions | |
# Add to path | |
echo "# zsh-autosuggestions" >> ~/.zshrc | |
echo "source /home/linuxbrew/.linuxbrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc | |
echo "" >> ~/.zshrc | |
#endregion | |
#region zsh-syntax-highlighting (https://github.com/zsh-users/zsh-syntax-highlighting) - Fish shell-like syntax highlighting for Zsh. | |
# Install | |
brew install zsh-syntax-highlighting | |
# Add to path | |
echo "# zsh-syntax-highlighting" >> ~/.zshrc | |
echo "source /home/linuxbrew/.linuxbrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc | |
# echo "export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/home/linuxbrew/.linuxbrew/share/zsh-syntax-highlighting/highlighters" >> | |
echo "" >> ~/.zshrc | |
#endregion | |
#region zsh-history-substring-search (https://github.com/zsh-users/zsh-history-substring-search) | |
# Install | |
brew install zsh-syntax-highlighting | |
# Add to path | |
echo "# zsh-history-substring-search" >> ~/.zshrc | |
echo "source /home/linuxbrew/.linuxbrew/share/zsh-history-substring-search/zsh-history-substring-search.zsh" >> ~/.zshrc | |
echo "" >> ~/.zshrc | |
# Bind arrow key search | |
bindkey "$terminfo[kcuu1]" history-substring-search-up | |
bindkey "$terminfo[kcud1]" history-substring-search-down | |
#endregion | |
#region n (https://github.com/tj/n) | |
# Install n | |
brew install n | |
# Add perms to /usr/local | |
# make cache folder (if missing) and take ownership | |
sudo mkdir -p /usr/local/n | |
sudo chown -R $(whoami) /usr/local/n | |
# make sure the required folders exist (safe to execute even if they already exist) | |
sudo mkdir -p /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share | |
# take ownership of Node.js install destination folders | |
sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share | |
source ~/.zshrc | |
# Use node LTS | |
n lts | |
#endregion | |
# Set default shell to zsh | |
chsh -s $(which zsh) | |
zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment