티스토리 뷰
In this tutorial, let me show you how to install Apache siblings such as Ant, Maven, andTomcat on CentOS 7 and 6.5 server. These three siblings can be used while building Java based applications. The same steps should work on all RPM based distributions such as RHEL/Scientific Linux 7/6.x, and Fedora.
Prerequisites
Before installing the Apache siblings, make sure you have installed Java JDK on your system. To install Java JDK on CentOS, RHEL, Scientific Linux, refer the following link.
The installation method for Apache Ant, Maven and Tomcat are almost same, and very easy.
Install Apache Ant
From the Ant homepage,
APACHE ANT IS A JAVA LIBRARY AND COMMAND-LINE TOOL WHOSE MISSION IS TO DRIVE PROCESSES DESCRIBED IN BUILD FILES AS TARGETS AND EXTENSION POINTS DEPENDENT UPON EACH OTHER. THE MAIN KNOWN USAGE OF ANT IS THE BUILD OF JAVA APPLICATIONS. ANT SUPPLIES A NUMBER OF BUILT-IN TASKS ALLOWING TO COMPILE, ASSEMBLE, TEST AND RUN JAVA APPLICATIONS. ANT CAN ALSO BE USED EFFECTIVELY TO BUILD NON JAVA APPLICATIONS, FOR INSTANCE C OR C++ APPLICATIONS. MORE GENERALLY, ANT CAN BE USED TO PILOT ANY TYPE OF PROCESS WHICH CAN BE DESCRIBED IN TERMS OF TARGETS AND TASKS.
Let us download the latest version from the project download page. At the time of writing this article, the latest stable Ant version was 1.9.4. For the purpose of this tutorial, I will be using Apache Ant binary file in zip format.
Extract it using command:
Move the extracted contents to /opt/ directory.
Make a symlink to ant/bin folder as shown below.
Setup ANT environment variable
Create a file called ant.sh under /etc/profile.d/ directory.
Add the following contents:
Save and close the file. Make it executable using the following command.
Then, set the environment variables permanently by running the following command:
Log out or reboot your system.
Now, check the ant version using command:
Sample output:
Check the path and environment variables:
Sample output:
Or
Sample output:
Install Maven
From the Apache maven project Homepage,
APACHE MAVEN IS A SOFTWARE PROJECT MANAGEMENT AND COMPREHENSION TOOL. BASED ON THE CONCEPT OF A PROJECT OBJECT MODEL (POM), MAVEN CAN MANAGE A PROJECT’S BUILD, REPORTING AND DOCUMENTATION FROM A CENTRAL PIECE OF INFORMATION.
Let us download the latest version from the project download page. At the time of writing this article, the stable Ant version was 3.2.3. For the purpose of this tutorial, I will be using Apache Maven binary file in zip format.
Extract it using command:
Move the extracted contents to /opt/ directory.
Make a symlink to maven/bin folder as shown below.
Setup Maven environment variable
Create a file called maven.sh under /etc/profile.d/ directory.
Add the following contents:
Save and close the file. Make it executable using the following command.
Then, set the environment variables permanently by running the following command:
Log out or reboot your system.
Now, check the ant version using command:
Sample output:
Check the environment variables:
Sample output:
Or
Sample output:
Install Tomcat
From the Apache Tomcat project home page,
APACHE TOMCAT IS AN OPEN SOURCE SOFTWARE IMPLEMENTATION OF THE JAVA SERVLET AND JAVASERVER PAGES TECHNOLOGIES. THE JAVA SERVLET AND JAVASERVER PAGES SPECIFICATIONS ARE DEVELOPED UNDER THE JAVA COMMUNITY PROCESS. APACHE TOMCAT IS DEVELOPED IN AN OPEN AND PARTICIPATORY ENVIRONMENT AND RELEASED UNDER THE APACHE LICENSE VERSION 2. APACHE TOMCAT IS INTENDED TO BE A COLLABORATION OF THE BEST-OF-BREED DEVELOPERS FROM AROUND THE WORLD. APACHE TOMCAT POWERS NUMEROUS LARGE-SCALE, MISSION-CRITICAL WEB APPLICATIONS ACROSS A DIVERSE RANGE OF INDUSTRIES AND ORGANIZATIONS.
First, download the latest version from the project download page. At the time of writing this article, the stable Tomcat version was 8.0.15. For the purpose of this tutorial, I will be using Apache Tomcat binary zip file.
Extract it using command:
Move the extracted contents to /opt/ directory.
Setup Tomcat environment variable
Create a file called tomcat.sh under /etc/profile.d/ directory.
Add the following contents:
Save and close the file. Make it executable using the following command.
Then, set the environment variables permanently by running the following command:
Now, we have to start the Tomcat server. Before starting Tomcat, give executable permission to the following script files.
Start Tomcat server by running the following command from your Terminal.
Sample output:
As you see in the above output, the Tomcat server has been started. Now, open up the browser and navigate to http://ip-address:8080/.
Make sure you’ve allowed the Tomcat default port 8080 through iptables.
On CentOS 6.x systems:
Edit file /etc/sysconfig/iptables,
Add the following line:
Save and close the file and restart the iptables service.
On CentOS 7 systems:
Now, navigate to http://ip-address:8080 from your web browser. You should see the following screen.
Voila! Congratulations! The Tomcat server is up and working.
To stop the server, just enter the following commands:
Autostart Tomcat
We haven’t finished yet. The Tomcat server won’t start after the system reboots. You have to make it to start it manually on every reboot.
If you want it to start automatically on every reboot, Just follow the steps given below.
Create a file called tomcat under /etc/init.d/ directory.
Copy/paste the following lines in it. Replace the JAVA and Tomcat paths and environment variables with your own.
Run the following command to add the tomcat service.
NB: Add double dashes(–) in front of ‘add’ word.
Now, start the tomcat service and make it to start automatically as shown below.
On CentOS 6.x systems:
On CentOS 7 systems:
Add Tomcat Manager Role
To add manager role, edit file tomcat-users.xml,
Add the following lines between <tomcat-users> … </tomcat-users> directive:
Restart tomcat service.
On CentOS 6.x systems:
On CentOS 7 systems:
Click on the Manager app on the right side. Enter the manger role(As you see in the abovetomcat-users.xml file, the manager role credentials are:
- Username: admin
- Password: admin
That’s all now. We have successfully installed the Apache siblings Ant, Maven, and Tomcat.
Cheers!
https://www.unixmen.com/install-apache-ant-maven-tomcat-centos-76-5/
- Total
- Today
- Yesterday
- spring boot
- jboss
- spring
- SBM
- Kubernetes
- Dependency
- bash
- SMPP
- zookeeper
- ssh
- docker
- Guava
- EMV
- Oracle
- Shell
- OOP
- dump
- nodejs
- install
- JSF
- Heap
- Tomcat
- ubuntu
- monitoring
- Jose
- bouncycastle
- Maven
- svn
- log4j
- Java
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |