My Development Environment Setup on Linux

As I mentioned in my previous post Thinking of moving from Windows to Linux? I am moving from Windows to Linux. Setting up my development environment is a bit tedious because I have to hunt down the applications and execute various commands to setup. So I thought of make a note of them in a post so that it will be easier for me next time.

I am using Ubuntu/LinuxMint system so I am using apt-get to install, if you are using Fedora/CentOS you can use yum/dnf.

The very first thing I do after installing Linux is updating the system and in case I am working on VirtualBox VM installing VirtualBox Guest Additions.

sudo apt-get update
sudo apt-get install virtualbox-guest-dkms virtualbox-guest-x11

Setting up Java Development Environment


java

Some Linux distros come with OpenJDK by default. You may want to remove OpenJDK first and install Oracle JDK.

sudo apt-get purge openjdk-*

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

To install Java 7 sudo apt-get install oracle-java7-installer
To install Java 8 sudo apt-get install oracle-java8-installer

If you want to set JAVA_HOME environment variable for a particular user then you can add JAVA_HOME in ~/.bash_profile or if you want to setup for all the users globally then you can add it to /etc/profile file.

> vi ~/.bash_profile or vi /etc/profile

Append the following to the file:

export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$PATH:$JAVA_HOME/bin

> source ~/.bash_profile or source /etc/profile

After installing JDK you may want to download your favorite IDE from the following locations:

 

netbeans0 intellijidea STS eclipse-800x188

http://www.eclipse.org/downloads/
https://spring.io/tools/sts/all
http://tools.jboss.org/downloads/devstudio/index.html
https://netbeans.org/downloads/
https://www.jetbrains.com/idea/download/

Most of the times I work with either Tomcat or JBoss/Wildfly servers. You cand ownload them from the following locations:

Wildfly_logo Tomcat-logo

https://tomcat.apache.org/download-80.cgi
http://wildfly.org/downloads/

To install build tools like Ant or Maven
> sudo apt-get install ant
> sudo apt-get install maven

We can install various softwares like Groovy, Grails, Gradle etc you can use SDKMan (http://sdkman.io/) which was previously known as GVM.


sdkman

> curl -s http://get.sdkman.io | bash
> source "$HOME/.sdkman/bin/sdkman-init.sh"
> sdk version
> sdk install groovy
> sdk install grails
> sdk install gradle

Install MySQL server
You can install MySQL server and MySQL Workbench from Ubuntu Software Center.


mysql

But if you prefer commandline installation

> sudo apt-get install mysql-server
> sudo apt-get install mysql-workbench

Installing NodeJS
Installing NodeJS become a little bit complicated because it is going through some changes(nodejs, nodejs-legacy, io.js etc).


Basic RGB

You can install latest NodeJS using following commands:

> sudo apt-get install curl
> curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
> sudo apt-get install nodejs

For further details refer https://github.com/nodejs/node-v0.x-archive/wiki/Installing-Node.js-via-package-manager

Install yeoman and generators
Yeoman (http://yeoman.io/) makes it easy to develop front-end applications by automating various tasks using bower, grunt or gulp.


yeoman-logo

Install yeoman sudo npm install -g yo bower grunt-cli gulp
Install various generators
> sudo npm install -g generator-webapp
> sudo npm install -g generator-angular
> sudo npm install -g generator-jhipster
> sudo npm install -g generator-meanjs
> sudo npm install -g cordova ionic

Installing Ruby and RubyOnRails
You may be using Ruby or tools that depends on Ruby like OpenShift commandline tools, Jekyll etc.


ruby-on-rails

You can find the very detailed instructions on how to install Ruby/RubyOnRails at https://gorails.com/setup/ubuntu/15.04

Just for the sake of quick reference I am repeating the steps here:

> sudo apt-get update
> sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

> cd
> git clone git://github.com/sstephenson/rbenv.git .rbenv
> echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
> echo 'eval "$(rbenv init -)"' >> ~/.bashrc
> exec $SHELL

> git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
> echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
> exec $SHELL

> git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash

> rbenv install 2.2.3
> rbenv global 2.2.3
> ruby -v

> echo "gem: --no-ri --no-rdoc" > ~/.gemrc
> gem install bundler

> gem install rails -v 4.2.4

Installing Jekyll
Jekyll (https://jekyllrb.com) is a static site generator which you can use to generate your site and host it on github.


jekyll

> gem install jekyll

Test drive Jekyll
> jekyll new myblog
> cd myblog
> jekyll serve

Hope these installation instructions helps!!

Note: All the images belong to their respective owners.

How to SSH into VirtualBox Linux OS?

While learning some of the Linux commands we may want to use SSH commands to login into a remote Linux system and we may not have a dedicated Linux system to play with.
In this post I will explain how I am using my Linux OS installed on VirtualBox to SSH from Windows OS.

virtualbox   prompt

1. Install openssh-server on Linux OS in VirtualBox
sudo apt-get install openssh-server

On some Linux distros (ex: Fedora) the openssh server won’t start automatically.

You can enable it to start automatically using the following command:

systemctl enable sshd.service

Now you can restart the VM or start the service in the current session itself using

systemctl start sshd.service

2. Shutdown your Linux VM if it is already running.
Select Linux VM in Virtualbox and go to Settings -> Network.
In Adapter 1 tab Enable Network Adapter is selected.
Go to Adapter 2 tab and check Enable Network Adapter.
For Attached To option select Host-only Adapter and click OK.

3. Start your VirtualBox Linux VM
Open Terminal and run ifconfig command
eth1 Link encap:Ethernet HWaddr 08:00:27:7e:ea:89
inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe7e:ea89/64 Scope:Link

Now from you Windows OS you can use Putty to connect to your Linux OS usinng SSH as follows:

ssh username@192.168.56.101

Enjoy 🙂

Thinking of moving from Windows to Linux?

I have been using Windows operating system from the beginning. When I first started using computer Windows XP was the latest operating system and it was amazing. After few years I started my career as a Java developer and in my office also I have been using Windows only.
After few years Windows Vista got released and I suffered with it for few months and then Microsoft released Windows 7 which is the best Windows operating system IMO. And then they released Windows 8 which I don’t like much. Recently they released Windows 10 and I have upgraded from Windows 8.1 to Windows 10. Windows 10 is certainly better than Windows 8 but it still sucks compared to Windows 7.

I think the main reason for the popularity of Windows operating systems is the familiarity of the same look and feel of their all operating systems and they changed it (in a horrible way).

Few years ago I got to learn a bit about Linux in order to deploy my application on remote deployment servers and I used to get it done using few comments and I never really bothered to learn Linux. A year ago one of my friend suggested to look at Ubuntu which is a Linux OS with a nice Desktop Environment (DE). I installed Ubuntu on VirtualBox and played with it couple of days and left it because it was too slow on my VirtualBox.

Why I want to lean and use Linux as my primary desktop OS?

  • These days I am spending good amount of time deploying apps on remote Linux servers, so I need to learn more about Linux.
  • I don’t like Windows 8/8.1/10 OS mobile style desktop UI. I want my good old familiar Windows 7 style GUI. I came to know there are some Linux distros which looks like Windows 7.
  • I am really bored working on same Java technologies like Spring, JPA, JavaEE etc for almost 8 years and I wanted to tinker with something new and interesting.
  • It is free, no viruses and customizability etc.

Once I decided to use Linux as my desktop OS, I started looking for the better Desktop Linux distros for beginners like me and I found that following are better among the hundreds of Linux distros.

linux

I have installed all of them on my VirtualBox to see which one is best. After trying all of them I settled on Linux Mint.

Ubuntu is the most popular desktop Linux distro but I didn’t like its Unity Desktop Environment very much. But there are various other variation of Desktop Environments like GNOME, MATE which looks better, IMHO.

Fedora is Redhat’s play ground for Redhat Enterprise Linux (RHEL) and CentOS is a kind of open source version of RHEL built by community. Both Fedora and CentOS looks good but they are ass friendly as Ubuntu based distros for beginners.

ElementaryOS is the most beautiful OS among all the distros I have tried. It is a very light weight distro with fantastic look and minimal applications installed. If you are a casual user who uses your computer just for internet browsing, watching videos, play music, write some documentation then it is the best choice.

PinguyOS, which is a Ubuntu derivative, is a perfect distor for those who want everything to be pre-installed. It has most of the commonly used applications installed already. But it is too heavy and slow also.

I have tried OpenSUSE, Zorin, Deepin, Bodhi, Manjaro etc also and they are good.

And finally, my favorite is Linux Mint. Linux Mint is a Ubuntu derivative but with its own Desktop Environment called Cinnamon. Linux Mint also comes with other Desktop Environments like MATE, XFCE etc.
Linux Mint Cinnamon GUI looks almost like Windows 7 and the kind of customizations it provides is awesome. I liked Linux Mint very much among all the distros I tried and finally installed it on my laptop using it as my primary OS.

Don’t I need Windows OS anymore?

  • Even though there are plenty of Linux Desktop Environments with different GUI styles with good looks, I feel they are not even close to Windows 7 GUI.
  • Linux distros comes with lot of free applications and you can find thousands of free apps on the app stores, but there are few applications that runs only on Windows.
  • Microsoft Office: I know about LibreOffice and it is good, but honestly I feel it is not going to be a replacement for MS Office.
  • No official OneDrive client, no RSA Secure Token ID support, no Photoshop, gaming support is not as good as Windows and few more things like that.

I am not a Photoshop user, I am not a gaming person and I am not really heavy user of MS Office. So I can live with some limitations.

By using Linux OS I don’t have to worry too much about viruses (I know Linux also can get viruses but not as much as Windows), thousands of free apps and it is free :-).

The best part of using Linux OS is I am understanding little bit more about how operating systems work.

CentOS 7 Installation on Oracle Virtualbox

I wanted to explore CentOS 7 Linux, so I installed it on my Oracle VirtualBox. Installation went smoothly ,but I had a hard time to install Virtualbox Guest Additions to get full screen. I thought of sharing the steps I performed so that it may be helpful for others.

After installing CentOS 7, before installing Virtualbox Guest Additions first thing we need to do is update system.
sudo yum update

When I run this command I got the error “cannot find a valid baseurl for repo

After googling for sometime I figured that the network card is not enabled by default and I need to enable the baseUrl in some configuration file.

1) Edit /etc/sysconfig/network-scripts/ifcfg-eth0 file and change ONBOOT=no to ONBOOT=yes
Instead of eth0 you may have a different file name. To know the right one, run the command “ifconfig -a

2) Edited the file /etc/yum.repos.d/CentOS-Base.repo and uncomment baseurl.

[base]
name=CentOS-$releasever – Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Source: http://unix.stackexchange.com/questions/22924/how-can-i-fix-cannot-find-a-valid-baseurl-for-repo-errors-on-centos

3) Install VirtualBox Guest Additions

sudo yum update
sudo yum groupinstall “Development Tools”
sudo yum install kernel-devel

In Oracle Virtual Box menu, Devices -> Insert Guest Additions CD Image -> Run

Source: http://itekblog.com/centos-7-virtualbox-guest-additions-installation-centos-minimal/

My Linux Journey Begins

Like many people I started working with computers on Windows XP operating system. Even after starting my career as a Java developer I have been working on Windows for all my development activities.

Initially I didn’t get a chance(need) to work on Unix/Linux because we didn’t have access to any of production systems which are using Linux. After few years we got a new client for whom we need to do deployment also in QA/UAT environments which are all Linux based. Then one guy who was doing all these deployment activities shared few documents, shell scripts with all the instructions regarding how to deploy the apps, stop/start the containers etc.

My very first expressions is “Whaaaat?? you do all these deployment activities using these cryptic commands running in this black terminal??? No GUI??”. They smiled and said “No, in Linux you have to do all these using these commands only.” Ok, fine, no problem. I get familiar with few commands like copy, rm, ps, kill, chmod etc which are just enough to get the things done. I never bothered to learn Linux really.

But recently I got to work on Linux more and more, so I thought it is good to get some good hands on experience with Linux.

After little bit of googling I found Ubuntu and LinuxMint are good desktop linux distros for Linux newbies like me. But before settling with one Linux distro I tried the following Linux distros on Oracle Virtualbox.

  • Ubuntu
  • LinuxMint
  • Fedora
  • CentOS
  • OpenSUSE
  • Bodhi
  • ElementaryOS
  • PeachOSI
  • Pinguy
  • Zorin

I am sure there are plenty of other linux desktop distros to explore. But among the above mentioned distros I settled with LinuxMint.
You can find lot of blogs to show how to install Linux distro in Virtualbox and also how to install in dual boot mode.

Following links were very helpful for me:
http://itsfoss.com/guide-install-linux-mint-16-dual-boot-windows/
http://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/

Now, I would like to note down my learning about Linux here for quick reference. Expect some small Linux tips on this blog going forward 🙂