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.
In this tutorial we will show you how to install the latest version of Apache Ant on CentOS 8. Apache Ant requires Java as dependency.
1. Install Java on CentOS 8
Apache Ant is built with Java technology. So it’s necessary to install java before proceeding.
2. Download and Install Apache Ant on CentOS 8
01- First, to download the latest version of Apache Ant, visit the Apache Ant releases page. Use the
wget command to download Apache Ant zip file:
$ wget -c http://mirrors.advancedhosters.com/apache/ant/binaries/apache-ant-1.10.7-bin.zip
02- Once the download is completed, extract the zip file in the
$ sudo unzip apache-ant-*.zip $ sudo mv apache-ant-*/ /usr/local/ant
sudo dnf install unzip.
3. Setup environment variables
01- We will now configure the PATH environment variable to include the Apache Ant’s bin directory. To do that, create a new file named
ant.sh inside of the
$ vi /etc/profile.d/ant.sh ANT_HOME="/usr/local/ant" PATH="$PATH:/usr/local/ant/bin" export ANT_HOME export PATH
02- Make the script executable by using the
$ sudo chmod +x /etc/profile.d/ant.sh
03- Load the environment variables for the current session by using the following command.
$ source /etc/profile.d/ant.sh
4. Verify the 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 Apache Ant(TM) version 1.10.7 compiled on September 1 2019
You have successfully installed Apache Ant on your Centos 8 server. You might want to check the following guides: