java Archives - The Linux GURUS https://thelinuxgurus.com/tag/java/ Learn Linux & DevOPS from THE LINUX GURUS Tue, 18 Feb 2020 04:50:24 +0000 en-US hourly 1 https://i0.wp.com/thelinuxgurus.com/wp-content/uploads/2020/01/cropped-thelinuxgurus_transparent_name.png?fit=32%2C32&ssl=1 java Archives - The Linux GURUS https://thelinuxgurus.com/tag/java/ 32 32 148921671 Install Python on Ubuntu : A Simple guide https://thelinuxgurus.com/install-python-on-ubuntu-a-simple-guide/ https://thelinuxgurus.com/install-python-on-ubuntu-a-simple-guide/#respond Fri, 24 Jan 2020 07:21:29 +0000 https://thelinuxgurus.com/?p=1047 Python is one of the most widely used programming and scripting languages. With the use of the Internet of Things (IoT) & Artificial Intelligence (AI)...

The post Install Python on Ubuntu : A Simple guide appeared first on The Linux GURUS.

]]>
Python is one of the most widely used programming and scripting languages. With the use of the Internet of Things (IoT) & Artificial Intelligence (AI) on the rise, python has become one of the most widely sought computing languages. Python is a high-level programming language used for general-purpose programming.

Python emphasizes on code readability & is very easy to pick up & learn. Moreover, there is a very active community for python & you can start from thousands of projects available for free depending on your use-case.

Recommended Read: Ultimate guide to install PYTHON from source

Also Read: Simple guide to install TOMCAT 9 on CentOS/Ubuntu

Python support for versions 2 aka python 2 has been discontinued from 1st jan, 2020 & now only python version 3.5+ will be supported. In this tutorial, we will learn to install Python on Ubuntu systems.

Install Python on Ubuntu

On the latest versions of Ubuntu (17.10 onwards), a version of Python 3.6 comes pre-installed, but if that’s not the case with you (hardly possible). Then you can install python on ubuntu with the following command,

$ sudo apt-get update

$ sudo apt-get install python3.6

On Ubuntu 16.10 & 17.04, python 3.6 does not come pre-installed & above mentioned commands can be used to install python on Ubuntu.

For Ubuntu 14.04 & 16.04 (it’s hardly unlikely that you are still using these), we need to install a PPA first as python 3.6 is not available with default repositories. So to install python on Ubuntu 14.04 or 16.04, use the following commands,

$ sudo add-apt-repository ppa:deadsnakes/ppa

$ sudo apt-get update

$ sudo apt-get install python3.6

That’s it. Python is now ready & installed on the system. All these commands can also be used for Linux Mint as well as it is based on Ubuntu & also uses the same PPA as Ubuntu. Please do let us know if you have any queries, questions or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Install Python on Ubuntu : A Simple guide appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/install-python-on-ubuntu-a-simple-guide/feed/ 0 1047
Simple guide to install TOMCAT 9 on CentOS/RHEL https://thelinuxgurus.com/simple-guide-to-install-tomcat-9-on-centos-ubuntu/ https://thelinuxgurus.com/simple-guide-to-install-tomcat-9-on-centos-ubuntu/#respond Fri, 24 Jan 2020 07:17:28 +0000 https://thelinuxgurus.com/?p=1044 Apache Tomcat is one of the oldest & most widely used open-source web server that is used to serve java-based web-pages, it executes Java servlets...

The post Simple guide to install TOMCAT 9 on CentOS/RHEL appeared first on The Linux GURUS.

]]>
Apache Tomcat is one of the oldest & most widely used open-source web server that is used to serve java-based web-pages, it executes Java servlets and renders Web pages that include Java Server Page coding. It has been used by a number of organizations for serving java web pages. It generally runs JSP, Servlet, etc.

Recommended Read: Beginner’s guide to install TOMCAT on UBUNTU

Also Read: How to Install Python on CentOS/RHEL

In this tutorial, we will learn to install Tomcat 9 on Centos/Redhat. Let’s start with the pre-requisites for tomcat installation.

Pre-Requisites

We need to have JAVA installed on the system before we can install tomcat on our systems. To install java 8, use the following command,

# yum install java-1.8.0-openjdk-devel

You can refer to this tutorial for detailed instructions on installing java.

Install Tomcat

To install tomcat 9, we will first create a separate user for using the apache tomcat,

# useradd tomcat-user

If required, create a password for the user as well,

# passwd tomcat-user

Next, we will create a directory which will act as a home directory for tomcat installation,

# mkdir /data/tomcat

# chown tomcat-user:tomat-user /data/tomcat

Now switch to tomcat-user & we will then download the tomcat,

# su – tomcat-user

$ wget http://apachemirror.wuchna.com/tomcat/tomcat-9/v9.0.30/bin/apache-tomcat-9.0.30.tar.gz

Now extract the package to tomcat directory,

$ tar -xvzf apache-tomcat-9.0.30.tar.gz -C /data/tomcat

Our tomcat installation is ready & we can now start tomcat by running the startup script,

$ sh /data/tomcat/bin/startup.sh

But we will create a service script to start & stop tomcat. Revert back to root user to create the service file,

# vi /etc/systemd/system/tomcat.service

[Unit]

Description=Apache Tomcat Web Application Container

After=syslog.target network.target

[Service]

Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/jre

Environment=CATALINA_PID=/data/tomcat/temp/tomcat.pid

Environment=CATALINA_HOME=/data/tomcat

Environment=CATALINA_BASE=/data/tomcat

Environment=’CATALINA_dataS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC’

Environment=’JAVA_dataS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom’

ExecStart=/data/tomcat/bin/startup.sh

ExecStop=/bin/kill -15 $MAINPID

User=tomcat

Group=tomcat

[Install]

WantedBy=multi-user.target

Now save the file & exit. Load the newly created service into systemd with this command,

# systemctl daemon-reload

We can now start & stop service using the systemctl,

# systemctl start tomcat

You can now check the tomcat installation by opening the following URL on web browser,

http://127.0.0.1:8080

The next step would be to configure users for the management interface of tomat.

Configuring Tomcat

Apache tomcat is now ready to be started but before we do that we need to assign credentials to access ‘Manager’ & ‘GUI’ page of tomcat, as by default no user name and pasword is setup. To asisgn the credentials, we will use the ‘/opt/tomcat/conf/tomcat-users.xml ‘ file,

$ vim /opt/tomcat/conf/tomcat-users.xml

& make the following entries to the file,

<role rolename=”manager-gui” />

<user username=”manager” password=”Password@123″ roles=”manager-gui” />

<role rolename=”admin-gui” />

<user username=”admin” password=”Password@123″ roles=”admin-gui” />

Make sure that you make these entries before the tag ‘tomcat-users’, i.e. make above entries before the below mentioned lines,

<tomcat-users xmlns=”http://tomcat.apache.org/xml”

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

xsi:schemaLocation=”http://tomcat.apache.org/xml tomcat-users.xsd”

version=”1.0″>

Once done, save the file & exit.

We need to make another change, though this is completely optional & completely depends on how you will access the manager page.We can only access the manager page from the browser on localhost but it we to access it on some other remote machines, we need to modify the ‘context.html’ for manager to comment the lines which disables the remote login,

$ vi /opt/tomcat/webapps/manager/META-INF/context.xml

<Context antiResourceLocking=”false” privileged=”true” >

<!– <Valve className=”org.apache.catalina.valves.RemoteAddrValve”

allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> –>

</Context>

Same is to be for host-manager’s context file as well,

$ vi /opt/tomcat/webapps/host-manager/META-INF/context.xml

<Context antiResourceLocking=”false” privileged=”true” >

<!– <Valve className=”org.apache.catalina.valves.RemoteAddrValve”

allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> –>

</Context>

Now save the file & exit. We can now enter the management interface for tomcat but first we need to restart the apache tomcat,

# systemctl stop tomcat

# systemctl start tomcat

We can now access the management page with the credentials that we have provided above in the configuration.

That’s it, we now end this tutorial on how to install Tomcat 9 on CentOS/RedHAT. Please feel free to send in any questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Simple guide to install TOMCAT 9 on CentOS/RHEL appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/simple-guide-to-install-tomcat-9-on-centos-ubuntu/feed/ 0 1044
How to Install Python on CentOS/RHEL https://thelinuxgurus.com/how-to-install-python-on-centos-rhel/ https://thelinuxgurus.com/how-to-install-python-on-centos-rhel/#respond Fri, 24 Jan 2020 07:10:02 +0000 https://thelinuxgurus.com/?p=1041 Python is one of the most widely used programming and scripting languages. With the use of the Internet of Things (IoT) & Artificial Intelligence (AI)...

The post How to Install Python on CentOS/RHEL appeared first on The Linux GURUS.

]]>
Python is one of the most widely used programming and scripting languages. With the use of the Internet of Things (IoT) & Artificial Intelligence (AI) on the rise, python has become one of the most widely sought computing languages. Python is a high-level programming language used for general-purpose programming.

Python emphasizes on code readability & is very easy to pick up & learn. Moreover, there is a very active community for python & you can start from thousands of projects available for free depending on your use-case.

Recommended Read: How to install JAVA on Ubuntu

Also Read: Simple guide to install MongoDB on Ubuntu 18.04

Python support for versions 2 aka python 2 has been discontinued from 1st Jan, 2020 & now only python version 3.5+ will be supported. In this tutorial, we will learn to install Python on CentOS & RHEL systems.

Install Python on CentOS/RHEL

Default repositories for CentOS do not always contain the latest python versions installed & we need to install community maintained repositories to install python. There are two community maintained repositories that we can use & we will discuss them one by one.

IUS Community

Install the rpm for this community with the following commands,

# sudo yum install yum-utils

# yum install https://centos7.iuscommunity.org/ius-release.rpm

Once this repository has been installed, Now install python with the following command,

# yum install python37u

SCL community

This method is specific for CentOS & is not tested by me on RHEL. SCL or software collections, allow us to install multiple versions of software on the system & it will not affect the default packages as well. Install SCL with the following command,

# yum install centos-release-scl

Now install python with the following command,

# yum install rh-python37

Now to use the latest version, open a new bash shell & use the following command,

# enable rh-python37 bash

You can use python 3.7 on this shell session, on new shell the default python version will be a system installed only.

Installing from Source

 

We have created a dedicated tutorial to install Python from Source. Please refer it.

That’s it for now, you can reach us for any question, query or a suggestion using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post How to Install Python on CentOS/RHEL appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/how-to-install-python-on-centos-rhel/feed/ 0 1041
How do i install Tomcat 9 on Ubuntu ??? https://thelinuxgurus.com/how-do-i-install-tomcat-9-on-ubuntu/ https://thelinuxgurus.com/how-do-i-install-tomcat-9-on-ubuntu/#respond Fri, 24 Jan 2020 06:05:56 +0000 https://thelinuxgurus.com/?p=1030 Apache Tomcat is one of the oldest & most widely used open-source web server that is used to serve java-based web-pages, it executes Java servlets...

The post How do i install Tomcat 9 on Ubuntu ??? appeared first on The Linux GURUS.

]]>
Apache Tomcat is one of the oldest & most widely used open-source web server that is used to serve java-based web-pages, it executes Java servlets and renders Web pages that include Java Server Page coding. It has been used by a number of organizations for serving java web pages. It generally runs JSP, Servlet, etc.

Recommended Read: Install MongoDB on Ubuntu 16.04

Also Read: Introduction to Bash Scripting Tutorial

In this tutorial, we will learn to install Tomcat 9 on Ubuntu Let’s start with the pre-requisites for tomcat installation.


Pre-Requisites

We need to have JAVA installed on the system before we can install tomcat on our systems. To install java 9 on ubuntu, use the following command,

# sudo apt-get install default-jdk

You can refer to this tutorial for detailed instructions on installing java.


Install Tomcat 9 on Ubuntu

Let’s first create a home directory for apache tomcat first,

$ mkdir /data/tomcat

Next, to install tomcat on Ubuntu, we will have to download the tar packages for apache tomcat 8. Use the following command to install

$ wget http://apachemirror.wuchna.com/tomcat/tomcat-9/v9.0.30/bin/apache-tomcat-9.0.30.tar.gz

Now extract the package to tomcat directory,

$ tar -xvzf apache-tomcat-9.0.30.tar.gz -C /data/tomcat

Our tomcat installation is ready & we can now start tomcat by running the startup script,

$ sh /data/tomcat/bin/startup.sh

But we will create a service script to start & stop tomcat,

# sudo vi /etc/systemd/system/tomcat.service

[Unit]

Description=Apache Tomcat Web Application Container

After=syslog.target network.target

[Service]

Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/jre

Environment=CATALINA_PID=/data/tomcat/temp/tomcat.pid

Environment=CATALINA_HOME=/data/tomcat

Environment=CATALINA_BASE=/data/tomcat

Environment=’CATALINA_dataS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC’

Environment=’JAVA_dataS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom’

ExecStart=/data/tomcat/bin/startup.sh

ExecStop=/bin/kill -15 $MAINPID

User=tomcat

Group=tomcat

[Install]

WantedBy=multi-user.target

Now save the file & exit. Load the newly created service into systemd with this command,

# sudo systemctl daemon-reload

We can now start & stop service using the systemctl,

# sudo systemctl start tomcat

You can now check the tomcat installation by opening the following URL on web browser,

http://127.0.0.1:8080

The next, step would be to configure users for the management interface of tomcat.


Configuring Tomcat

Apache tomcat is now ready to be started but before we do that we need to assign credentials to access ‘Manager’ & ‘GUI’ page of tomcat, as by default no user name and pasword is setup. To asisgn the credentials, we will use the ‘/opt/tomcat/conf/tomcat-users.xml ‘ file,

$ sudo vim /opt/tomcat/conf/tomcat-users.xml

& make the following entries to the file,

<role rolename=”manager-gui” />

<user username=”manager” password=”Password@123″ roles=”manager-gui” />

<role rolename=”admin-gui” />

<user username=”admin” password=”Password@123″ roles=”admin-gui” />

& make the following entries to the file, Make sure that you make these entries before the tag ‘tomcat-users’, i.e. make above entries before the below mentioned lines,

<tomcat-users xmlns=”http://tomcat.apache.org/xml”

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

xsi:schemaLocation=”http://tomcat.apache.org/xml tomcat-users.xsd”

version=”1.0″>

Once done, save the file & exit.

We need to make another change, though this is completely optional & completely depends on how you will access the manager page.We can only access the manager page from the browser on localhost but it we to access it on some other remote machines, we need to modify the ‘context.html’ for manager to comment the lines which disables the remote login,

$ sudo vim /opt/tomcat/webapps/manager/META-INF/context.xml

<Context antiResourceLocking=”false” privileged=”true” >

<!– <Valve className=”org.apache.catalina.valves.RemoteAddrValve”

allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> –>

</Context>

Same is to be for host-manager’s context file as well,

$ sudo vi /opt/tomcat/webapps/host-manager/META-INF/context.xml

<Context antiResourceLocking=”false” privileged=”true” >

<!– <Valve className=”org.apache.catalina.valves.RemoteAddrValve”

allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> –>

</Context>

Now save the file & exit. We can now enter the management interface for tomcat but first we need to restart the apache tomcat,

# sudo systemctl stop tomcat

# sudo systemctl start tomcat

We can now access the management page with the credentials that we have provided above in the configuration.

That’s it, we now end this tutorial on how to install Tomcat 9 on Ubuntu. Please feel free to send in any questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post How do i install Tomcat 9 on Ubuntu ??? appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/how-do-i-install-tomcat-9-on-ubuntu/feed/ 0 1030
How to install JAVA on Ubuntu https://thelinuxgurus.com/how-to-install-java-on-ubuntu/ https://thelinuxgurus.com/how-to-install-java-on-ubuntu/#respond Mon, 20 Jan 2020 15:50:23 +0000 https://thelinuxgurus.com/?p=1000 Java is a very famous, general-purpose programming language that is used for creating applications that run on mobile devices as well as computers. It can...

The post How to install JAVA on Ubuntu appeared first on The Linux GURUS.

]]>
Java is a very famous, general-purpose programming language that is used for creating applications that run on mobile devices as well as computers. It can create applications that can run on a single system as well as can be distributed among servers & clients in a network. In this tutorial, we will learn to install JAVA on Ubuntu systems.

Recommended Read: How to setup SSH login without password on Linux systems

Also Read: How to install Java on CentOS & RHEL

Before we learn how to install JAVA on Ubuntu, we must know the types of java available to install. There are two different types of java versions we can install.

Two versions being,

JAVA JRE (Java Run Time Environment) – JRE is used when you only need to run java based applications.

JAVA JDK (Java Development Kit) – is used for developing Java-based applications. It included JRE, debugging tool & some other libraries.

Moreover, there are two types of java available that we can install OPENJDK Java & Oracle java. Both are similar & provide almost the same functionalities barring for some additional features in Enterprise versions. We will learn to install both the java types in this tutorial.

OpenJDK installation


Java 11

To install OpenJDK java on Ubuntu, we need to execute the following commands from the terminal,

$ sudo apt-get update

$ sudo apt-get install default-jdk

This will install the default java JDK i.e. version 11 on Ubuntu system. If we need to install the java 11 jre, then we need to execute the following command,

$ sudo apt install default-jre


Java 8

To install java 8 on the systems, we need to run the following command,

$ sudo apt-get update

$ sudo apt-get install openjdk-8-jdk

& to install JRE, use the following command,

$ sudo apt-get install openjdk-8-jre

Oracle Java Installation

Oracle Java is not available on the default Ubuntu repositories & we need to install other custom repositories to be able to install java on Ubuntu. Install the repository first with the following command,

$ sudo apt install software-properties-common

$ sudo add-apt-repository ppa:linuxuprising/java

Next update system repositories,

$ sudo apt-get update

& install java on Ubuntu system,

$ sudo apt-get install oracle-java11-installer

Java is now installed on the system. The next part is configuring the default java for the systems as you might have more than one java version installed on the system.

Configuring default Java

Command to configure the default java is,

# alternatives –config java

Then you should get the java versions installed on the system, type the number mentioned against the java version & press enter to make it the default versions. This will change the java versions to one that you want. We end this tutorial on how to install java. Please do let us know if you have questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post How to install JAVA on Ubuntu appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/how-to-install-java-on-ubuntu/feed/ 0 1000
How to install Java on CentOS & RHEL https://thelinuxgurus.com/how-to-install-java-on-centos-rhel/ https://thelinuxgurus.com/how-to-install-java-on-centos-rhel/#respond Mon, 20 Jan 2020 15:43:20 +0000 https://thelinuxgurus.com/?p=996 Java is a very famous, general-purpose programming language that is used for creating applications that run on mobile devices as well as computers. It can...

The post How to install Java on CentOS & RHEL appeared first on The Linux GURUS.

]]>
Java is a very famous, general-purpose programming language that is used for creating applications that run on mobile devices as well as computers. It can create applications that can run on a single system as well as can be distributed among servers & clients in a network. In this tutorial, we will learn to install JAVA on CentOS/RHEL & Redhat hat based on other Linux operating systems.

Recommended Read: How to change timezone in Linux

Also Read: Learn to use KILL COMMAND in Linux

Before we learn about java installation, we must know the types of java available to install. There are two different types of java versions we can install. Two versions being,

JAVA JRE (Java Run Time Environment) – JRE is used when you only need to run java based applications.

JAVA JDK (Java Development Kit) – is used for developing Java-based applications. It included JRE, debugging tool & some other libraries.

Moreover, there are two different java versions that you install OpenJDK & Oracle java.

OpenJDK installation

We will start by installing the java 8 on our systems first & then will also discuss other java versions also. Open terminal & enter the following command to install Java 8,

# yum install java-1.8.0-openjdk-devel

This will install JDK on the system, to only install JRE on the system, use

# yum install java-1.8.0-openjdk

Java 8 is still one of the most widely used java versions but if you are looking at the latest java version with long term support, then you should be using Java 11. Let’s learn how to install this on our system,

# yum install java-11-openjdk-devel

To install JRE on the system, the command is

# yum install java-11-openjdk

Oracle Java installation

Oracle java packages are not available for installation on operating system default repositories & can only be installed using the rpm packages that are available on the official website’s DOWNLOAD PAGE. Once you download the rpm package, then you can install it similarly as you would any other rpm package, either using yum command or rpm command,

# yum localinstall ORACLE_JAVA_PACKAGE.rpm

That’s it, java is now installed on the system. The next part is configuring the default java for the systems as you might have more than one java version installed on the system.

Configuring default Java

Command to configure the default java is,

# alternatives –config java

Then you should get the java versions installed on the system, type the number mentioned against the java version & press enter to make it the default versions. This will change the java versions to one that you want. Please do let us know if you have questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post How to install Java on CentOS & RHEL appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/how-to-install-java-on-centos-rhel/feed/ 0 996