Config is a basic checklist I follow to set up a new Ubuntu's development environment. It gets me up to speed with Git, Ruby, Node.js, GitHub, Jekyll, and more so I can more quickly get back to coding.
||Customizes the Terminal prompt and echoes the currently checked out Git branch.|
||The Git ignore file that I use everywhere.|
||The Git attributes file that I use everywhere.|
Shell script (WIP)
This repository includes a shell script for executing the bulk of the configuration process. First, install and agree to terms for WSL, then download and run Windows Terminal. Then, enter the following in Terminal:
cd $Home && mkdir -p downloads && curl https://raw.githubusercontent.com/MilanAryal/config/master/config.sh > ~/dl/config.sh && bash ~/downloads/config.sh
Table of contents
Setup GitHub Desktop cloning path:
Ubuntu, PowerShell, Microsoft Terminal, Visual Studio Code,.. are on Microsoft Store.
2. Setup WSL
- Follow official updated steps to install WSL for Windows 10. See https://docs.microsoft.com/en-us/windows/wsl/install-win10.
Forgot WSL password? See https://aka.ms/wslusers.
3. Prep WSL
- Update and upgrade packages:
sudo apt update && sudo apt upgrade -y
- Install required dependencies:
sudo apt install -y build-essential procps curl file git zlib1g-dev
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/home/linuxbrew/.linuxbrew/binin your PATH:
# See https://docs.brew.sh/linux for more information # Add Homebrew to your PATH in /home/milan/.profile: $ echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/milan/.profile $ eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" # Install the Homebrew dependencies if you have sudo access: $ sudo apt install -y build-essential # We recommend that you install GCC: $ brew install gcc # Run `brew help` to get started # Further documentation: https://docs.brew.sh
- Log out then log back in to confirm the install.
Caution: Never attempt to edit Linux system files like .bashrc or .profile with a Windows text editor. Windows file metadata differs from Linux file metadata. You could corrupt or damage your Linux environment. Use Bash commands as above, or use a Linux text editor such as nano or vi. You can also use a specialized Windows editor like Notepad++ that can save text as Unix script files.
4. Setup Ruby
- Install rbenv via Homebrew:
brew install rbenv
- Set up rbenv in your shell. Run
echo 'eval "$(rbenv init -)"' >> ~/.profile
$PATHfor access to the
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
- Verify rbenv is configured properly:
- Verify that rbenv is properly set up using rbenv-doctor script:
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
- Download a version of Ruby via rbenv: See https://gorails.com/setup/ubuntu/20.04.
# Download a version of Ruby via rbenv: $ rbenv install 2.7.4 # Make it the global version of Ruby: $ rbenv global 2.7.4 # Additional dependencies: $ gem install bundler
- Ruby dependencies:
sudo apt install -y build-essential zlib1g-dev
Installing and managing Ruby with rbenv allows us to specify versions of Ruby on a per-project basis. It also means we can avoid running sudo commands for installing gems and more as it's not affecting OS's system Ruby.
Having trouble with nokogiri? See https://stackoverflow.com/a/41491487.
5. Setup Node.js
- Install nodenv via Homebrew:
brew install nodenv
- Set up nodenv in your shell. Run
echo 'eval "$(nodenv init -)"' >> ~/.profile
$PATHfor access to the
echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bashrc
- Verify nodenv is configured properly:
- Verify that nodenv is properly set up using nodenv-doctor script:
curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-doctor | bash
- Download a version of Node.js via nodenv:
# Download a version of Node.js via nodenv: $ nodenv install 14.18.1 # Make it the global version of Node.js: $ nodenv global 14.18.1 # https://www.npmjs.com/package/npm-check-updates $ npm install -g npm-check-updates
- Node.js dependencies:
sudo apt install -y build-essential
Installing and managing Node.js with nodenv allows us to specify versions of Node on a per-project basis. It also means we can avoid running sudo commands for installing global packages and more as it's not affecting OS's system Node.js.