Home Operation and Maintenance Apache How to install apache tomcat on linux

How to install apache tomcat on linux

Aug 09, 2019 am 11:16 AM
apache linux tomcat

How to install apache tomcat on linux

Apache Tomcat, also known as Tomcat server, is an open source java servlet cotainer & provides a pure JAVA http webserver environmnet to run java code. It is very famous and widely used for running Java based websites all over the world. Apache Tomcat software powers a large number of mission-critical web applications across a wide range of industries and organizations.

Apache Tomcat can be used in various operating systems, such as Linux, Unix, Windows, etc. Apache Tomcat recently announced the end of life for the Tomcat 8.0.x version, although this will not affect the 8.5.x version.

How to install apache tomcat on linux?

In this tutorial, we will discuss the Apache Tomcat installation of v8.5, as it is the latest stable version (v9 is also available, which is still in BETA at the time of writing and does not currently have a stable version) .

Requirements

To install Tomcat 8.5, we will need JAVA 7 or higher. So first we need to install and setup JAVA on our system. You can install JAVA using the following command,

CentOS/RHEL
$ sudo yum install java-1.8.0
Ubuntu/Debian
$ sudo apt-get install openjdk-8*
Copy after login

Apache Tomcat Installation

For Apache Tomcat installation, we will use the following command to download the archived package from the official website,

$ wget http://redrockdigimark.com/apachemirror/tomcat/tomcat-8/v8.5.23/bin/apache-tomcat-8.5.23.tar.gz
Copy after login

Once the file has finished downloading, unzip the package in the /opt directory (we can also use some other directories/data etc.). Run the following command in the terminal to extract the files,

$ tar -xvzf pache-tomcat-8.5.23.tar.gz -C /opt
$ mv /opt/apache-tomcat-8.5.23/ /opt/tomcat
Copy after login

Now Apache Tomcat is ready, but before we do that, we need to assign certificates to access tomcat's 'Manager' and 'GUI' pages, which are by default There is no username and password set. In order to verify the credentials we will use the '/opt/tomcat/conf/tomcat-users.xml' file,

$ vim /opt/tomcat/conf/tomcat-users.xml
Copy after login

and make the following entries to the file,

<role rolename=”manager-gui” />
<user username=”manager” password=”Password@123″ roles=”manager-gui” />
<role rolename=”admin-gui” />
<user username=”admin” password=”Password@123″ roles=”admin-gui” />
Copy after login

Make sure you are in the tag " Make these entries before tomcat-users" i.e. make the above entries before the lines mentioned below.

<tomcat-users xmlns=”http://tomcat.apache.org/xml”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://tomcat.apache.org/xml tomcat-users.xsd”
version=”1.0″>
Copy after login

After completion, save the file and exit.

We need to make another change, although this is completely optional and completely depends on how you access the manager page. We can only access the management page from the browser on the local host, but we need to access it on other remote machines, we need to modify "context.html" for manager to comment out those lines that disable remote login,

$ vi /opt/tomcat/webapps/manager/META-INF/context.xml
<Context antiResourceLocking=”false” privileged=”true” >
<!– <Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> –>
</Context>
Copy after login

The same applies to the host-manager context file,

$ vi /opt/tomcat/webapps/host-manager/META-INF/context.xml
<Context antiResourceLocking=”false” privileged=”true” >
<!– <Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> –>
 </Context>
Copy after login

We are now ready to start the tomcat server, go to the /opt/tomcat/bin folder and run the script named "startup.sh",

$ cd /opt/tomcat/bin
$ sh startup.sh
Copy after login

How to install apache tomcat on linux

Apache Tomcat will start with the following output,

Now open a web browser of your choice and access the Apache Tomcat UI using the following URL,

http://192.168.1.100:8080
Copy after login

How to install apache tomcat on linux

Here, 192.168.1.100 is the IP address of the apache tomcat server. We will now be directed to the page below, where we can access the "Manager" and "Host Manager" pages by clicking on the corresponding tabs. After clicking on any tab we will be asked to authenticate in order to access the page. We need to enter the credentials we set up before to access the page.

How to install apache tomcat on linuxFor more Apache related knowledge, please visit the

Apache Usage Tutorial

column!

The above is the detailed content of How to install apache tomcat on linux. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use docker desktop How to use docker desktop Apr 15, 2025 am 11:45 AM

How to use Docker Desktop? Docker Desktop is a tool for running Docker containers on local machines. The steps to use include: 1. Install Docker Desktop; 2. Start Docker Desktop; 3. Create Docker image (using Dockerfile); 4. Build Docker image (using docker build); 5. Run Docker container (using docker run).

How to view the docker process How to view the docker process Apr 15, 2025 am 11:48 AM

Docker process viewing method: 1. Docker CLI command: docker ps; 2. Systemd CLI command: systemctl status docker; 3. Docker Compose CLI command: docker-compose ps; 4. Process Explorer (Windows); 5. /proc directory (Linux).

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

What to do if the docker image fails What to do if the docker image fails Apr 15, 2025 am 11:21 AM

Troubleshooting steps for failed Docker image build: Check Dockerfile syntax and dependency version. Check if the build context contains the required source code and dependencies. View the build log for error details. Use the --target option to build a hierarchical phase to identify failure points. Make sure to use the latest version of Docker engine. Build the image with --t [image-name]:debug mode to debug the problem. Check disk space and make sure it is sufficient. Disable SELinux to prevent interference with the build process. Ask community platforms for help, provide Dockerfiles and build log descriptions for more specific suggestions.

How to switch Chinese mode with vscode How to switch Chinese mode with vscode Apr 15, 2025 pm 11:39 PM

VS Code To switch Chinese mode: Open the settings interface (Windows/Linux: Ctrl, macOS: Cmd,) Search for "Editor: Language" settings Select "Chinese" in the drop-down menu Save settings and restart VS Code

What is vscode What is vscode for? What is vscode What is vscode for? Apr 15, 2025 pm 06:45 PM

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages ​​and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

How to back up vscode settings and extensions How to back up vscode settings and extensions Apr 15, 2025 pm 05:18 PM

How to back up VS Code configurations and extensions? Manually backup the settings file: Copy the key JSON files (settings.json, keybindings.json, extensions.json) to a safe location. Take advantage of VS Code synchronization: enable synchronization with your GitHub account to automatically back up all relevant settings and extensions. Use third-party tools: Back up configurations with reliable tools and provide richer features such as version control and incremental backups.

See all articles