0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AlmaLinuxにKnowledgeを構築

Last updated at Posted at 2024-10-13

はじめに

KnowledgeをLinuxサーバー上に構築し、外部ネットワークからアクセスできるようにします。

環境

  • AlmaLinux release 9.4

ポート解放

firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload

Javaインストール

dnf install -y java-1.8.0-openjdk-devel.x86_64

PATHを通す

vi /etc/profile

以下を追記

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.422.b05-2.el9.x86_64/
export PATH=$PATH:$JAVA_HOME/bin

再読み込み

source /etc/profile

Tomcatインストール

ユーザーの追加

useradd tomcat
passwd tomcat
cd /home/tomcat

wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.99/bin/apache-tomcat-8.5.99.tar.gz
tar -xzvf apache-tomcat-8.5.99.tar.gz

mv /home/tomcat/apache-tomcat-8.5.99 /opt

chown -R tomcat:tomcat /opt/apache-tomcat-8.5.99

Knowledgeインストール

cd /opt/apache-tomcat-8.5.99/webapps
wget https://github.com/support-project/knowledge/releases/download/v1.13.1/knowledge.war

Tomcatのユニットファイル作成

vi /etc/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat 8
After=network.target

[Service]
User=tomcat
Group=tomcat
Type=oneshot
PIDFile=/opt/apache-tomcat-8.5.99/tomcat.pid
RemainAfterExit=yes

Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.422.b05-2.el9.x86_64/
Environment=JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.422.b05-2.el9.x86_64/jre
Environment=CATALINA_HOME=/opt/apache-tomcat-8.5.99
Environment=CATALINA_BASE=/opt/apache-tomcat-8.5.99
Environment='CATALINA_OPTS=-server -Xms1024M -Xmx1024M -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=512M'

ExecStart=/opt/apache-tomcat-8.5.99/bin/startup.sh
ExecStop=/opt/apache-tomcat-8.5.99/bin/shutdown.sh
ExecReStart=/opt/apache-tomcat-8.5.99/bin/shutdown.sh;/opt/apache-tomcat-8.5.99/bin/startup.sh

[Install]
WantedBy=multi-user.target

サーバー起動時に自動的に起動するように

systemctl enable tomcat
systemctl start tomcat
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?