How To Install FreeIPA on CentOS 7

FreeIPA on CentOS 7

FreeIPA is an open source identity management system for Linux/Unix environments which provides centralized account management and authentication, like Microsoft Active Directory or LDAP.

Table of Contents

Step 1. First let’s start by ensuring your system is up-to-date.

Step 2. Installing FreeIPA.

Step 3. Configuring FreeIPA.

Step 4. Configure firewall for FreeIPA.

Step 5. Accessing FreeIPA.

Prerequisites

FreeIPA has many components, including Kerberos, NTP, DNS, and Dogtag (a certificate system) in order to provide security on your CentOS 7 server. The full FreeIPA package essentially provides Linux systems with the abilities for centralized authentication, authorization and account information by storing data about users, groups, hosts and all the other objects that are needed to manage security for networks.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step install FreeIPA open source identity management system on CentOS 7 server.
Install FreeIPA on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Installing FreeIPA.

The first thing that we are going to do is to prepare the CentOS 7 server to run FreeIPA. In order to do this, we are going to set the IP address on the system, In our case the host IP is 192.168.1.2/24:

hostnamectl set-hostname ipa.wpcademy.com
echo "192.168.1.2 ipa.wpcademy.local ipa" >> /etc/hosts

Next, Install the package dependencies required for our setup with the following commands if they are not already installed:

yum install bind-dyndb-ldap ipa-server-dns sssd-client sssd-common sssd-common-pac sssd-ldap sssd-proxy python-sssdconfig authconfig authconfig-gtk

Then, install FreeIPA using following command:

yum install ipa-server -y

Step 3. Configuring FreeIPA.

The setup process for FreeIPA can take a long time to complete depending on the server specifications. Begin the setup process with the following command:

ipa-server-install --setup-dns

Here is how this configuration will look by running the previous command:

[[email protected] ~]# ipa-server-install --setup-dns

The log file for this installation can be found in /var/log/ipaserver-install.log
==============================================================================
This program will set up the IPA Server.

This includes:
* Configure a stand-alone CA (dogtag) for certificate management
* Configure the Network Time Daemon (ntpd)
* Create and configure an instance of Directory Server
* Create and configure a Kerberos Key Distribution Center (KDC)
* Configure Apache (httpd)
* Configure DNS (bind)

To accept the default shown in brackets, press the Enter key.

Enter the fully qualified domain name of the computer
on which you're setting up server software. Using the form
.
Example: master.example.com.


Server host name [ipa.wpcademy.local]: [ENTER]

Warning: skipping DNS resolution of host ipa.idroot.local
The domain name has been determined based on the host name.

Please confirm the domain name [wpcademy.local]:[ENTER]
The kerberos protocol requires a Realm name to be defined.
This is typically the domain name converted to uppercase.

Please provide a realm name [IDROOT.LOCAL]: [ENTER]
Certain directory server operations require an administrative user.
This user is referred to as the Directory Manager and has full access
to the Directory for system management tasks and will be added to the
instance of directory server created for IPA.
The password must be at least 8 characters long.

Directory Manager password: [ENTER PASSWORD]
Password (confirm): [ENTER PASSWORD]

 . . . . .

After the FreeIPA installation, authenticate to the Kerberos realm to ensure that the administrator is configured correctly:

kinit admin

Next, this we are going to use authconfig to guarantee that the user directories are created and enable sssd:

authconfig --enablemkhomedir --update
chkconfig sssd on

Step 4. Configure firewall for FreeIPA.

These commands are used to allow FreeIPA services in the case the the security daemon Firewalld is running on your system:

firewall-cmd --permanent --add-service={ntp,http,https,ldap,ldaps,kerberos,kpasswd,dns}
firewall-cmd --reload

Step 5. Accessing FreeIPA.

FreeIPA will be available on HTTP port 80 by default. Open your favorite browser and navigate to https://ipa.wpcademy.local/ and complete the required the steps to finish the installation.

Congratulation’s! You have successfully installed FreeIPA on CentOS 7. Thanks for using this tutorial for installing FreeIPA open source identity management on CentOS 7 systems. For additional help or useful information, we recommend you to check the official FreeIPA web site.

How To Install Apache Zeppelin on CentOS 7

Apache Zeppelin on CentOS 7

Apache Zeppelin is an online open source laptop and collaborative application for interactive data ingestion, discovery, analytics, and visualization. Zeppelin supports 20+ languages, including Apache Spark, SQL, R, Elasticsearch and many more. Apache Zeppelin allows you to make beautiful data-driven documents and see the results of your analytics.

Table of Contents

Step 1. First let’s start by ensuring your system is up-to-date.

Step 2. Installing Java.

Step 3. Installing Zeppelin.

Step 4. Configure Systemd service for Apache Zeppelin.

Step 5. Configure Reverse Proxy Nginx.

Step 6. Accessing Apache Zeppelin.

 

Prerequisites

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step install Apache Zeppelin on CentOS 7 server.
Install Apache Zeppelin on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Installing Java.

At the time of writing this tutorial, the latest Java JDK version was JDK 8u45. First, let us download the latest Java SE Development Kit 8 release from its official download page or use following commands to download from shell:

cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz"
tar xzf jdk-8u45-linux-x64.tar.gz

After extracting archive file use alternatives command to install it. alternatives command is available in chkconfig package:

cd /opt/jdk1.8.0_45/
alternatives --install /usr/bin/java java /opt/jdk1.8.0_45/bin/java 2
alternatives --config java
There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /opt/jdk1.7.0_71/bin/java
 + 2           /opt/jdk1.8.0_25/bin/java
   3           /opt/jdk1.8.0_45/bin/java

Enter to keep the current selection[+], or type selection number: 3

At this point JAVA 8 (JDK 8u45) has been successfully installed on your system. We also recommend to setup javac and jar commands path using alternatives:

alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_45/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_45/bin/javac 2
alternatives --set jar /opt/jdk1.8.0_45/bin/jar
alternatives --set javac /opt/jdk1.8.0_45/bin/javac

Checking Installed java version:

[email protected] ~# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

We can easily set the environment variables using the export command as shown below:

Setup JAVA_HOME Variable:

export JAVA_HOME=/opt/jdk1.8.0_45

Setup JRE_HOME Variable:

export JRE_HOME=/opt/jdk1.8.0_45/jre

Setup PATH Variable:

export PATH=$PATH:/opt/jdk1.8.0_45/bin:/opt/jdk1.8.0_45/jre/bin.

Step 3. Installing Zeppelin.

First, download the Zeppelin binary on your system. You can always find the latest version of the application on Zeppelin download page:

wget http://www-us.apache.org/dist/zeppelin/zeppelin-0.7.3/zeppelin-0.7.3-bin-all.tgz
tar xf zeppelin-*-bin-all.tgz -C /opt

Rename the directory for sake of convenience:

mv /opt/zeppelin-*-bin-all /opt/zeppelin

Step 4. Configure Systemd service for Apache Zeppelin.

We will set up a Systemd unit file for the Zeppelin application:

adduser -d /opt/zeppelin -s /sbin/nologin zeppelin

Provide ownership of the files to the newly created Zeppelin user:

chown -R zeppelin:zeppelin /opt/zeppelin

Next, Create a new Systemd service unit file:

### nano /etc/systemd/system/zeppelin.service
[Unit]
Description=Zeppelin service
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/opt/zeppelin/bin/zeppelin-daemon.sh start
ExecStop=/opt/zeppelin/bin/zeppelin-daemon.sh stop
ExecReload=/opt/zeppelin/bin/zeppelin-daemon.sh reload
User=zeppelin
Group=zeppelin
Restart=always

[Install]
WantedBy=multi-user.target

Then, Start the application:

systemctl start zeppelin
systemctl enable zeppelin

Step 5. Configure Reverse Proxy Nginx.

By default, the Zeppelin server listens to localhost on port 8080. In this tutorial, we will use Nginx as a reverse proxy so that the application can be accessed via standard HTTP and HTTPS ports:

yum install certbot
yum install nginx

Start Nginx and enable it to automatically start at boot time:

sudo systemctl start nginx
sudo systemctl enable nginx

Next, Generate the SSL certificates:

certbot certonly --webroot -w /usr/share/nginx/html -d zeppelin.wpcademy.com

The generated certificates are likely to be stored in /etc/letsencrypt/live/zeppelin.wpcademy.com/. The SSL certificate will be stored as fullchain.pem and private key will be stored as privkey.pem.

Set up auto-renewal of the certificates Let’s Encrypt using cron jobs:

sudo crontab -e
30 5 * * * /usr/bin/certbot renew --quiet

Next steps, create a new server block file for the Zeppelin site:

nano /etc/nginx/conf.d/zeppelin.wpcademy.com.conf
upstream zeppelin {
server 127.0.0.1:8080;
}
server {
 listen 80;
 server_name zeppelin.wpcademy.com;
 return 301 https://$host$request_uri;
}

server {
 listen 443;
 server_name zeppelin.wpcademy.com;

ssl_certificate /etc/letsencrypt/live/zeppelin.wpcademy.com/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/zeppelin.wpcademy.com/privkey.pem;

ssl on;
 ssl_session_cache builtin:1000 shared:SSL:10m;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
 ssl_prefer_server_ciphers on;

access_log /var/log/nginx/zeppelin.access.log;

location / {
 proxy_pass http://zeppelin;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header Host $http_host;
 proxy_set_header X-NginX-Proxy true;
 proxy_redirect off;
 }
location /ws {
 proxy_pass http://zeppelin/ws;
 proxy_http_version 1.1;
 proxy_set_header Upgrade websocket;
 proxy_set_header Connection upgrade;
 proxy_read_timeout 86400;
 }
 }

Restart Nginx so that the changes can take effect:

systemctl restart nginx

Step 6. Accessing Apache Zeppelin.

Apache Zeppelin will be available on HTTP port 80 by default. Open your favorite browser and navigate to https://zeppelin.wpcademy.com and complete the required the steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.

Congratulation’s! You have successfully installed Apache Zeppelin on CentOS 7. Thanks for using this tutorial for installing Apache Zeppelin on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Apache Zeppelin web site.

How To Install Apache ZooKeeper on CentOS 7

Apache ZooKeeper on CentOS 7

Zookeeper is brief is a distributed state manager that may be employed by many clusters to keep state across its clusters. Like HBase can utilize Zookeeper to keep state across its own set of clusters without having to have cluster country within it.

Table of Contents

Step 1. First let’s start by ensuring your system is up-to-date.

Step 2. Installing Java.

Step 3. Install Apache ZooKeeper.

 

 

Prerequisites

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step install Apache ZooKeeper on CentOS 7 server.
Install Apache ZooKeeper

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Installing Java.

At the time of writing this tutorial, the latest Java JDK version was JDK 8u45. First, let us download the latest Java SE Development Kit 8 release from its official download page or use following commands to download from shell:

cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz"
tar xzf jdk-8u45-linux-x64.tar.gz

After extracting archive file use alternatives command to install it. alternatives command is available in chkconfig package:

cd /opt/jdk1.8.0_45/
alternatives --install /usr/bin/java java /opt/jdk1.8.0_45/bin/java 2
alternatives --config java
There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /opt/jdk1.7.0_71/bin/java
 + 2           /opt/jdk1.8.0_25/bin/java
   3           /opt/jdk1.8.0_45/bin/java

Enter to keep the current selection[+], or type selection number: 3

At this point JAVA 8 (JDK 8u45) has been successfully installed on your system. We also recommend to setup javac and jar commands path using alternatives:

alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_45/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_45/bin/javac 2
alternatives --set jar /opt/jdk1.8.0_45/bin/jar
alternatives --set javac /opt/jdk1.8.0_45/bin/javac

Checking Installed java version:

[email protected] ~# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

We can easily set the environment variables using the export command as shown below:

Setup JAVA_HOME Variable:

export JAVA_HOME=/opt/jdk1.8.0_45

Setup JRE_HOME Variable:

export JRE_HOME=/opt/jdk1.8.0_45/jre

Setup PATH Variable:

export PATH=$PATH:/opt/jdk1.8.0_45/bin:/opt/jdk1.8.0_45/jre/bin

Step 3. Install Apache ZooKeeper.

First, install ZooKeeper framework on your machine, visit the following link and download the latest version of ZooKeeper:

cd opt/
tar -zxf zookeeper-3.4.11.tar.gz
cd zookeeper-3.4.6
mkdir data

Next, Open the configuration file named conf/zoo.cfg and all the following parameters to set as starting point:

### nano conf/zoo.cfg

tickTime = 2000
dataDir = /path/to/zookeeper/data
clientPort = 2181
initLimit = 5
syncLimit = 2

Then, start ZooKeeper server:

bin/zkServer.sh start

After executing this command, you will get a response as follows:

JMX enabled by default
Using config: /Users/../zookeeper-3.4.11/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

Next step, Start CLI type the following command:

bin/zkCli.sh

After typing the above command, you will be connected to the ZooKeeper server and you should get the following response:

Connecting to localhost:2181
................
................
................
Welcome to ZooKeeper!
................
................
WATCHER::
WatchedEvent state:SyncConnected type: None path:null
[zk: localhost:2181(CONNECTED) 0]

After connecting the server and performing all the operations, you can stop the zookeeper server by using the following command:

bin/zkServer.sh stop

Congratulation’s! You have successfully installed Apache ZooKeeper on CentOS 7. Thanks for using this tutorial for installing Apache ZooKeeper on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Apache ZooKeeper web site.

How To Install Vue.JS on CentOS 7

Vue

Vue.JS is a JavaScript progressive front-end framework for building User Interfaces (UI). Vue is a monolithic framework and designed to be incrementally adoptable. The core library is concentrated on the view layer only and is easy to pick up and incorporate with other libraries or present projects, Additionally Vue.JS is perfectly capable of developing complicated Single-Page Software (SPA).

Table of Contents

Step 1. First let’s start by ensuring your system is up-to-date.

Step 2. Installing Node.Js and NPM.

Step 3. Installing Vue.JS.

Prerequisites

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step install Vue.JS on CentOS 7 server.
Install Vue.JS on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Installing Node.Js and NPM.

First of all, we need to install Node.JS and NPM:

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

Next, install Node.js and NPM with the following command:

yum install nodejs

You can check and verify your Node.js and NPM that you have installed using the following commands:

node -v
npm -v

Step 3. Installing Vue.JS.

NPM is the recommended installation method when building large scale applications with Vue. It pairs nicely with module bundlers such as Webpack or Browserify. Vue also provides accompanying tools for authoring Single File Components:

npm install -g vue-cli

Now you can switch to a directory where you want to store your project, and then install Vue.js files with the command below:

vue init webpack first-project

Then, switch to your project directory to install dependencies:

cd first-project
npm install

Now you have installed Vue.JS completely and you can start developing and testing it right away, executing the following command will start serving your project:

npm run dev

Finally, you can see that your project is now running on:

http://localhost:8081

Congratulation’s! You have successfully installed Vue.JS on CentOS 7. Thanks for using this tutorial for installing Vue.JS on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Vue.JS web site.

How To Install Ionic Framework on CentOS 7

Ionic Framework on CentOS 7

Ionic Framework is helpful for building Android and iOS programs faster. You must install those applications to create a hybrid mobile application.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step install Ionic Framework on CentOS 7 server.
Install Ionic Framework on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Installing Node.js.

Use the below command to install Node.js:

curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -
sudo yum install nodejs 5.

Step 3. Installing Cordova.

Run the following command to install Cordova on your system using npm command:

sudo npm install -g cordova

Step 4. Installing Ionic Framework on CentOS 7.

After installing Cordova, use the below command to install Ionic Framework:

sudo npm install -g ionic

To verify the ionic installation:

ionic -v

Step 5. Create Ionic Application.

First, create a new Cordova project on your computer using the following command:

ionic start Helloidr00t blank

Now use one of the following commands to enable iOS or Android platform:

ionic platform add ios
ionic platform add android

Congratulation’s! You have successfully installed Install Ionic Framework. Thanks for using this tutorial for installing Install Ionic Framework on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Install Ionic Framework web site.

How To Install Matomo on CentOS 7

Matomo on CentOS 7

Matomo or formerly known as Piwik, is an open source web analytics application. It rivals Google Analytics and includes even more features and allows you to brand your brand and send out custom daily, weekly, and monthly reports to your clients.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root accge of Linount, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Matomo on a CentOS 7 server.
Install Matomo on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Install LAMP server.

A CentOS 7 LAMP stack server is required. If you do not have LAMP installed, you can follow our guide here. Also install required PHP modules:

yum -y install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy curl curl-devel

Step 3. Installing Matomo on CentOS 7.

First thing to do is to go to Matomo’s download page and download the latest stable version of Piwik:

cd /var/www/html/
wget https://builds.matomo.org/piwik.zip

Unpack the Matomo archive to the document root directory on your server:

unzip matomo.zip -d /var/www/html/
mv /var/www/html/piwik/ /var/www/html/matomo/

We will need to change some folders permissions:

chown -R apache:apache /var/www/html/matomo

Step 4. Configuring MariaDB for Matomo.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next we will need to log in to the MariaDB console and create a database for the Matomo. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Matomo installation:

MariaDB [(none)]> CREATE DATABASE matomo;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost' IDENTIFIED BY 'PASSWORD';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Step 5. Configuring Apache web server for Matomo.

We will create Apache virtual host for your Matomo website. First create ‘/etc/httpd/conf.d/vhosts.conf’ file with using a text editor of your choice:

nano /etc/httpd/conf.d/vhosts.conf
IncludeOptional vhosts.d/*.conf

Next, create the virtual host:

mkdir /etc/httpd/vhosts.d/
nano /etc/httpd/vhosts.d/yourdomain.com.conf

Add the following lines:

ServerAdmin [email protected]
DocumentRoot /var/www/html/matomo
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ErrorLog "/var/log/httpd/yourdomain.com-error_log"
CustomLog "/var/log/httpd/yourdomain.com-access_log" combined

<Directory "/var/www/html/matomo/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted


Save and close the file. Restart the Apache service for the changes to take effects:

systemctl restart httpd.service

Step 6. Accessing Matomo web analytics application.

Matomo will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com/piwik or http://server-ip/piwik and complete the required the steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.
install-matomo
Congratulation’s! You have successfully installed Matomo. Thanks for using this tutorial for installing Install Matomo open source web analytics application on CentOS 7 system. For additional help or useful information, we recommend you to check the official Matomo on web site.

How To Install Oracle JDK 9 on CentOS 7

Install Oracle JDK 9 on CentOS 7

There are many programs and scripts that require java to run it, but usually Java is not installed by default on VPS or Dedicated Server. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. In this tutorial we will learn how to Install Oracle JDK 9 on CentOS 7.

Install Oracle JDK 9 on CentOS 7

Step 1. First, remove the Java 1.6 or 1.7 have been installed already, you can uninstall them using the following commands.

yum remove java-1.6.0-openjdk
yum remove java-1.7.0-openjdk

Step 2. Downloading and Installing Oracle JDK 9 on CentOS 7.

First, go to Java 9 official website of Oracle, select the appropriate version and then download:

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jdk/9.0.4+11/c2514751926b4512b076cc82f959763f/jdk-9.0.4_linux-x64_bin.tar.gz

Next, change the directory to the location where you want to install the JDK, then move the .tar.gz archive binary to the current directory:

tar zxf jdk-9.0.4_linux-x64_bin.tar.gz -C /usr/local

Step 3. Install JAVA using alternatives.

After extracting archive file use alternatives command to install it. alternatives command is available in chkconfig package:

cd /usr/local/jdk-9.0.4/
alternatives --install /usr/bin/java java /usr/local/jdk-9.0.4/bin/java 2
alternatives --config java



There is 1 program that provides 'java'.

Selection Command
-----------------------------------------------
*+ 1 /usr/local/jdk-9.0.4/bin/java

Enter to keep the current selection[+], or type selection number: 1

At this point JAVA 9 has been successfully installed on your system. We also recommend to setup javac and jar commands path using alternatives:

alternatives --install /usr/bin/jar jar /usr/local/jdk-9.0.4/bin/jar 2
alternatives --install /usr/bin/javac javac /usr/local/jdk-9.0.4/bin/javac 2
alternatives --set jar /usr/local/jdk-9.0.4/bin/jar
alternatives --set javac /usr/local/jdk-9.0.4/bin/javac

Step 4. Checking Installed java version.

[email protected] ~# java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

Step 5. Setup global environment variables.

We can easily set the environment variables using the export command as shown below:

Setup JAVA_HOME Variable:

export JAVA_HOME=/usr/local/jdk-9.0.4

Setup JRE_HOME Variable:

export PATH=$PATH:/usr/local/jdk-9.0.4/bin

Congratulation’s! You have successfully installed Oracle JDK 9. Thanks for using this tutorial for installing Oracle JDK 9 on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Oracle web site.