官术网_书友最值得收藏!

Installing Apache Tomcat

Follow these steps to download and then install Apache Tomcat server on your Ubuntu machine:

  1. Move to the /tmp directory and download the Tomcat application using the wget command, as shown here:
        cd /tmp
wget https://archive.apache.org/dist/tomcat/tomcat-8/ \
v8.5.16/bin/apache-tomcat-8.5.16.tar.gz

To get a complete list of Apache Tomcat versions visit: https://archive.apache.org/dist/tomcat/.

  1. Create a directory called /opt/tomcat using the following command:
        sudo mkdir /opt/tomcat 
  1. Untar the content of the archive inside /opt/tomcat:
        sudo tar xzvf apache-tomcat-8*tar.gz \
-C /opt/tomcat --strip-components=1
  1. Next, create a systemd service file using the following command:
        sudo nano /etc/systemd/system/tomcat.service
  1. Paste the following content into the file:
        [Unit] 
        Description=Apache Tomcat Web Application Container 
        After=network.target 
 
        [Service] 
        Type=forking 
 
        Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64                     
        Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid 
        Environment=CATALINA_HOME=/opt/tomcat 
        Environment=CATALINA_BASE=/opt/tomcat 
        Environment='CATALINA_OPTS=-Xms512M -Xmx1024M
-server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true
-Djava.security.egd=file:/dev/./urandom' ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh RestartSec=10 Restart=always [Install] WantedBy=multi-user.target
  1. Type Ctrl + X and choose Y to save and close the file.
  2. Next, reload the systemd daemon using the following command:
        sudo systemctl daemon-reload 
  1. Start the Tomcat service using the following command:
        sudo systemctl start tomcat 

  1. To check the status of Tomcat service, run the following command:
        sudo systemctl status tomcat  
  1. You should see the following output:
        ● tomcat.service - Apache Tomcat Web Application Container 
          Loaded: loaded (/etc/systemd/system/tomcat.service; disabled;
vendor preset: enabled) Active: active (running) since Mon 2017-07-31 21:27:39 UTC;
5s ago Process: 6438 ExecStart=/opt/tomcat/bin/startup.sh (code=exited,
status=0/SUCCESS) Main PID: 6448 (java) Tasks: 44 Memory: 132.2M CPU: 2.013s CGroup: /system.slice/tomcat.service └─6448 /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java
-Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogMan
主站蜘蛛池模板: 佛冈县| 呼玛县| 舞钢市| 商城县| 五峰| 舞钢市| 阳春市| 阿拉尔市| 淮南市| 义马市| 翁源县| 柳州市| 兴文县| 五华县| 龙川县| 武陟县| 驻马店市| 英德市| 进贤县| 眉山市| 孝感市| 嘉兴市| 屏边| 汶川县| 宁明县| 乌拉特中旗| 西藏| 社旗县| 阿瓦提县| 汝南县| 西丰县| 都江堰市| 太仓市| 新绛县| 英吉沙县| 宜丰县| 洪雅县| 内丘县| 颍上县| 南岸区| 石嘴山市|