Installing Software on Linux from the Source (Not YUM)
Introduction
This post aims to show how you can install software from the source (e.g. a .tar
file) instead of using yum
or custom .rpm
installs. This is useful if you have a lot of custom configurations and do not want an installer to make decisions and configuration changes for you. This technique is often used for large, custom web apps.
We are going to use two pieces of software as an example: OpenJDK and Tomcat. Let's get to it!
*Please note that we are installing both of these pieces of software in /etc/java
and /etc/tomcat
respectively. You can obviously place them wherever you need to.
OpenJDK Download and Install Instructions (Without Using an Installer)
Assumptions
- Using OpenJDK 11
- Installing on a Linux machine
- Run all commands as root
Steps
- Download the
.tar
from this link. Download it directly to the box with this command:
wget https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz
ssh
to the box where the.tar
exists,cd
to the directory where you put the.tar
, and run the following:
tar xvf openjdk-11*_bin.tar.gz --directory /etc
mv /etc/jdk-11* /etc/java
- Add the following to your
.bash_profile
or.bashrc
file and thensource
it (source .bash_profile
):
PATH=$PATH:$HOME/bin/:/etc/java/bin
JAVA_HOME=/etc/java/
export PATH
export JAVA_HOME
- Verify the install with
java -version
Tomcat Download and Install Instructions (Without Using an Installer)
Assumptions
- Using Tomcat 9
- Installing on a Linux machine
- OpenJDK 11 is already installed
- Run all commands as root
Steps
- Download the
.tar
from this link. Download it directly to the box with this command:
wget http://mirror.cc.columbia.edu/pub/software/apache/tomcat/tomcat-9/v9.0.22/bin/apache-tomcat-9.0.22.tar.gz
ssh
to the box where the.tar
exists,cd
to the directory where you put the.tar
, and run the following:
tar xvf apache-tomcat-*.tar.gz --directory /etc
mv /etc/apache-tomcat-* /etc/tomcat
- Add the following to your
.bash_profile
or.bashrc
file and thensource
it (source .bash_profile
):
CATALINA_HOME=/etc/tomcat
export CATALINA_HOME
Start tomcat:
/etc/tomcat/bin/catalina.sh start
Verify it is running:
ps -ef | grep tomcat
Conclusion
If all goes well, you should have Java and Tomcat installed and running! You can see that this is fairly simple to do and also useful for ensuring you know exactly what changes are made to your system during an install.
Please let me know if you have any questions! [email protected]