Introduction

We developers always choose Windows when purchasing our laptops but have desire to get our hands dirty on Linux environments.

Windows 10 provides Windows Subsystem for Linux (WSL), which is a feature that creates a lightweight environment that allows you to install and run supported versions of Linux (such as Ubuntu, OpenSuse, Debian, etc.) without the complexity of setting up a virtual machine or different computer.

WSL is good for evaluation purposes. It does not provide us all the power and features of Linux System. It would be ideal to run Linux instance on VM instead of using WSL for extensive use with our development. Running Linux instance on VM has it pros and cons which we would not discuss here.

Running Linux along side with Windows OS via Dual Boot is an ideal solution for most of the case. Follow instructions provided

here
to install Ubuntu 19.10 alongside Windows 10 in dual boot environment.

Software and Applications that we setup on Ubuntu 19.10

Below are the Softwares and Applications that we are going to setup on Ubuntu 19.10 that is dual boot along side with Windows 10. These are mainly focused for Java Development environment, but it is not limited for other development technologies.

Uplifting Ubuntu 19.10 to Kubuntu 19.10

Kubuntu is a community developed and supported project which provides the latest stable KDE software on top of a stable Ubuntu core. It provides applications which are more compelling with those provided with stock ubuntu.

You can choose to download Kubuntu 19.10 and install in dual boot alongside Windows 10 or you can upgrade Ubuntu 19.10 to Kubuntu 19.10.

Below are some snaphots of my pc running Kubuntu 19.10

Kubuntu Desktop
Kubuntu Desktop mimicking Windows Desktop layout

Konsole Terminal
Multi tab layout with Konsole

Konsole Terminal
Multi tab splitted view layout with Konsole

KDE Software
Software store

Setup Instructions

Follow below steps to install & configure softwares and applications that we listed earlier:

Install curl

sudo apt install curl

Install wget

sudo apt-get install wget

Install libz - needed for building graalvm native image

sudo apt-get update -y
sudo apt-get install -y libz-dev

Install sdkman

$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk version

Install GraalVM JDK 11

$ cd /home/<user>/Downloads

$ wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.0.0/graalvm-ce-java11-linux-amd64-20.0.0.tar.gz

$ tar -xvzf graalvm-ce-java11-linux-amd64-20.0.0.tar.gz
$ sudo mv graalvm-ce-java11-20.0.0/ /usr/lib/jvm/
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/bin/java 1
$ java -version
$ vi ~/.bashrc

export JAVA_HOME=/usr/lib/jvm/
export PATH=${PATH}:${JAVA_HOME}/bin

export GRAALVM_HOME=/usr/lib/jvm/
$ cd /home/<user>/Downloads

$ wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.0.0/native-image-installable-svm-java11-linux-amd64-20.0.0.jar
$ gu -L install native-image-installable-svm-java11-linux-amd64-20.0.0.jar
$ gu list
$ mkdir /home/<user>/learning/java

$ vi HelloWorld.java
public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World!");
  }
}

$ javac HelloWorld.java

$ native-image HelloWorld

$ ./helloworld

Install maven

$ sdk install maven

$ mvn -v

Install Gradle

$ sdk install gradle
$ gradle -v

Install Kotlin

$ sdk install kotlin
$ kotlin -version

Install Git

$ sudo apt install git
$ git --version

Configure git credentials

$ git config --global user.name "Madan Narra"
$ git config --global credential.helper store
$ git pull
$ provide credentials when prompted

Install Nodejs 12

$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ sudo apt-get install -y npm

This should install Node v12.x.x and NPM v6.x.x.

$ node --version
$ npm --version
$ sudo npm install -g yarn
$ yarn -v

Install Docker

$ sudo apt-get update
$ sudo apt install docker.io
$ sudo systemctl start docker
$ sudo systemctl enable docker
$ docker --version
$ sudo groupadd docker

$ sudo usermod -aG docker ${USER}

$ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R

$ sudo chmod g+rwx "$HOME/.docker" -R

$ sudo chmod 666 /var/run/docker.sock

$ newgrp docker
$ docker login

Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: XXXXXXXXX
Password: 
WARNING! Your password will be stored unencrypted in /home/madan/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

Install Docker Compose

Download Docker Compose
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Apply executable permissions to the binary
$ sudo chmod +x /usr/local/bin/docker-compose
Test the installation
$ docker-compose --version

Install microk8s

$ sudo snap install microk8s --classic
$ sudo usermod -a -G microk8s $USER
$ su - $USER
$ microk8s.kubectl get nodes
$ sudo snap alias microk8s.kubectl kubectl
$ vi ~/.bashrc
$ alias k='microk8s.kubectl'
$ sudo ufw allow in on cni0 && sudo ufw allow out on cni0
$ sudo ufw default allow routed
$ microk8s.kubectl config view --raw > $HOME/.kube/config

Set Python 3 as default

Ubuntu comes with Python 2 & Python 3 by default. When documenting this article, below are the versions available in Ubuntu 19.10

Python Versions Available
$ python --version
Python 2.7.17

$ python3 --version
Python 3.7.5

Run the below command to use Python3 as default

$ update-alternatives --install /usr/bin/python python /usr/bin/python3 10

Now running below command will confirm Python3 is set as default

$ python --version
Python 3.7.5

Install pip - Package Management System

Install pip
$ sudo apt update

$ sudo apt install python3-pip

$ pip3 --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

pip packages will be installed in “ folder. Add this directory to PATH to start using the installed packages

Configure Path
$ vi ~/.bashrc

Add the following line at the end of the file. Save the file

export PATH="/home/madan/.local/bin:$PATH"

Save the file and load the new $PATH to current shell session

$ source ~/.bashrc

$ echo $PATH

Install softwares from Ubuntu Software

IntelliJ

Install Intellij IDEA Community edition from Ubuntu Software.

Install the below plugins for more productivity with IntelliJ

For PlantUML to work, we need to install Graphviz. Use the below command to install

$ sudo apt install graphviz

Install Postman

$ sudo snap install postman

Utilities

Flameshot

Flameshot is Powerful yet simple to use screenshot software.

$ sudo apt install flameshot

Assign PrtScr to Falemshot in Kubuntu

Assign PrtScr to Flameshot in Ubuntu

gsettings set org.gnome.settings-daemon.plugins.media-keys screenshot '[]'

SimpleScreenRecorder

SimpleScreenRecorder is a Linux program that record programs and games capturing the entire screen or part of it.

$ sudo apt-get update

$ sudo apt-get install simplescreenrecorder

Gravit Designer

Gravit Designer is a free full-featured vector graphic design app that works on ALL platforms. Unlock the full power of your creativity with fast and flexible tools tailored to professional designers.

$ sudo snap install gravit-designer

Create work folder and set permissions

Its always better to isolate our work into specific folder. Below are the commands to create folder work and setting appropriate permissions.

$ cd /home/<user>

$ sudo mkdir work

Changes the permission mode for work directory so that the owner and group has full read/write/(execute or search) access and all others have read and execute/search access.

$ sudo chmod 775 work/

Alternatively add <USER_NAME> to the users group and then make users the group owner for worl folder

$ sudo adduser <USER_NAME> users

$ sudo chown -R <USER_NAME>:users work/

Useful Linux cheatsheet Commands

Top – Linux Process Monitoring
$ top
Htop – Linux Process Monitoring
$ sudo snap install htop

$ htop
Lsof – List Open Files
$ lsof

$ sudo lsof -i -P -n | grep LISTEN

$ sudo lsof -i:22 ## see a specific port such as 22 ##
Netstat – Network Statistics
$ sudo apt install net-tools

$ netstat -a | more

$ netstat -tulpn | grep LISTEN

$ netstat -plnt | grep ':80'
check which process binds a TCP Socket on port 8080
$ fuser -v -n tcp 8080
Dump socket statistics Alternative to netstat
$ sudo ss -tulwn

$ ss -nt '( dst :8443 or dst :8080 )'

$ ss -nt '( dst :5432 )'
Kill Process
$ kill PID

## Force kill
$ kill -9 PID
Resources consuming by specific process
# Show running Java Process
$ jps

# Get stats for specific java process
$ ps -p <PID> -o %cpu,%mem,cmd

Conclusion

This post describes development environment on Ubuntu for Java developers but not limited to others. This is self reference post for myself to reinstall and configure my development environment with simple easy steps if something goes wrong with my Ubuntu OS.

I liked Kubuntu with its look and feel mimicking windows environment. Its better to download Kubuntu OS and configure it to run along side Windows 10 rather then updating Ubuntu to Kubuntu.

Hope this helps for those looking for who wants to get their hands dirty by developing on Ubuntu !!!