1. Install Java
Upgrade the system
$ sudo apt upgr
ade
Update system packages.
$ sudo apt update
Install Java runtime environment.
$ sudo apt install default-jdk -y
Verify Java installation.
$ java -version
How to find the OpenJDK directory with the following command:
$ readlink -f /usr/bin/javac
As you can have multiple versions of Java installed on your system, you can decide which one is the default one.First, run a command that shows all the installed versions on your computer:
$ sudo update-alternatives --config java
2. Install Tomcat
Download the latest version of Apache Tomcat. To find the latest Tomcat version, visit the official download page.
$ wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.23/bin/apache-tomcat-10.0.23.tar.gz
Extract the downloaded archive.
$ sudo tar xzvf apache-tomcat-10.0.23.tar.gz
Create an installation directory /opt/tomcat/
.
$ sudo mkdir /opt/tomcat/
Move the extracted files to the installation directory.
$ sudo mv apache-tomcat-10.0.23/* /opt/tomcat/
Since you have already created a user, you can now grant tomcat
ownership over the extracted installation by running:
Edit
- sudo chown -R tomcat:tomcat /opt/tomcat/
- sudo chmod -R u+x /opt/tomcat/bin
conf/tomcat-users.xml
file to configure an administrator and manager
account for Apache Tomcat.
$ sudo nano /opt/tomcat/conf/tomcat-users.xml
Add the code below within the <tomcat-users>
tag. Change the password for administrator and manager access by changing the value StrongPassword
below with a high secure password.
<!-- user manager can access only manager section -->
<role rolename="manager-gui" />
<user username="manager" password="manager" roles="manager-gui" />
<!-- user admin can access manager and admin section both -->
<role rolename="admin-gui" />
<user username="admin" password="admin" roles="manager-gui,admin-gui" />
Enable remote access to Apache Tomcat by editing manager and host-manager configuration files. Edit manager application context.xml
file:
$ sudo nano /opt/tomcat/webapps/manager/META-INF/context.xml
Comment out the IP addresses section as shown below. Then, save and close the file.
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
Edit host manager application context.xml
file:
$ sudo nano /opt/tomcat/webapps/host-manager/META-INF/context.xml
Comment out the IP addresses section as shown below. Then, save and close the file.
<!--<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
Create a systemd unit file for Apache Tomcat.
$ sudo nano /etc/systemd/system/tomcat.service
Add the code below 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 system daemon service to apply changes.
$ sudo systemctl daemon-reload
Start Apache Tomcat service.
$ sudo systemctl start tomcat
Enable the service to start up on system boot.
$ sudo systemctl enable tomcat
Check the status of the service.
$ sudo systemctl status tomcat
Note: press ctrl +c after running the above coomand
Note:Bydefault localhost:8080 if it does not start then we need
to change the localhost:8081 and repeat the above 4 commands
i.e reload start,enable,check
root@ubuntu:/opt/tomcat# cd conf/
root@ubuntu:/opt/tomcat/conf# ls
Catalina context.xml logging.properties tomcat-users.xsd
catalina.policy jaspic-providers.xml server.xml web.xml
catalina.properties jaspic-providers.xsd tomcat-users.xml
root@ubuntu:/opt/tomcat/conf# gedit server.xml
3. Access Apache Tomcat Web Interface
Go to your browser address bar to access the web interface and type in http://ServerIPaddress:8080
for SuiteCRM to access the web install wizard. For example:
localhost:8081/
Note:If still it is not working then we need to use the following coomands
root@ubuntu:/opt/tomcat/bin# ./shutdown.sh
root@ubuntu:/opt/tomcat/bin# ./startup.sh
No comments:
Post a Comment