debian tomcat
介绍 (Introduction)
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 9 on your Debian 10 server.
Apache Tomcat是用于服务Java应用程序的Web服务器和servlet容器。 Tomcat是由Apache Software Foundation发布的Java Servlet和JavaServer Pages技术的开源实现。 本教程介绍了Debian 10服务器上Tomcat 9最新版本的基本安装和一些配置。
先决条件 (Prerequisites)
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 Debian 10 initial server setup guide.
在开始本指南之前,您应该在服务器上设置具有sudo
特权的非root用户。 您可以通过完成《 Debian 10初始服务器设置指南》来学习如何做。
第1步-安装Java (Step 1 — Install Java)
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.
Tomcat要求在服务器上安装Java,以便可以执行任何Java Web应用程序代码。 我们可以通过使用apt安装OpenJDK来满足该要求。
First, update your apt package index:
首先,更新您的apt软件包索引:
- sudo apt update sudo apt更新
Then install the Java Development Kit package with apt:
然后使用apt安装Java Development Kit软件包:
- sudo apt install default-jdk 须藤apt install default-jdk
Now that Java is installed, we can create a tomcat
user, which will be used to run the Tomcat service.
现在已经安装了Java,我们可以创建一个tomcat
用户,该用户将用于运行Tomcat服务。
第2步-创建Tomcat用户 (Step 2 — Create Tomcat User)
For security purposes, Tomcat should be run as an unprivileged user (i.e. not root). We will create a new user and group that will run the Tomcat service.
为了安全起见,Tomcat应该以非特权用户(即不是root )身份运行。 我们将创建一个将运行Tomcat服务的新用户和组。
First, create a new tomcat group:
首先,创建一个新的tomcat组:
- sudo groupadd tomcat 须藤groupadd tomcat
Next, create a new tomcat user. We’ll make this user a member of the tomcat group, with a home directory of /opt/tomcat
(where we will install Tomcat), and with a shell of /bin/false
(so nobody can log into the account):
接下来,创建一个新的tomcat用户。 我们将使该用户成为tomcat组的成员,其主目录为/opt/tomcat
(将在其中安装Tomcat),并使用/bin/false
的外壳程序(因此没有人可以登录该帐户):
- sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat sudo useradd -s / bin / false -g tomcat -d / opt / tomcat tomcat
Now that our tomcat user is set up, let’s download and install Tomcat.
现在我们的tomcat用户已经设置好了,让我们下载并安装Tomcat。
第3步-安装Tomcat (Step 3 — Install Tomcat)
The best way to install Tomcat 9 is to download the latest binary release then configure it manually.
安装Tomcat 9的最佳方法是下载最新的二进制发行版,然后手动进行配置。
Find the latest version of Tomcat 9 at the Tomcat 9 Downloads page. At the time of writing, the latest version is 9.0.27, but you should use a later stable version if it is available. Under the Binary Distributions section, then under the Core list, copy the link to the “tar.gz”.
在“ Tomcat 9下载”页面上找到最