DEV Community

Mohan Murali
Mohan Murali

Posted on

Web Developer environment setup for a new Ubuntu/ Ubuntu based distro

In this post I will share the common developer environment setup steps once you have a new Ubuntu/Ubuntu based distro setup. This can be a clean OS installation or a Windows subsystem for Linux setup.

So the first thing we need to do is update the existing packages currently present. To do that we need to run the following command in the terminal. This will make sure that you have the latest security patches updated in your instance.

sudo apt-get update
sudo apt-get upgrade
Enter fullscreen mode Exit fullscreen mode

Now we will install NodeJs. We will install NodeJs using the apt package manager which is the default package manager for Ubuntu. We need to use the following command on the terminal to install the latest LTS version of NodeJs.

sudo apt install nodejs
Enter fullscreen mode Exit fullscreen mode

Verify that node is installed using the below command

node -v
Enter fullscreen mode Exit fullscreen mode

Node will also install node package manager. If you don't see node package manager, then you can install it separately using the below command.

sudo apt install npm
Enter fullscreen mode Exit fullscreen mode

You can verify the installation with

npm -v
Enter fullscreen mode Exit fullscreen mode

I also like to install Node Version Manager (NVM) tool. NVM makes working with different versions of NodeJs so much easier. To install NVM you need to use the following command

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 
Enter fullscreen mode Exit fullscreen mode

Once nvm is installed, you will need to restart your terminal to be able to use it.

Most of the Linux distro installations should come with Git. But if git is not present in your installation, you can easily install it using the below command.

sudo apt install git
Enter fullscreen mode Exit fullscreen mode

Once you have installed git, you need to configure it with your user name and email. This can be done with the following command

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
Enter fullscreen mode Exit fullscreen mode

I like to configure some global git alias as well to make my life easier to work with git. The most common one if to get a better log info. This is what I use.

git config --global alias.lg "log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
Enter fullscreen mode Exit fullscreen mode

Next thing you need to do is install a text editor of your choice. I like to install VSCode. It works especially well with WSL.

With this you should be good to start with your development journey. But I like to do the following things to improve my developer experience. Feel free to skip this part if you are new or not interested in this.

The default editor for Ubuntu is nano. I don't really like to use nano. So I usually change it to vim. Ubuntu comes with vim pre-installed as well. You can change the default editor using the below command

sudo update-alternatives --config editor
#Type the number which corresponds to vim and press enter
Enter fullscreen mode Exit fullscreen mode

This should set your default editor to vim. You can change it to something else as well with the same command if you don't prefer vim.

Next think I like to change is the default shell. By default Ubuntu comes with Bash shell which is not the best shell option to have. I like to install ZSH. To do that use the following command

sudo apt install zsh
Enter fullscreen mode Exit fullscreen mode

Once ZSH is installed, you need to change the default shell from bash to ZSH. Use the following command to do that.

chsh -s $(which zsh)
Enter fullscreen mode Exit fullscreen mode

You will need to restart your terminal window to see the change. To verify that the default shell is set to ZSH, use the following command

echo $SHELL
Enter fullscreen mode Exit fullscreen mode

This should print out the following output.

/usr/bin/zsh
Enter fullscreen mode Exit fullscreen mode

If everything is fine, then we move on to install Oh My Zsh which is a framework for managing your ZSH configuration. It superpowers your terminal experience and a must have according to me. You can install Oh My Zsh with the below command.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Once its installed you should see the following in your terminal.
oh-my-zsh install success

Now you need to select a good theme for your oh-my-zsh installation. You can browse the list of available themes from the below links.

https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes

Once you have selected the theme, you open your .zshrc file and change the theme name. .zshrc file is located in your home folder which can be accessed by using cd ~

ZSH_THEME="intheloop"
Enter fullscreen mode Exit fullscreen mode

Once this is done you will need to restart your terminal fo rthe change to take place.

Now you are really good to start your development journey in your new Ubuntu based instance (This time honestly).

Happy Coding!

Top comments (0)