How to install Ant on CentOS 9 Stream?

Welcome, my friend. Today, you will learn how to install Ant on CentOS 9 Stream. Thanks to this tool, we will be able to automate the process of compiling and creating Java packages. Let’s take a look at it.

Introduction—What is Ant?

According to the official Ant documentation:

Apache Ant is a Java library and command line tool whose mission is to drive the processes described in the build files as mutually dependent targets and extension points.

As the developers themselves say, Ant’s main mission is to create Java packages quickly and easily with established rules. These tasks or rules are usually set in a build.xml file that we can then run with some commands in the terminal.

Ant is extremely flexible and does not impose coding conventions or directory layouts on Java projects that adopt it as a build tool.

As we can notice, it is an important tool in Java development. Let’s go for it.

Install Java on CentOS 9 Stream

Ant is built with Java, so we have to install this language to be able to install and use it. For this, we leave you our post.

How to install Java on CentOS 9 Stream?

Once Java is installed without problems, you can continue.

Install Ant on CentOS 9 Stream

Now we can install Ant. The best way to do it is to get the latest stable version of it.

First, open a terminal and install some necessary packages

sudo dnf install wget tar nano

And then thanks to wget you can start the download:

wget -c

Then unzip it

tar vxfz apache-ant-1.10.12-bin.tar.gz

Now move it to a system directory such as /usr/local/

sudo mv apache-ant-*/ /usr/local/ant

The next step is to set the environment variables correctly so that Ant can work in the best possible way.

Create a file for this purpose:

sudo nano /etc/profile.d/

And add the following content:

export ANT_HOME
export PATH

Save the changes and close the editor. To apply the changes, give the file execute permissions:

sudo chmod +x /etc/profile.d/

And apply it:

source /etc/profile.d/

Finally, you can verify the installation of Ant with the command line:

ant -version

You will get an output screen like this:

1.- Ant on CentOS 9 Stream
1.- Ant on CentOS 9 Stream


In this post, you learned how to install Ant on CentOS 9 Stream. This way, you will be able to take advantage of it in your Java projects. I hope this post is useful for you.

I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook