Skip to content

Instantly share code, notes, and snippets.

Created August 28, 2017 19:44
Show Gist options
  • Save anonymous/2dbf96487c1224a87e9321c13254ff82 to your computer and use it in GitHub Desktop.
Save anonymous/2dbf96487c1224a87e9321c13254ff82 to your computer and use it in GitHub Desktop.
Tomcat ubuntu 16.04

Tomcat ubuntu 16.04



Get the latest tutorials on SysAdmin and open source topics. Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. This tutorial covers the basic installation and some configuration of the latest release of Tomcat 8 on your Ubuntu Before you begin with this guide, you should have a non-root user with sudo privileges set up on your server. You can learn how to do this by completing our Ubuntu Tomcat requires Java to be installed on the server so that any Java web application code can be executed. We can satisfy that requirement by installing OpenJDK with apt-get. Now that Java is installed, we can create a tomcat user, which will be used to run the Tomcat service. For security purposes, Tomcat should be run as an unprivileged user i. We will create a new user and group that will run the Tomcat service. Next, create a new tomcat user. The best way to install Tomcat 8 is to download the latest binary release then configure it manually. Find the latest version of Tomcat 8 at the Tomcat 8 Downloads page. At the time of writing, the latest version is 8. Under the Binary Distributions section, then under the Core list, copy the link to the "tar. Create the directory, then extract the archive to it with these commands:. The tomcat user that we set up needs to have access to the Tomcat installation. Next, give the tomcat group read access to the conf directory and all of its contents, and execute access to the directory itself:. Make the tomcat user the owner of the webapps , work , temp , and logs directories:. Now that the proper permissions are set up, we can create a systemd service file to manage the Tomcat process. Tomcat needs to know where Java is installed. The easiest way to look up that location is by running this command:. With this piece of information, we can create the systemd service file. Open a file called tomcat. Paste the following contents into your service file. Before we do that, we need to adjust the firewall to allow our requests to get to the service. If you followed the prerequisites, you will have a ufw firewall enabled currently. Tomcat uses port to accept conventional requests. Allow traffic to that port by typing:. With the firewall modified, you can access the default splash page by going to your domain or IP address followed by: You will see the default Tomcat splash page, in addition to other information. However, if you click the links for the Manager App, for instance, you will be denied access. We can configure that access next. If you were able to successfully accessed Tomcat, now is a good time to enable the service file so that Tomcat automatically starts at boot:. In order to use the manager web app that comes with Tomcat, we must add a login to our Tomcat server. We will do this by editing the tomcat-users. You will want to add a user who can access the manager-gui and admin-gui web apps that come with Tomcat. You can do so by defining a user, similar to the example below, between the tomcat-users tags. Be sure to change the username and password to something secure:. By default, newer versions of Tomcat restrict access to the Manager and Host Manager apps to connections coming from the server itself. Since we are installing on a remote machine, you will probably want to remove or alter this restriction. To change the IP address restrictions on these, open the appropriate context. Inside, comment out the IP address restriction to allow connections from anywhere. Alternatively, if you would like to allow access only to connections coming from your own IP address, you can add your public IP address to the list:. Now that we have create a user, we can access the web management interface again in a web browser. You will need to enter the account credentials that you added to the tomcat-users. Afterwards, you should see a page that looks like this:. The Web Application Manager is used to manage your Java applications. You can Start, Stop, Reload, Deploy, and Undeploy here. You can also run some diagnostics on your apps i. Lastly, information about your server is available at the very bottom of this page. Your installation of Tomcat is complete! Your are now free to deploy your own Java web applications! Currently, your Tomcat installation is functional, but entirely unencrypted. This means that all data, including sensitive items like passwords, are sent in plain text that can be intercepted and read by other parties on the internet. In order to prevent this from happening, it is strongly recommended that you encrypt your connections with SSL. You can find out how to encrypt your connections to Tomcat by following this guide. Sign Up Log In. We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Introduction Apache Tomcat is a web server and servlet container that is used to serve Java applications. Prerequisites Before you begin with this guide, you should have a non-root user with sudo privileges set up on your server. Install Java Tomcat requires Java to be installed on the server so that any Java web application code can be executed. First, update your apt-get package index: Create Tomcat User For security purposes, Tomcat should be run as an unprivileged user i. First, create a new tomcat group: Install Tomcat The best way to install Tomcat 8 is to download the latest binary release then configure it manually. Create the directory, then extract the archive to it with these commands: Update Permissions The tomcat user that we set up needs to have access to the Tomcat installation. Change to the directory where we unpacked the Tomcat installation: Create a systemd Service File We want to be able to run Tomcat as a service, so we will set up systemd service file. The easiest way to look up that location is by running this command: Spin up an SSD cloud server in under a minute. Related Tutorials How to Install Perlbrew and Manage Multiple Versions of Perl 5 on CentOS 7 How To Build Go Executables for Multiple Platforms on Ubuntu This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4. Sign into your account, or create a new one, to start interacting. Log In Sign Up. Use this form to report bugs related to the Community.


Как лечить сосуды носа
Можно ли продать ипотечную квартиру при разводе
Новости официального новосибирска
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment