Install Oracle Java 9 on CentOS, RHEL 7

This quick tutorial is going to cover how to install Oracle Java 9 on CentOS, RHEL. The installation can be performed by using one of the following processes:

  •  From archive binaries (.tar.gz)

This allows us to install a private version of the JDK for the current user into any location, without affecting other JDK installations

  •    From RPM packages (.rpm)

This allows us to perform a systemwide installation of the JDK for all users and requires root access. RPM-based Linux platforms are based on Red Hat and SuSE.

In this tutorial, we are getting through both of processes to install Java 9 on CentOS, RHEL. And if you’re looking for guidelines how to install Oracle Java 9 on Ubuntu, please read the instruction at Install Oracle Java 9 on Ubuntu 16.04 LTS (Xenial Xerus).

1. Install Oracle Java 9 On CentOS From Archive Binaries(.tar.gz)

1.1. Download Java 9 Archive Binary

To download the Java 9 archive binary, we can go to Java 9 official website of Oracle, select the appropriate version and then download. Or you can download the archive binary by using wget command as follows:

1.2. Move and Unpack The Archive Binary

Change the directory to the location where you want to install the JDK, then move the .tar.gz archive binary to the current directory, for example, we will move the archive binary above to /opt

Next, let unpack the file:

 1.3. Set up Java Environment Variables

Because there are a lot of applications requires Java environment variables to work, we will set up them here by adding the following commands at the end of /etc/environment file:

Notice that the /etc/environment file will be automatically loaded when the system boots or we can issue the following command to reload the file right away:

1.4. Verify The Installation

To verify the installation, we can run the following command:

The output will be:

Install Oracle Java 9 on CentOS RHEL 7 - Verify Java 9 Version

Java 9 version

1.5. Configure Default Java with Alternatives (optional)

As you may know, the alternatives is a tool for managing different software packages that provide the same functionality and we can use it to ensure that only one Java Development Kit (JDK) is set as the system default at one time in case we have different versions of Java exist in our environment. Because we install Oracle Java 9 from archive binary, we will need to register Java with the alternatives manually:

And next, let’s register the javac, javadoc, and javap:

We have just registered our Java 9 with alternatives, now let’s use it to configure the default JDK by running the below command:

The confirmation is displayed as follows:

Install Java 9 on CentOS, RHEL - Use Alternatives to configure Java

Use Alternatives to configure Java

Because there is only one version of Java in our environment, we only see one record. If we have more versions of Java, they will be listed out and we can select the active version by input the number accordingly.

We can configure the same for other Java commands such as javac, javadoc, javap. And that were all steps to install Java 9 on CentOS, RHEL.

2. Install Oracle Java 9 On CentOS From RPM Package

You must log in as a root user to install Java 9 on CentOS, RHEL from a RPM package.

2.1. Download Java 9 RPM Package

We can download the Java 9 RPM package from its official website or simply use the wget command as follows:

 2.2. Install The Java 9 RPM Package

We can install the package using the following command:

2.3. Verify

We can verify whether the installation was successful or not by executing the following command:

The output is:

2.4. Configure Default Java

If our environment has many versions of Java, we will need to configure the default one and we can do it by using the alternatives tool, for example:

We may see the confirmed messages on the terminal as follows:

Install Oracle Java 9 on CentOS RHEL 7 - Alternatives Java

Alternatives set default Java

We can see that there are two versions of Java in our environment. And if we want to change the default one, we can input the number accordingly to the terminal.

 2.5. Set up Java Environment Variables

To set up Java environment variables, we can append the following commands to the end of the /etc/environment file:

To get effective right away rather than to wait until the /etc/environment gets reloaded when system boots, we can run the below command:

3. Conclusions

The tutorial has illustrated us two different ways to install Oracle Java 9 on CentOS, RHEL and we can see that using the RPM process seem to be more simple and is suitable for performing a systemwide installation of the JDK for all users as well.

Below are other Java 9 related tutorials for your references:

Set Up Eclipse, IntelliJ And NetBeans For Java 9

Create Immutable Lists In Java 9 By Static Factory Methods

Java 9 Example With Maven And JUnit 5

 

Install Cassandra on Ubuntu 16.04 LTS (Xenial Xerus)

1. Overview

Apache Cassandra is a free and open-source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. There are two possible approaches for us to install Cassandra on Ubuntu 16.04:

  • Install from Debian packages
  • Install from binary tarball files

In this tutorial, we’re going to learn how to install Cassandra on Ubuntu 16.04 both of approaches.

2. Prerequisites

3. Install Cassandra on Ubuntu 16.04 from Debian Package

3.1. Add the Apache Cassandra Repository

We’ll install Cassandra from Debian packages distributed by Apache repository of Cassandra, therefore we will need to add the repository to /etc/apt/sources.list.d/cassandra.sources.list. Let’s see the following command which will add the repository of Cassandra 3.9, the latest version of Cassandra currently.

3.2. Add the Apache Cassandra Repository Keys

If you’re behind a corporate proxy with an self-signed SSL certificate, you may want to skip validating the certificate by running the below command instead the one above:

3.3. Add The Public Key

3.4. Update The Repositories

3.5. Install  Cassandra

Issue the following command to install Cassandra and wait for a moment.

3.6. Operate Cassandara

3.6.1. Configure Cassandra to run at start up

3.6.2. Start Cassandra

3.6.3. Stop Cassandra

3.6.4.Verify that Cassandra is running

or

The output can be as following:

Install Cassandra on Ubuntu 16.04 - Verify Cassandra status

Verify Cassandra status

3.7. Cassandra’s configuration

By installing Cassandra on Ubuntu 16.04 this way, we can find:

  • Configuration files: /etc/cassandra
  • Logs: /var/log/cassandra/
  • Data: /var/lib/cassandra

4. Install Cassandra on Ubuntu 16.04 from Binary Tarball Files

4.1. Download Cassandra

We can download the latest stable release from the Apache Cassandra downloads website. For example, the following command will download the Cassandra 3.9 from the website.

4.2. Extract the compressed file

The above command will unpack the Cassandra distribution to /opt/apache-cassandra-3.9

Next, we will change permissions on of the directory in which Cassandra can be stored its data.

4.3. Add apache-cassandra-3.9/bin to the system path

Open the /etc/environment (you can use nano as below example):

And append the following content at the end of the file:

Save the file and quit nano.

We will need to activate the above environment variables. We can do that by log out and log in again or simply run below command:

4.4. Operating Cassandra

4.4.1. Start Cassandra in the foreground

Open the terminal and execute the following command to start Cassandra in the foreground:

Or simply:

We can press “Control-C” to stop Cassandra

4.4.2. Start Cassandra in the background

Or simply:

4.4.3. Stop Cassandra

To stop Cassandra, we have to find the Cassandra’s pid and kill the process:

where pid is the Cassandra process id, which you can find for example by invoking

or simply execute only one command as below:

4.4.4. Verify that Cassandra is running

We can verify whether Cassandra is running or not by invoking the below command:

4.5. Cassandra’s configuration

By installing Cassandra on Ubuntu 16.04 this way, all configuration files are located in the conf sub-directory. Log and data directories are located in the logs and data sub-directories respectively. So, we can find:

  • Configuration files: /opt/apache-cassandra-3.9/conf
  • Logs: /opt/apache-cassandra-3.9/logs
  • Data: /opt/apache-cassandra-3.9/data

5. Connect to the Cassandra Cluster

The API to Cassandra is CQL, the Cassandra Query Language. To use CQL, you will need to connect to the cluster, which can be done:

  • either using cqlsh,
  • or through a client driver for Cassandra.

In this section, we will try to connect to the Cassandra cluster using cqlsh which is a command line shell for interacting with Cassandra through CQL, shipped with every Cassandra package, and can be found in the bin/ directory alongside the Cassandra executable. It connects to the single node specified on the command line. For example:

See the cqlsh section for full documentation.

6. Conclusion

We have just gotten through how to install Cassandra on Ubuntu 16.04 from both Debian package and from Tarball files. Both of approaches are simple and you can choose any that is suitable for you. If you want to take control of everything, you can try with the Tarball files. However, if you prefer apt-get, you can try with the Debian  package.

Here are other related articles:

Using Group By in Apache Cassandra

Install Packer on Ubuntu 16.04 LTS (Xenial Xerus)

This short tutorial is going to cover how to install Packer on Ubuntu 16.04 so that you can get started with exploring many great features of Packer.

1. Download Packer

Visit the Packer download website to download a suitable version of Packer for your operating system. I’m using Ubuntu 16.04 64 bit, therefore, I’m going to download the 64 bit version of Packer.

The current version is 0.12.0

2. Extract and move Packer distribution to /usr/local/packer

To extract the Packer distribution:

To move the extracted folder to /usr/local:

3. Add Packer to the PATH

Open the /etc/environment and append the below line to the last of the file

Let’s activate the PATH variable by logout and login the shell or simply execute the command:

4. Verify the installation

We can verify the installation worked by opening a new console and checking that packer is available:

5. Conclusion

We have just finished to install Packer on Ubuntu 16.04. This is an initial start so that we can get start to explore more features of Packer in next posts.

Install Hadoop on Ubuntu 16.04 LTS (Standalone Mode)

1. Overview

This tutorial is going to illustrate how to install Hadoop on Ubuntu 16.04 so that you can perform simple operations using Hadoop MapReduce and the Hadoop Distributed File System (HDFS).

Hadoop cluster can be deployed in one of the three supported modes:

  • Local (Standalone) mode:  Hadoop is configured to run in a non-distributed mode, as a single Java process. This is useful for debugging.
  • Pseudo-Distributed Mode: Hadoop can be run on a single-node in the pseudo-distributed mode where each Hadoop daemon runs in a separated Java process.
  • Fully-Distributed Mode: Hadoop runs on a fully distributed cluster.

In this tutorial, we will get through the first mode, install Hadoop on Ubuntu 16.04 in Standalone mode. The remained modes will be covered in other separated posts.

2. Prerequisites

There are 2 requisite software that we will need to have on our Ubuntu:

  • Java must be installed. We’re going to use Java 7. You can find the the recommended Java versions are described at Hadoop Java Versions.
  • ssh must be installed and sshd must be running. If your machine doesn’t have it, you can install it by run the following commands:

3. Install Hadoop on Ubuntu 16.04 in Standalone Mode

3.1. Download a Hadoop distribution

Visit the Hadoop release website and download a stable binary version of Hadoop distribution. The version we’re going to use in this tutorial is Hadoop 2.7.3 which yo can download by clicking on the link: hadoop-2.7.3.tar.gz

Or you can issue the following command to download Hadoop 2.7.3

3.2. Extract and move the Hadoop distribution to the /usr/local folder

Let’s extract the distribution

Then move it to the /usr/local folder

3.3. Set the JAVA_HOME variable for Hadoop

Before you can run Hadoop, you need to tell it where Java is located on your system. By default, Hadoop is configured to use the JAVA_HOME variable of the system. So, if you have this variable defined and pointed to a suitable Java installation, that will be used and you don’t need to configure it anymore. Otherwise, you have to set the Java installation for Hadoop by editing the etc/hadoop/hadoop-env.sh file in the distribution.

Let’s open the /usr/local/hadoop/etc/hadoop/hadoop-env.sh file and change the value of the JAVA_HOME variable to your Java installation.

Here is an example which set JAVA_HOME to the /usr/lib/jvm/java-7-oracle folder.

Install Hadoop on Ubuntu 16.04 - Set JAVA_HOME variable for Hadoop

Set JAVA_HOME variable for Hadoop

3.3. Create Hadoop environment variable

We will create an environment variable that points to the Hadoop installation directory and to put the Hadoop binary directories on our command-line path so that we can run the Hadoop command everywhere.

Let’s create a hadoop.sh file at /etc/profile.d folder (you can use nano with below command):

Enter the follow content to the file and save it

Activate the above environment variables. We can do that by log out and log in again or simply run below command:

3.4. Verification

We can check that Hadoop runs by trying the following command:

The output will be similar to:

4. Conclusion

This tutorial has just showed you how to install Hadoop on Ubuntu 16.04 in Standalone Mode. As mentioned on the beginning of the tutorial, this mode is useful debugging and for those who just want to get started with Hadoop. If you want to explore fully Hadoop and its ecosystem, you can get to know about Hadoop distribution provided by Cloudera or Hortonworks.

 

 

 

 

 

 

Uninstall Vagrant on Ubuntu 16.04

This quick tutorial covers how to uninstall Vagrant on Ubuntu 16.04. This is useful for those who want to remove Vagrant from their machines or simply want to upgrade to the new version of Vagrant.

1. Overview

First of all, there are several ways to install Vagrant on Ubuntu such as: using apt-get or downloading and installing the Vagrant binary package from Vagrant site; therefore, we have to select the proper way to uninstall Vagrant. In this article, we will get through the uninstallation for both of above ways. You can find relevant information about install Vagrant on Ubuntu via this tutorial: Install Vagrant on Ubuntu 16.04 LTS (Xenial Xerus)

2. Uninstall Vagrant on Ubuntu 16.04

2.1. Using apt-get

This part is used for those who installed Vagrant by using apt-get command. So, we will use the apt-get command to uninstall Vagrant on Ubuntu.

2.1. To uninstall only Vagrant

2.2. To uninstall Vagrant and its dependencies

2.2. Using dpkg package manager

This way is used for those who installed Vagrant by downloading the Vagrant package from its site and install manually using dpkg, a package manager for Debian-based systems.

To uninstall Vagrant on Ubuntu, we simply need to execute the below command:

3. Remove user data

Removing the user data will remove all boxes, plugin and any stored state that may be used by Vagrant. Moreover, removing user data is safe because Vagrant can regenerate any data necessary to run if we reinstall it.

To remove the user data, we can remove the ~/.vagrant.d directory as below:

4. Summary

We have gotten through 2 options to uninstall Vagrant on Ubuntu 16.04. Before proceeding the installation, just need to make sure which way is a correct way. After that is to remove the user data. Finally, there are several related articles for your references:

Install Vagrant on Ubuntu 16.04 LTS (Xenial Xerus)

Basic Vagrant Commands

Running Vagrant SSH on Windows

How to Add a Vagrant Box from Local or Remote

 

Install Mosquitto MQTT Broker on Ubuntu 16.04 LTS (Xenial Xerus)

This article is going to cover shortly how to install Mosquitto MQTT broker On Ubuntu 16.04 using apt-get. As for other operating systems and other Linux distros as well, you can find the installation guides on the Mosquitto website.

Install Mosquitto MQTT Broker on Ubuntu 16.04 LTS - Mosquitto MQTT Broker  Logo

Mosquitto MQTT Broker

1. Add the Mosquitto-dev PPA to repositories list

To install Mosquitto MQTT Broker On Ubuntu 16.04, we will need to add the Mosquitto PPA repository first. And we can do that simply by running the below command:

If you’re behind a proxy, you can try to add -E parameter to the command

2. Update Package Repository

The next is to update your package repository

3. Install Mosquitto MQTT Broker on Ubuntu 16.04

To install the broker, we can execute the below command:

Next, we will install mosquitto-clients package which is a Mosquittoclient or Mosquitto CLI, allows us to communicate the Mosquitto broker for different purposes such as: debugging, testing, etc

4. Basic about Mosquitto MQTT Broker

4.1. Starting the Mosquitto broker

4.2. Stopping the broker

4.3. Checking status of the broker

4.4. Configuration

The configuration file of the Mosquitto broker is located at: /etc/mosquitto/mosquitto.conf

The default TCP port of the broker is 1883 which is used for the ‘mqtt’ scheme and the port 8883 is used by default for the ‘mqtts’ scheme.

If you want to access the broker from the outside, make sure those ports are not blocked by your firewall.

5. Testing The Mosquitto MQTT Broker

We have finished the installation, and in this section we will verify whether the Mosquitto works or not. We will publish messages and subscribe on the topic: hellomqtt/test.

5.1. Subscribe on the topic: hellomqtt/topic

Open a new terminal (we call it terminal #1) and execute the command:

After the above command, the terminal will block and listen for the messages on the topic “hellomqtt/topic”

5.2. Publish on the topic: hellomqtt/topic

Open a new terminal (we call it terminal #2) and publish several messages to the “hellomqtt/topic”

The output on the terminal #2 will be similar to:

Back to the terminal #1, we will see the “Hello world” message appeared.

6. Summary

We have learned how to install Mosquitto MQTT Broker on Ubuntu 16.04 and some basic operations and configurations as well. More advanced usages and configuration will come in future posts.

Below are other related posts:

Apache Kafka Connect MQTT Source Tutorial

Install Apache Ant on Ubuntu 16.04 LTS (Xenial Xerus)

This article is going to cover how to install Apache Ant on Ubuntu 16.04. There are several ways to do that:

  • Using apt-get
  • Using SDKMan
  • Manual installing

In this article, we will cover both of those ways.

Install Apache Ant on Ubuntu 16.04 LTS (Xenial Xerus)

Apache Ant

1. Prerequisite

The current version of Apache Ant is 1.9.x which requires Java 1.5 at minimum. Therefore, you should make sure you have suitable Java installed on your environment.

2. Install Apache Ant on Ubuntu 16.04 using apt-get

To install Apache Ant using apt-get, simply execute the following commands:

You can verify by issuing the command:

3. Install Apache Ant on Ubuntu 16.04 using SDKMan

SDKMAN is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. We can leverage SDKMAN to install Apache Ant on Ubuntu 16.04.

Make sure you install SDKMan first by following installation guide. After that, you can install Apache Ant on Ubuntu 16.04 by executing the following command:

When finishes, you can verify whether Ant is installed successfully or not by checking its version:

4. Install Apache Ant on Ubuntu 16.04 manually

4.1. Download Ant

You can download Ant distribution from the Apache Ant website. Currently, the latest release of Ant is version 1.9.7.

In the following command, I will download the binary only version of Ant:

4.2. Unpack Ant

The above command will unpack the Ant distribution to /usr/local/apache-ant-1.9.7

Next, we will create a symbolic link to the Ant distribution:

4.3. Create ANT_HOME Environment Variables

Create a ant.sh file at /etc/profile.d folder (you can use vi with below command)

Enter the follow content to the file:

Save the file.

We will need to activate the above environment variables. We can do that by log out and log in again or simply run below command:

4.4. Verification

We can verify whether Maven is installed successfully or not by type command:

The output is similar to:

5. Summary

We have learned about how to install Apache Ant on Ubuntu 16.04 by different ways. Installing Ant using apt-get is the simplest way but we may not install our desired version. Installing with SDKMan requires further step to install SDKMan first; however, it’s flexible to switch between different versions of Apache Ant. The last way, manual install will take more effort; but we can take over everything.

Below are other articles related to setup or install build tools on Ubuntu 16.04. You can refer to them if needed.

Install Gradle on Ubuntu 16.04 LTS (Xenial Xerus)

Install Maven on Ubuntu 16.04 LTS (Xenial Xerus)

 

Install Oracle Java 9 on Ubuntu 16.04 LTS (Xenial Xerus)

In this article, I’d like to share how to install Oracle Java 9 on Ubuntu 16.04. Java 9 will be released on 2017; however, it’s good for anyone who wants to try some new features of Java 9 with the new early access version.

If you’re looking for guides how to install Oracle Java 9 on other Linux distros, you can read Install Oracle Java 9 on CentOS, RHEL 7.

1. Install Java 9 on Ubuntu 16.04  with Apt-get

1.1. Add the WebUpd8 Oracle Java PPA

To install Oracle Java 9 on Ubuntu 16.04, we will need to add the WebUpd8 PPA repository first. We can do that simply by running the following command.

If you’re behind a proxy, you can try to add -E parameter to the command

1.2. Update Package Repository

Issue below command to update your package repository

1.3. Install Oracle Java 9 on Ubuntu 16.04

To install Java 9 on Ubuntu 16.04, we can run the following command:

During installation, we will need to confirm the license agreement as follows:

 Confirm License Aggreement

Confirm License Agreement

We need to hit the Enter to continue. After that we also need to accept the  license agreement by select <Yes> and hit Enter:

Confirm License Aggreement

Install Java 9 on Ubuntu 16.04 – Confirm License Agreement

1.4. Set Oracle Java 9 as Default

We can have multiple versions of Java installed on our PC, and we can configure which version is the default by using the command:

The command will list out all the available versions of Java is being installed in our environment and ask us for selecting the default one, and here is an example on my PC.

Install Oracle Java 9 on Ubuntu 16.04 - Configure Oracle Java 9 as default Java

Configure Oracle Java 9 as default Java

Currently, the default version is the Oracle Java 8. I change to Oracle Java 9 by entering 0.

1.5. Verification

We can verify the version of the default Java by executing:

1.6. Setup Java Environment Variables

To set up Java environment variables, we can append the following commands to the end of the /etc/environment file:

To get the variables effective right away rather than a reboot, we can run the below command:

And that is the final step for us to install Java 9 on Ubuntu 16.04 by using apt-get.

2. Install Oracle Java 9 on Ubuntu 16.04 Manually

This section will cover how to install Oracle Java 9 on Ubuntu 16.04 manually from archive binaries.

2.1. Download Java 9 Archive Package (tar.gz)

You can obtain a Java 9 archive package from its official website using web browser or using the wget command as follows:

2.2. Move and Extract The Java 9 Archive Package

We will need to move the archive package to appropriate location, for example: /opt

And then change to that directory and extract the package:

2.3. Set Java 9 As Default Java

Our environment may have different versions of Java and we may need to set Java 9 as default Java, to do that we firstly will need to register it with the update-alternatives tool because we have just install Java 9 manually, for example:

In addition, we should also register the javac, javadoc and javap with the tool also:

And next, let set the Java 9 as default Java by invoking the following commands:

The command will list all the Java exists in our environment and require us to confirm which version will be set default as below:

Install Oracle Java 9 on Ubuntu 16.04 - Alternatives Set Default Java

Set Java 9 as Default on Ubuntu 16.04

We can see that there are two version of Java in our environment: Java 8 and Java 9 and currently the Java 8 is set as default. To set Java 9 as default, we can input the number 1 into the terminal and hit the Enter to confirm. The output will be:

2.4. Verify

To verify whether we have installed Java 9 on Ubuntu and set it as default Java correctly or not, let issue the following command:

That is a command to check version and we should see the output similarly as below:

2.5. Set up Java Environment Variables

This step is required to run some Java applications. Now, let’s set up the JAVA_HOME environment variable by appending the following commands at the end of /etc/environment file:

Because the file will be loaded automatically when system boots, we can execute the following command to get our variable effective right away:

And that is the final step for us to install Java 9 on Ubuntu 16.04.

 

3. Summary

We have tried to install Oracle Java 9 on Ubuntu 16.04. Note that Java 9 has just been released and with the above PPA, we can install the latest release of the Oracle Java 9.

4. References

http://www.java9countdown.xyz/

Set Up Eclipse, IntelliJ And NetBeans For Java 9

Create Immutable Lists In Java 9 By Static Factory Methods

Install MySQL on Ubuntu 16.04 (Xenial Xerus)

Install Maven on Ubuntu 16.04 LTS (Xenial Xerus)

Install Gradle on Ubuntu 16.04 LTS (Xenial Xerus)

Install Apache Ant on Ubuntu 16.04 LTS (Xenial Xerus)

 

Install MySQL on Ubuntu 16.04 (Xenial Xerus)

In this article, we try to install MySQL on Ubuntu 16.04 (Xenial Xerus) with APT.

1. Adding the MySQL APT Repository

This will allow us to install latest packages of MySQL.

1.1. Download MySQL APT Repository

You can download it at the MySQL website: http://dev.mysql.com/downloads/repo/apt/

In this tutorial, we will download the version 0.8.0-1 which is the latest version of this installation time.

1.2. Install downloaded package

Run below command to install the package.

During the installation, you will be asked to choose the versions of the MySQL server and other components that you want to install.

Install MySQL on Ubuntu 16.04 - Select MySQL product to configure

Select MySQL product to configure

 

Hit Enter to continue.

Install MySQL on Ubuntu 16.04 - Select MySQL version

Select MySQL version

Hit Enter to continue.

The below popup will show us the selected status of MySQL version and its components (in light yellow color).

Install MySQL on Ubuntu 16.04 - Confirm selections

Confirm selections

Select OK and hit Enter to finish.

1.3. Update package information from the MySQL APT repository

2. Install MySQL on Ubuntu 16.04

We can install MySQL on Ubuntu 16.04 with the following command:

During the installation, we will need to supply a password for the root user.

Install MySQL on Ubuntu 16.04 - Supply password for the root user

Supply password for the root user

After input the password and confirm password, hit Enter to continue

3. Start and Stop MySQL server

3.1. Check status of MySQL Server

We can check status of MySQL server by issuing below command:

3.2. Start MySQL Server

3.3. Stop MySQL Server

4. Install Additional MySQL Components (Optional)

We can install several additional MySQL components such as MySQL Community Workbench, shared  client libraries:

5. Summary

We have just tried to install MySQL on Ubuntu 16.04 with APT. There are several other ways. If you’re interested in, you can refer to the following links:

https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/

 

Install Maven on Ubuntu 16.04 LTS (Xenial Xerus)

This article will show you how to install Maven on Ubuntu 16.04(Xenial Xerus). There are 3 approaches to install Maven on Ubuntu.

  • Install with apt-get
  • Install manually
  • Install with SDKMAN

We will try both approaches in this tutorial.

install maven on ubuntu 16-04

Maven

1. Install Maven on Ubuntu 16.04 with Apt-get

We will use apt-get to install Maven on Ubuntu 16.04. This is the simplest way.

1.1. Open terminal and run below command

1.2. Verification

We can verify whether Maven is installed successfully or not by type command:

The output will be similar to below:

Note that the output also show us the Maven’s home, which is: /usr/share/maven

2. Install Maven on Ubuntu 16.04 Manually

2.1. Download Maven

You can download Maven distribution from the Apache Maven website. Currently, the latest release of Maven is version 3.3.9.

In the following command, I will download the binary only version of Maven:

2.2. Unpack Maven

The above command will unpack the Maven distribution to /usr/local/apache-maven-3.3.9

Next, we will create a symbolic link to the Maven distribution:

2.3. Create MAVEN_HOME Environment Variables

Create a maven.sh file at /etc/profile.d folder (you can use vi with below command)

Enter the follow content to the file:

Save the file.

We will need to activate the above environment variables. We can do that by log out and log in again or simply run below command:

2.4. Verification

We can verify whether Maven is installed successfully or not by type command:

3. Install Maven on Ubuntu 16.04 With SDKMAN

SDKMAN is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. We can leverage SDKMAN to install Maven on Ubuntu 16.04.

3.1. Install SDKMAN

3.1.1. Open terminal and enter

Then follow the instructions on-screen to complete installation.

Note that, SDKMAN may ask you to install unzip package as the following:

In that case, you simply need to install unzip by issuing command:

3.1.2. Enter the following code snippet on the terminal

3.1.3. Lastly, verify that installation succeeded

The output will be similar to:

3.2. Install Maven By SDKMAN

3.2.1. List versions of Maven currently supported by SDMMAN

Here is the sample output on my PC:

3.2.2. Install Maven 3.3.9 on mine

3.2.3.Verification

We can verify whether Maven is installed successfully or not by type command:

Sample output on my terminal:

Note that Maven’s home directory is:  /home/ubuntu/.sdkman/candidates/maven/current

4. Summary

We have just tried to install Maven on Ubuntu 16.04  LTS (Xenial Xerus). There are 3 installation approaches for you to select. Both of them are simple. However, the first and third ones seems to be more simple and be easier to switch between different version of Maven. If you’re looking for Gradle installation tutorial, you can refer to my recent post: Install Gradle on Ubuntu 16.04 LTS (Xenial Xerus)