Setting up Linux and Dev environment for beginners

Vithulan MV
4 min readMay 8, 2016

In this blog post, we’ll see about installing Ubuntu and setting up a development environment for software developers.

You can install any Linux distribution to follow this post, but my favourite Linux distribution is Ubuntu, its fast, stable and got excellent community support. When you’re installing Ubuntu, it's better if you install an LTS (Long Term Support) version, so you’ll receive multiple core updates and bug fixes often.

Downloading and Booting

You can download the latest version of Ubuntu from the official Ubuntu site. Download here.

After downloading an image (ISO) file, you have to boot the image into USB or into a DVD. For booting there several free software available in online, my favourite one is, Rufus.

Installing Ubuntu

We can install Ubuntu in 2 ways,

  1. Installing Ubuntu alongside Windows
  2. Installing only Ubuntu

Installing Ubuntu alongside Windows

For this, first, you have to shrink a windows partition. If you don’t know about shrinking and partitioning, Follow this tutorial
After completing the tutorial, you should be having some free space in the new volume (At least 30GB of free space is recommended).

Now insert your bootable USB/DVD and restart the machine. Then boot into the image, now you’ll see this window,

  • Select install Ubuntu.
  • Select Something else
  • Now you will see the unallocated disk space in the menu. Select that and add a /swap area (It should be doubler size than your RAM). Then allocate the rest unallocated memory to the root (/) or you can even set /home partition. Follow this link for more guidance in Ubuntu partitioning.
  • Follow the instructions
  • Ubuntu installed!

Installing only Ubuntu

Before continuing into this, please backup all your data from all your disks. Either you can accomplish this by doing the previous step (Going into something else and deleting all existing partitions and re-allocating them into appropriate types of partitions) or you can select Erase all and install Ubuntu 16.04 LTS. This will erase all your disks and install only Ubuntu on your machine.

Installing Java in Ubuntu is must required task for all software developers. You can either install Java from the Ubuntu repository or from 3rd party repositories.

Using local repository

This will install OpenJDK into your system. If you want to install Oracle JDK install it from a remote repository using the following commands.

Using remote repository

sudo apt-add-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer

Setting environment variable

Usually Java will be installed into /usr/lib/jvm/java-8-oracle. Open /etc/environment file.
These are just key-value pairs, it will work every time you links /etc/environment.
But for set Environment variable at shell startup, you should set it in,
~/.bashrc — If you will run Java application in shell.
/etc/profile — For globally.
Add your JAVA_HOME and PATH into this.

JAVA_HOME= "/usr/lib/jvm/java-8-oracle" export JAVA_HOME PATH= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$JAVA_HOME/bin"

source /etc/environment
source ~/.bashrc
java -version

If you have set the environment variable in /etc/profile, simple logout and login 🙂. This will show the Java version installed and other details if you successfully install the Java and ‘echo $JAVA_HOME’ will show the JAVA_HOME path.

After installing Java, you can install your preferred IDEs, text editors and build tools for your development process.

IntelliJ Idea

You can download IntelliJ Idea from here.
Unzip the pack, go to Idea_Home/bin and then open terminal; run ./idea.sh
Then follow the instructions. It will install IdeaJ into your Ubuntu distribution.

Sublime editor

I prefer Sublime editor for editing Java/HTML/JS/Python etc codes. It can highlight the code pattern and even can predict the words.
Download Sublime 3 from here.

Maven

Maven is a build automation tool used primarily for Java projects. The word maven means “accumulator of knowledge” in Yiddish.

sudo apt-get update sudo apt-get install maven

You can check the successful installation by running the following command,

mvn -version

Gradle

Gradle is an open-source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL) instead of the XML form used by Apache Maven of declaring the project configuration. Gradle is not available in the local repository. Download the latest release from here.

Create a folder gradle in /usr/lib. Unpack the zip file into /usr/lib/gradle. Now set the environment variables.

Open /etc/environment and add the following

GRADLE_HOME= "/usr/lib/gradle/gradle-2.13" export GRADLE_HOME PATH= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$JAVA_HOME/bin:$GRADLE_HOME/bin"

After saving, run

source /etc/environment
gradle -version

This will show the Gradle version and all if you successfully installed Gradle into your ubuntu.

Now you have successfully set up the development environment for development. If you have any issues during following these steps, feel free to drop a comment and contact me.

Thank you!
Happy Coding!! 😀

Originally published at http://vithulanmv.wordpress.com on May 8, 2016.

--

--