Home >Operation and Maintenance >Linux Operation and Maintenance >Step-by-step guide to installing Tomcat on Linux
Tomcat Installation Guide in Linux Environment
sudo apt update sudo apt install openjdk-8-jdk
tar -xvf apache-tomcat-x.x.x.tar.gz -C /opt
Note that you need to replace x.x.x
with the specific version number and /opt
with the directory where you want to install Tomcat.
.bashrc
file. vi ~/.bashrc
Add the following lines at the end of the file, save and exit.
export CATALINA_HOME=/opt/apache-tomcat-x.x.x export PATH=$PATH:$CATALINA_HOME/bin
Reload environment variables.
source ~/.bashrc
startup.sh
Tomcat will start on the default port 8080. Visit http://localhost:8080
in the browser. If you can see the Tomcat welcome page, it means that Tomcat has been successfully installed and configured.
tomcat-users.xml
file. vi $CATALINA_HOME/conf/tomcat-users.xml
Inside the <tomcat-users></tomcat-users>
tag, add the following code to create a new user.
<user username="admin" password="password" roles="manager-gui,admin-gui" />
You can modify the username, password and role according to your needs. Save and exit the file.
shutdown.sh startup.sh
Now, you can access the Tomcat management interface using the added username and password. Visit http://localhost:8080
in the browser, click the "Manager App" or "Host Manager" link, enter the user name and password, and enter the management interface.
Summary:
This article provides an installation guide for Tomcat in a Linux environment, and attaches specific code examples. By following these steps, you can easily install and configure Tomcat on your Linux system. After installing Tomcat, you can start deploying and running Java web applications.
The above is the detailed content of Step-by-step guide to installing Tomcat on Linux. For more information, please follow other related articles on the PHP Chinese website!