If there are no errors, you can enable the Tomcat service to start automatically at boot time: sudo systemctl enable tomcat Set the Firewall It can check service status with the following command: sudo systemctl status tomcat We will notify systemd that we created a new unit file and we will start the Tomcat service running: sudo systemctl daemon-reload WantedBy=multi-user.target Check the status of the service This must be saved inside the / etc / systemd / system / directory with the following content:Į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 To run Tomcat as a service, we will create a new unit file called rvice. We will have to change the ownership of the directory to tomcat's user and group: sudo chown -R tomcat: /opt/tomcatĪs well we will make the scripts inside the bin directory executable: sudo chmod +x /opt/tomcat/latest/bin/*.sh Create a systemd unit file The tomcat user we set up earlier needs to have access to Tomcat 9 directory. Later, if you want to update your Tomcat installation, you can unpack the latest version and change the symlink to point to the latest version. To withdraw from your have more control over versions and updates, we will create a symbolic link that will point to the installation directory: sudo ln -s /opt/tomcat/apache-tomcat-* /opt/tomcat/latest Once the download is complete, we will extract the zip file and move it to the / opt / tomcat directory: unzip apache-tomcat-*.zip When we are clear about the file to download, we will move to / tmp directory and download the zip file with wget. As of this writing, the latest version is 9.0.10. Let's download the latest version of Tomcat 9.0.x since download page. We can install them by typing: sudo apt install unzip wget We will use wget and unzip to download and extract the Tomcat 9 file. Now let's create a new system user and group with home directory in / opt / tomcat, which will run the Tomcat service: sudo useradd -m -U -d /opt/tomcat -s /bin/false tomcat Download Tomcat 9 If you prefer to install Oracle Java instead of OpenJDK, see the instructions that a colleague posted some time ago. La installing the OpenJDK package on Ubuntu 18.04 it is quite simple: 7 Configure Tomcat Web Manager Interface.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |