My coding environment setup from scratch on Ubuntu 18.04
When you’ve been working on the same OS for close to 3 years, you definitely want things to function and be set up in a certain way. Recently, my 3-year-old laptop suffered the full wrath of the motherboard deity and I had to switch over to a new laptop. This meant that I had to set up my system from scratch and find the same resources again which I went through over the course of 3 years.
This blog is a collation of the resources I went through again to get my coding environment back up. I definitely don’t want to find the same resources again in case I need them in the future. So, here’s my setup for Ubuntu 18.04 to get back to coding in the fastest way possible.
Basic setup on 1st boot
- Run Software Updater.
- Uninstall Amazon and other unnecessary apps, like gaming, from the Ubuntu Software Center.
- Remove Thunderbird Mail, Rhythmbox, Help, LibreOffice Writer, Ubuntu Software Center, and Firefox from Favorites in the sidebar Dock.
- Run
sudo apt update && sudo apt upgrade
Settings Configuration — Open Settings app first
- Dock — Switch on “Auto-hide the Dock”. (Reason: I like having more pixels available on my screen to code. Dock takes up unnecessary space.)
- Power — Switch off “Automatic Suspend”. (Reason: I don’t want any scripts I might be running to stop because my laptop decided to suspend itself automatically.)
- Devices > Mouse & Touchpad — Switch off “Tap to Click”. (Reason: The last thing I want is to keep clicking on the screen by mistake because my hand touches the touchpad while typing.)
Gnome Tweaks Tool — because Settings Configuration is not enough
- Install Gnome Tweak Tool:
$ sudo add-apt-repository universe$ sudo apt install gnome-tweak-tool
2. Run Gnome Tweak Tool:
$ gnome-tweaks
3. Desktop — Switch off “Show Icons”. (Reason: I like my Desktop to be clean so that I have minimal distractions as soon as I switch on my laptop.)
4. Keyboard & Mouse — Switch off “Middle Click Paste”. (Reason: I absolutely hate it when I mistakenly click the middle click on the touchpad and it pastes a copied text when, in reality, I want to click left/right click.)
5. Keyboard & Mouse — Set “Mouse Click Emulation” to “Area”. (Reason: Right click should work only when the bottom right of the touchpad is clicked.)
6. Power — Switch off “Suspend when laptop lid is closed”. (Reason: I don’t want any scripts I might be running to stop because my laptop decided to suspend itself automatically.)
7. Top Bar — Switch on “Battery Percentage”. (Reason: I don’t want to go through one more click just to see how much battery my laptop has, especially when I might be running out of it.)
8. Top Bar — Switch of “Date” under “Clock”. (Reason: Same as point 7 above.)
Install useful apps and programs
- Install Google Chrome and sync my settings and bookmarks.
- Install VLC using
sudo snap install vlc
- Install ngrok . Follow the installation instructions given on their website.
- Install curl using
sudo apt install curl
- Install make using
sudo apt install make
- Install vim using
sudo apt install vim
Terminal Configuration — Case-insensitive tab completion
- Enable case-insensitive tab completion — Ubuntu by default has case-sensitive tab completion which is extremely annoying. Restart your terminal after running the following commands:
$ if [ ! -a ~/.inputrc ]; then echo '$include /etc/inputrc' > ~/.inputrc; fi
$ echo 'set completion-ignore-case On' >> ~/.inputrc
2. 1st command above means If ~./inputrc doesn't exist yet, first include the original /etc/inputrc so we don't override it
3. 2nd command above means Add option to ~/.inputrc to enable case-insensitive tab completion
Terminator — No, not this one!
I’m not a fan of Ubuntu’s default terminal. I usually use Terminator as it gives me more power over the terminal and makes me more productive.
- The commands given on https://gnometerminator.blogspot.com/p/introduction.html don’t work on Ubuntu 18.04.
- Run
sudo apt install terminator
to install terminator. - Let’s configure terminator now.
- Right-click > Preferences > Profiles tab > default > Command — Set “Hold the terminal open” for “When command exits” drop-down. (Reason: I don’t want the terminal to exit when a command finishes execution.)
- Profiles tab > default > Colors — Set “Built-in schemes” to “Black on white”. (Reason: I like white-background UI more than darker-background.)
- default > Scrolling — Set Scrollback to 1000 lines. (Reason: I want to have more command outputs to scroll back to.)
Git and GitHub configuration
- Install git:
$ sudo apt install git
2. Set up global git user email and name:
$ git config --global user.email "you@example.com"$ git config --global user.name "Your Name"
3. Set up SSH keys and add to your GitHub account for easy push/pull from remote repo:
3.a. Run ssh-keygen
3.b. Just keep pressing [Enter] until the process is complete.
3.c. You will have 2 files in ~/.ssh
folder: id_rsa
(your private SSH key file) and id_rsa.pub
(your public SSH key file).
3.d. Copy the contents of id_rsa.pub
and put it in your GitHub account.
3.e. You will be able to push/pull from your remote GitHub repo using the SSH URL.
Visual Studio Code Setup
- Install Visual Studio Code from https://code.visualstudio.com/
- Remove code slider using App Menu > View — Uncheck “Toggle Minimap”. (Reason: I don’t like a code slider taking up pixels unnecessarily.)
- Set Features > Explorer > Open Editors: Visible to 0 (Reason: I could easily switch between open files via other means. I don’t need an “Open Editors” section for it.)
- Install Settings Sync extension and sync your settings.
Node Setup
- Install nvm
- Install the relevant node versions — I use 8.11.3 and 10.13.0
- Install nodemon using
npm i -g nodemon
MongoDB Setup
- Install mongodb by following the instructions at: https://docs.mongodb.com/manual/installation/
- I used the following set of commands to install MongoDB 4.0.5 on Dec 22, 2018:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list$ sudo apt-get update$ sudo apt-get install -y mongodb-org=4.0.5 mongodb-org-server=4.0.5 mongodb-org-shell=4.0.5 mongodb-org-mongos=4.0.5 mongodb-org-tools=4.0.5$ echo "mongodb-org hold" | sudo dpkg --set-selections
$ echo "mongodb-org-server hold" | sudo dpkg --set-selections
$ echo "mongodb-org-shell hold" | sudo dpkg --set-selections
$ echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
$ echo "mongodb-org-tools hold" | sudo dpkg --set-selections
3. Start mongodb using sudo service mongod start
4. Configure mongodb to start up automatically when the system boots up using sudo systemctl enable mongod.service
Bashmarks setup
- bashmarks is a program which helps you create bookmarks(symlinks) to the folders you specify.
- I use it to bookmark my commonly used folders from command line. Eg: I usually type
g api
to enter into my API folder instead ofcd ~/my-user-name/folder-1/folder-2/folder-3/api/
- Install bashmarks using the following commands:
$ git clone git://github.com/huyng/bashmarks.git$ cd bashmarks$ make install
4. Add source ~/.local/bin/bashmarks.sh
to the end of ~/.bashrc
5. Create your bashmarks using the commands specified in https://github.com/huyng/bashmarks#shell-commands
Redis Setup
- Download Redis from https://redis.io/download
- Extract tarball and
cd
into the directory. Install Redis using the following commands:
$ sudo apt install gcc tcl8.5$ make$ make test$ sudo make install$ cd utils$ sudo ./install_server.sh
Other relevant programs setup
- Download Studio 3T from https://studio3t.com/download/ and install Studio 3T following the instructions at https://studio3t.com/knowledge-base/articles/installation/#studio-3t-for-linux-e-g-ubuntu-debian
- Install Postman — the right way
- Install Meteor using
curl https://install.meteor.com/ | sh
- Install Java 8 using
sudo apt install openjdk-8-jdk
- Download ElasticSearch .deb file from https://www.elastic.co/downloads/elasticsearch and Kibana .deb file from https://www.elastic.co/downloads/kibana. Install them using
dpkg
utility.
Hurray! Let’s start coding!