![]() It strongly recommended to set strong password for users. We will define a new user in this file with access to the tomcat manager-gui and admin-gui. Edit tomcat-users.xml file by running following command: sudo nano /opt/tomcat/latest/conf/tomcat-users.xml The tomcat-users.xml file contains Tomcat users and their roles. Now, Tomcat is installed and time to create user and roles to access web interface. sudo ufw allow 8080/tcp Configure Tomcat Web Management Interface # If firewall is running on your server then you should open port 8080 to access Tomcat from outside of your local system. If there is no error then enable the Tomcat service to auto-start at boot: sudo systemctl enable tomcat Adjusting Firewall # Process: 5104 ExecStart=/opt/tomcat/latest/bin/startup.sh (code=exited, status=0/SUCCESS) Loaded: loaded (/etc/systemd/system/rvice enabled vendor preset: enabled)Īctive: active (running) since Mon 08:28:37 UTC 4s ago After that reload systemd daemon to notify systemd that a new file created and start the Tomcat service: sudo systemctl daemon-reload sudo systemctl start tomcatĬheck the status of the Tomcat service using below command: sudo systemctl status tomcat Note : If the path to your Java installation is different than default, you should replace JAVA_HOME variable. Įnvironment="JAVA_HOME=/usr/lib/jvm/default-java"Įnvironment="JAVA_OPTS=file:///dev/urandom"Įnvironment="CATALINA_BASE=/opt/tomcat/latest"Įnvironment="CATALINA_HOME=/opt/tomcat/latest"Įnvironment="CATALINA_PID=/opt/tomcat/latest/temp/tomcat.pid"Įnvironment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"ĮxecStart=/opt/tomcat/latest/bin/startup.shĮxecStop=/opt/tomcat/latest/bin/shutdown.sh Now, add the following code into the file. Open your favorite text editor to create a rvice file inside /etc/systemd/system/ directory: sudo nano /etc/systemd/system/rvice To run Tomcat as a service we will create a new file. Make a script inside the bin directory executable: sudo sh -c 'chmod +x /opt/tomcat/latest/bin/*.sh' Create Systemd Unit File # Run the below command: sudo chown -R tomcat: /opt/tomcat So that user can have access to the installation directory. You must change the ownership of the /opt/tomcat directory to previously created tomcat user and group. sudo ln -s /opt/tomcat/apache-tomcat-9.0.35 /opt/tomcat/latest Set Permissions # Later, when upgrading Tomcat, you can easily migrate to another Tomcat version just by changing the symlink to point to the desired version. Now, We will create a symbolic link by setting latest as name, that points to the Tomcat installation directory. Sudo tar -xf apache-tomcat-9.0.35.tar.gz sudo mv apache-tomcat-9.0.35 /opt/tomcat/
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |