OpenCMS installieren (AlmaLinux/CentOS)

Aus RT-Wiki - IT-Notizbuch
Zur Navigation springen Zur Suche springen

Getestet auf: AlmaLinux 8

OpenJDK 17 installieren

dnf install java-17-openjdk

MySQL(MariaDB) installieren

Repository hinzufügen

curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
bash mariadb_repo_setup --mariadb-server-version=10.7
dnf -y module reset mariadb

MariaDB-Server 10.7 installieren

dnf install MariaDB-server MariaDB-client MariaDB-backup

my.cnf anpassen

vi /etc/my.cnf
#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
max_allowed_packet=32M
#
# include *.cnf from the config directory
#
!includedir /etc/my.cnf.d

Verbindungen nur von localhost akzeptieren

 vi /etc/my.cnf.d/server.cnf
# Allow server to accept connections on all interfaces.
#
bind-address=127.0.0.1

MySQL Service starten

systemctl enable --now mysql

MariaDB sichern

mariadb-secure-installation

Datenbank erstellen

mysql -uroot -p
CREATE DATABASE opencms;
GRANT ALL PRIVILEGES ON opencms.* TO opencms@localhost identified by 'secure_password';
FLUSH PRIVILEGES;
EXIT;

Tomcat installieren

Benutzer & Gruppe anlegen

groupadd --system tomcat
useradd -d /usr/share/tomcat -r -s /bin/false -g tomcat tomcat

wget installieren

dnf install wget

tomcat 9.0.60 installieren

wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.60/bin/apache-tomcat-9.0.60.tar.gz
tar xvf apache-tomcat-9.0.60.tar.gz -C /usr/share
ln -s /usr/share/apache-tomcat-9.0.60/ /usr/share/tomcat

Ordner-Berechtigungen anpassen

chown -R tomcat:tomcat /usr/share/tomcat
chown -R tomcat:tomcat /usr/share/apache-tomcat-9.0.60/

systemd-Service erstellen

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

[Service]
Type=forking
User=tomcat
Group=tomcat

Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment='JAVA_OPTS=-Djava.awt.headless=true'
Environment=CATALINA_HOME=/usr/share/tomcat
Environment=CATALINA_BASE=/usr/share/tomcat
Environment=CATALINA_PID=/usr/share/tomcat/temp/tomcat.pid
Environment='CATALINA_OPTS=-Xms512M -Xmx2G'
ExecStart=/usr/share/tomcat/bin/catalina.sh start
ExecStop=/usr/share/tomcat/bin/catalina.sh stop

[Install]
WantedBy=multi-user.target

tomcat starten

systemctl daemon-reload
systemctl enable --now tomcat

Prüfen ob der Service läuft

systemctl status tomcat

Ausgabe:

● tomcat.service - Tomcat Server
   Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2022-03-23 21:55:47 CET; 9s ago
  Process: 9684 ExecStart=/usr/share/tomcat/bin/catalina.sh start (code=exited, status=0/SUCCESS)
 Main PID: 9689 (java)
    Tasks: 38 (limit: 49492)
   Memory: 96.0M
   CGroup: /system.slice/tomcat.service
           └─9689 /usr/lib/jvm/jre/bin/java -Djava.util.logging.config.file=/usr/share/tomcat/conf/loggin>

Mär 23 21:55:47 host.localhost systemd[1]: Starting Tomcat Server...
Mär 23 21:55:47 host.localhost systemd[1]: Started Tomcat Server.

OpenCMS installieren

wget http://www.opencms.org/downloads/opencms/opencms-12.0.zip
dnf install unzip
unzip opencms-12.0.zip -d ~/opencms
cd opencms
cp opencms.war /usr/share/tomcat/webapps/opencms.war
chown tomcat:tomcat /usr/share/tomcat/webapps/opencms.war
systemctl restart tomcat

Setup Assistenten starten

http://localhost:8080/opencms/setup/