Install Apache Ant on CentOS 8 - Step by step guide ?

Apache Ant is an open-source tool for automating Java program build process. Similar to how the make utility builds an executable from source code and libraries using a Makefile, Apache Ant builds a Java project from its source code and libraries by using a similar XML file.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Apache Ant queries.

In this context, we shall look into how to install Apache Ant on CentOS 8.

Steps to Install Apache Ant on CentOS 8

1. Perform System Update

First, let's start by ensuring your system is up-to-date:

$ sudo dnf install epel-release
$ sudo dnf update

2. Install Java on the system

Currently, there are two LTS versions of OpenJDK – OpenJDK 8 and OpenJDK 11. You can also install the both Java version on any system and use as per your requirements.

To Install OpenJDK 11, run the below command:

$ sudo dnf install java-11-openjdk-devel

To Install OpenJDK 8, execute the below command:

$ sudo dnf install java-1.8.0-openjdk-devel

To Verify Java version installed, run the below command:

$ java -version

3. Install Apache Ant on the system

Now we download the lasted version of Apache Ant from the official page:

$ wget
$ sudo unzip
$ sudo mv apache-ant-1.10.7/ /usr/local/ant

Then, make Ant available as a command to all users of the system. This will make it easy to use and run from any folder:

$ sudo nano /etc/profile

And add the following lines:

export ANT_HOME
export PATH

Make the script executable by using the chmod command:

$ sudo chmod +x /etc/profile

Save and exit also activates the above environment variables. Load the environment variables for the current session by using the following command:

$ source /etc/profile

How to verify Apache Ant installation ?

To verify if Apache Ant is installed properly use the ant -v command which will display the Apache Ant version:

$ ant -version

[Need assistance in installing Software on Linux system ? We can help you. ]

This article covers the process of installing Apache Ant on your CentOS 8 system. In fact, Apache Ant is a Java library and command-line tool that help building software. Ant supplies a number of built-in tasks that allows to compile, assemble, and run Java applications. Its build files are written in XML so it is open standard, portable and easy to understand.

Related Posts