Ubuntu 20.04 system installation tutorial for Apache Tomcat

888u

Last update at :2024-01-31,Edit by888u

Apache Tomcat is an open source, lightweight web server for running Java-based websites and applications. At present, many websites are still developed based on Java, and at this time, Apache Tomcat needs to be used. Apache Tomcat is an implementation of the Jakarta EE platform, a modification of the Java EE platform to accommodate distributed computing and Web services. This article introduces the tutorial on how to install Apache Tomcat on Ubuntu 20.04 server. After the installation is completed, you can deploy the Java website.

1. Install Java

Update system packages:

$ sudo apt update

Install Java runtime environment:

$ sudo apt install default-jdk -y

Verify Java installation:

$java-version

2. Install Tomcat

Download the latest version of Apache Tomcat. To find the latest Tomcat version, visit the official download page.

$ wget https://archive.apache.org/dist/tomcat/tomcat-10/v10.0.8/bin/apache-tomcat-10.0.8.tar.gz

Unzip the downloaded installation package:

$ sudo tar xzvf apache-tomcat-10.0.8.tar.gz

Create installation directory:

$ sudo mkdir /opt/tomcat/

Move the unzipped files to the installation directory:

$ sudo mv apache-tomcat-10.0.8/* /opt/tomcat/

Modify all permissions of the installation directory:

$ sudo chown -R www-data:www-data /opt/tomcat/

Modify the access permissions of the installation directory:

$ sudo chmod -R 755 /opt/tomcat/

Edit the conf/tomcat-users.xml file to configure administrator and administrative accounts for Apache Tomcat.

$ sudo nano /opt/tomcat/conf/tomcat-users.xml

Add the following code in the tag. Change the password for administrator and manager access by changing the value below StrongPassword with a high security password.

Enable remote access to Apache Tomcat by editing the Manager and Host Manager configuration files. Edit the manager application context.xml file:

$ sudo nano /opt/tomcat/webapps/manager/META-INF/context.xml

Comment out the IP address part as shown below. Then, save and close the file.

Edit the Host Manager application context.xml file:

$ sudo nano /opt/tomcat/webapps/host-manager/META-INF/context.xml

Comment out the IP address part as shown below. Then, save and close the file.

Create a systemd unit file for Apache Tomcat.

$ sudo nano /etc/systemd/system/tomcat.service

Add the following code to the file. Then, save and close the file.

[Unit] Description=Tomcat After=network.target [Service] Type=forking User=root Group=root Environment="JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64" Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom" Environment="CATALINA_BASE=/opt/tomcat" Environment="CATALINA_HOME=/opt/tomcat" Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid" Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC" ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh [Install] WantedBy=multi-user.target

Reload the systemd daemon service to apply changes.

$ sudo systemctl daemon-reload

Start the Apache Tomcat service.

$ sudo systemctl start tomcat

Enables the service to start at system startup.

$ sudo systemctl enable tomcat

Check the status of the service.

$ sudo systemctl status tomcat

3. Access the Apache Tomcat Web interface

Go to your browser address bar to access the web interface and enter http://ServerIPaddress:8080 for SuiteCRM to access the web installation wizard. For example:

http://192.0.2.10:8080

At this point, you have installed Apache Tomcat on the server. You can now access the main dashboard to start managing your Java applications.

Recommended plan for bricklayers

Warm reminder: If you have difficulty choosing, just choose the CN2 GIA-E plan in the middle. The quarterly payment is $49.99, and you can switch between up to 12 computer rooms at will. plan Memory CPU harddisk Traffic/month bandwidth engine room price Buy Banwagonhost Discount Code: BWH3HYATVBJW Real-time inventory detection of the full solution for brick movers
CN2 (cheapest) 1GB 1 core 20GB 1TB 1Gbps DC3 CN2 DC8 ZNET $49.99/year Buy
CN2 2GB 1 core 40GB 2TB 1Gbps $52.99/half year $99.99/year Buy
CN2 GIA-E (Most recommended) 1GB 2 cores 20GB 1TB 2.5Gbps DC6 CN2 GIA-E DC9 CN2 GIA Japan SoftBank JPOS_1 Netherlands EUNL_9 $49.99/quarter $169.99/year Buy
CN2 GIA-E 2GB 3 core 40GB 2TB 2.5Gbps $89.99/quarter $299.99/year Buy
HK 2GB 2 cores 40GB 0.5TB 1Gbps Hong Kong, China CN2 GIA $89.99/month $899.99/year Buy
HK 4GB 4 core 80GB 1TB 1Gbps $155.99/month $1559.99/year Buy
TOKYO 2GB 2 cores 40GB 0.5TB 1.2Gbps Tokyo, Japan CN2 GIA $89.99/month $899.99/year Buy
TOKYO 4GB 4 core 80GB 1TB 1.2Gbps $155.99/month $1559.99/year Buy

Recommended site search: dynamic vps instant ip change, space rental, permanent free vps cloud host, ip address, mobile server hosting, Ningbo server, overseas server, distribution host vps US server, domain name provider,

Ubuntu 20.04 system installation tutorial for Apache Tomcat

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码