Flash Sale! to get a free eCookbook with our top 25 recipes.

Panduan Install Tomcat9 di ubuntu 18.04

Hallo gaes
Admin mau memberikan tutorial Instalasi tomcat di Ubuntu 18.04 nih, di karenakan Ubuntu 18.04 sudah tidak support menggunakan Java 7 lagi maka Solusinya bisa menggunakan Java Versi Terbaru agar bisa di gunakan untuk kebutuhan di perfect world pwAdmin kalian jika ingin menggunakan Ubuntu 18.04
Berikut Panduannya sebelumnya pastikan VPS kalian atau VM kalian bisa koneksi ke internet yaa jika belum silahkan seting terlebih dahulu

==== CARA INSTALL APACHE TOMCAT DI UBUNTU 16.04 / 18.04 ====

1. sudo apt update
2. sudo apt install default-jdk -y
3. java –version
Output :
openjdk 10.0.1 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 10.0.1+10-Ubuntu-3ubuntu1, mixed mode)

4. sudo mkdir /opt/tomcat
5. sudo useradd -s /bin/false -d /opt/tomcat tomcat
6. wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.37/bin/apache-tomcat-9.0.37.tar.gz

7. sudo tar xzvf apache-tomcat-9.0.37.tar.gz -C /opt/tomcat –strip-components=1
8. sudo chgrp -R tomcat /opt/tomcat
9. cd /opt/tomcat/
10. sudo chmod -R g+r conf
11. sudo chmod g+x conf
12. sudo chown -R tomcat webapps/ work/ temp/ logs/
13. sudo update-java-alternatives -l
Output : java-1.11.0-openjdk-amd64 1101 /usr/lib/jvm/java-1.11.0-openjdk-amd64

==============================================

14.sudo nano /etc/systemd/system/tomcat.service

ISI DENGAN ini :

[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/java-1.11.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

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

15. sudo systemctl daemon-reload
16. sudo systemctl start tomcat
17. sudo systemctl enable tomcat
Output :
Created symlink /etc/systemd/system/multi-user.target.wants/tomcat.service → /etc/systemd/system/tomcat.service.
18. sudo systemctl status tomcat
===================================================

19. sudo nano /opt/tomcat/webapps/host-manager/META-INF/context.xml

Ganti bagian ini :

<Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ />

Menjadi

<!–Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> –>

20. sudo nano /opt/tomcat/webapps/manager/META-INF/context.xml

Ganti bagian Ini :

<Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ />

Menjadi

<!–Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ />–>

21. Restrat tomcat kalian : sudo systemctl restart tomcat
22. Silahkan askes tomcat kalian melalui browser http://[IP] or [Domain]:8080/

Apache-Tomcat-9-Home-Page-1024x546.jpg

========================================================

MEMBERIKAN USER DAN PASSWORD PADA TOMCAT

22. sudo nano /opt/tomcat/conf/tomcat-users.xml
Isi baris bawah sebelum </user>
<role rolename=”manager-gui”/>
<user username=”user-login” password=”isi-password-kamu” roles=”manager-gui,admin-gui”/>

23. sudo systemctl restart tomcat

Tomcat-9-Web-Application-Manager-1024x546.gif

 

Web-Manager-Dashboard-Tomcat9-1024x546.jpg

Jika Sudah bisa di akses kalian bisa Upload File ke Server Perfect World Private Server bagian pwAdmin kalian ke Folder : /opt/tomcat/webapps/

Terima Kasih semoga Bermanfaat dalam Develop Perfect World Private Server kalian menggunakan OS Ubuntu terbaru karena cara ini bisa di gunakan juga untuk ubuntu versi di atas nya lagi .