Install scripts
This chapter contains multiple install scripts for multiple programming languages and tools. These scripts were made for WSL using Ubuntu.
Programming Languages
Simple install scripts for different programming languages.
Python
First install all tools necessary to build Python.
sudo apt install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl \
git
The install pyenv and clone in it into any folder you like, here it will clone into a directory called ~/.pyenv.
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
Lastly, install any version of Python you want to use, here I'm using Python 3.10.x.
pyenv install 3.10.x
And also don't forget to set a global python version.
pyenv global 3.10.x
Javascript
Using the installation script at github.com/nodesource/distributions.
Download and import the Nodesource GPG key.
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
Create deb repository
set NODE_MAJOR 20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
Run Update and Install
sudo apt-get update
sudo apt-get install nodejs -y
Both of these npm replacements are useful for installing packages, install either pnpm or yarn.
# yarn
sudo npm install -g yarn
# pnpm
sudo npm install -g pnpm
Rust
Using this command installing rust and all of its tools is really easy. Just don't forget to add .cargo to your PATH. Most likely you'll also want to install a complete rust toolchain.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Install a complete toolchain
sudo apt-get update
sudo apt install build-essential -y
Odin
Installing Odin requires some more steps.
First we'll start by cloning the repository and directly move into this newly created directory.
git clone https://github.com/odin-lang/Odin && cd Odin
Then we need to install some dependencies to build Odin. The last command will set the default llvm version to version 12.
sudo apt update
sudo apt install llvm-12
sudo apt install clang
sudo update-alternatives --install \
/usr/bin/llvm-config llvm-config /usr/bin/llvm-config-12 200
Once that's done we can build Odin and don't forget to add the Odin folder to your path.
make
To get a better experience with Odin we will install the Odin Language Server, or more commonly knows as ols.
git clone https://github.com/DanielGavin/ols && cd ols
Then build it.
./build.sh
Next replace the default ols.json file with a more configured version, something like this (replace path with the path to your Odin folder):
{
"collections": [
{
"name": "core",
"path": "/home/user/Odin/core"
}
],
"thread_pool_count": 4,
"enable_semantic_tokens": false,
"enable_document_symbols": true,
"enable_hover": true,
"enable_format": true,
"enable_snippets": true,
"formatter": {
"tabs": false,
"characters": 90
}
}
Using neoclide we can add odin to the languageservers. (Launch the coc-settings.json file by using the following command in neovim: :CocConfig)
{
"languageserver": {
"odin": {
"command": "ols",
"filetypes": ["odin"],
"rootPatterns": ["/home/user/ols/ols.json"]
}
}
}
Nim
Nim has made the installation process very simple, you only need to add the following to your path variables: ~/.nimble/bin.
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
Go
Go's installation process can be a bit tricky, but it's not too bad.
First we'll fetch version 1.18 of Go, of course you can use any version you want.
wget https://go.dev/dl/go1.18.linux-amd64.tar.gz
Then we'll extract it to the current directory.
tar -zxvf go1.18.linux-amd64.tar.gz
Lastly we'll move the binary to the /usr/local/go directory, and add it to your path variables. In some case you may need to add /bin to the path.
sudo mv go /usr/local/go
Tools
Install scripts for useful tools.
Neovim
Installing neovim should be pretty easy.
First get the latest appimage:
curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage
Then chmod it to be executable:
chmod u+x nvim.appimage
If you run ./nvim.appimage a new neovim instance will be started.
Then you can move it to somewhere in your $PATH. To keep our home directory clean, we'll move it to ~/bin. Make sure ~/bin is in your $PATH.
mkdir -p ~/bin
mv ./nvim.appimage ~/bin/nvim
Incase nvim fails to open, try the following:
./nvim.appimage --appimage-extract
./squashfs-root/AppRun --version
sudo apt install libfuse2
Vimplug
Vimplug is a plugin manager for Vim. Installing it is pretty easy.
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
If you already had an init.vim or .vimrc file, you will need to run :PlugInstall in your Vim instance to install the plugins.
If neoclide is one of your extensions, installing some lsp's might be useful. Using coc-marketplace you can view all available extensions, which you can call upon by using :CocList marketplace.
:CocInstall coc-marketplace coc-yaml coc-vimlsp coc-tsserver coc-tslint coc-toml coc-rust-analyzer coc-pyright coc-prettier coc-pairs coc-json
Fish
Install fish can be done with the following commands:
sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
sudo apt install fish
Then, if you wish, you set the default shell to fish.
chsh -s /usr/local/bin/fish
Dotfiles
You can find my dotfiles at beastmatser/dotfiles. You can install them by running:
git clone http://github.com/beastmatser/dotfiles ~/dotfiles && cd ~/dotfiles
# .gitignore does not work with stow, so we'll symlink it manually
ln -s ~/dotfiles/git/.gitignore ~/.gitignore
My dotfiles are managed by stow. First, you need to install stow:
sudo apt install stow
Then you can stow any directory you want e.g.:
stow fish
stow nvim
# You can also stow all of the dotfiles
stow */