For installing Maven on Ubuntu you have two ways the easy way and the manual method. The easy way is just execute following command :
sudo apt-get install maven
Or if you use Ubuntu 16+ you can use following command too :
sudo apt install maven
Just remember you need to have root privileges.
The manual way
If you want to have the latest version of Maven on your Ubuntu go to the Maven website and download the latest binary package then you can extract it in /opt/ using command :
tar xvf apache-maven-3.5.2-bin.tar.gz -C /opt/
make sure you have set your JAVA_HOME if you don’t know how you can read this post
then open up your /etc/environment add following to your path
quit from your editor then type
to test if maven is installed type
There are sometimes that you want to trace an IP/Host based on a particular port to check if the port is open or not here is how you can do that :
traceroute -T -p 25 yoursite.com
- -T indicates to use TCP instead of UDP
- -p checks specific port
Installing Java JDK is easy and straightforward in Windows and OSX but not in Ubuntu. Here is how I am installing JDK on Ubuntu.
Download the latest JDK package from Oracle website. If you don’t know which file to choose you ought to select .tar.gz files whether 32bit or 64bit depends on your requirements.
after download the right package you need to extract it using following command you can extract it :
tar xvf jdk-8u161-linux-x64.tar.gz -C /opt/
Note : In this example I am using JDK version 8 revision 161
The /opt directory is where I chose to extract my JDK.
After extracting my JDK it is time to let Ubuntu know where to look after the Java Development Kit and Java Run Time.
Suppose you want to install your java and javac and javaws executable files in /usr/bin directory :
sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_161/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_161/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /opt/jdk1.8.0_161/bin/javaws 1
After executing update-alternatives its time to set JAVA_HOME. Open /etc/environment file and add following lines to it :
now in command line if you type
you will see the result.
The $? is called exit code of an application used to run. As an example type following commands in console:
then press CTRL-Z and then type:
You will see 147 as the answer. Return values more than 128 usually means signal and you have to do the calculation by subtracting 128 from the returned result. In this case you will get 19 which means
You can read about linux signals using :
man 7 signal