書名: Learning Continuous Integration with Jenkins(Second Edition)作者名: Nikhil Pathania本章字數: 232字更新時間: 2021-07-02 21:18:34
Installing Apache Tomcat
Follow these steps to download and then install Apache Tomcat server on your Ubuntu machine:
- 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/.
- Create a directory called /opt/tomcat using the following command:
sudo mkdir /opt/tomcat
- Untar the content of the archive inside /opt/tomcat:
sudo tar xzvf apache-tomcat-8*tar.gz \
-C /opt/tomcat --strip-components=1
- Next, create a systemd service file using the following command:
sudo nano /etc/systemd/system/tomcat.service
- 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
- Type Ctrl + X and choose Y to save and close the file.
- Next, reload the systemd daemon using the following command:
sudo systemctl daemon-reload
- Start the Tomcat service using the following command:
sudo systemctl start tomcat
- To check the status of Tomcat service, run the following command:
sudo systemctl status tomcat
- 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
推薦閱讀
- Linux網絡管理與配置(第2版)
- 每天5分鐘玩轉Kubernetes
- 構建高可用Linux服務器(第4版)
- 白話區塊鏈
- Persistence in PHP with the Doctrine ORM
- 新手易學:系統安裝與重裝
- 嵌入式Linux驅動程序和系統開發實例精講
- 深入理解eBPF與可觀測性
- Linux自動化運維:Shell與Ansible(微課版)
- 網絡操作系統教程:Windows Server 2016管理與配置
- Learning Magento 2 Administration
- Windows Vista終極技巧金典
- Linux內核API完全參考手冊(第2版)
- OpenVZ Essentials
- Unity AR/VR開發:實戰高手訓練營