install webtrees on rocky linux 8

used in this tutorial:

patch and reboot the server:

dnf upgrade -y && reboot

install packages

since the latest version of webtrees (2.0.17) at the time of writing this (2021-10-07) only supports up to php 7.4, we’ll have to enable the php 7.4 module:

dnf module enable php:7.4 -y

the next minor release of webtrees (2.1.0) will support php 8.0 and later, since php 7.4 will stop receiving security support in about a year.

next, install all neccesary packages:

dnf install -y vim nginx php wget mariadb-server policycoreutils-python-utils php-gd php-intl php-zip php-mysqlnd

enable services

systemctl enable nginx mariadb --now

open the firewall

firewall-cmd --zone=public --permanent --add-service={http,https,mysql}
firewall-cmd --reload

configure the database

complete the secure mysql install:

mysql_secure_installation

connect to mysql and create service account user ‘webtrees’ (replace ‘password’ below with something more secure please):

create user 'webtrees'@'localhost' identified by 'password';
grant all privileges on webtrees.* to 'webtrees'@'localhost';
flush privileges;

configure the web server

test that nginx via browser:

or by using curl:

curl http://localhost

(optional) remove default webserver files:

rm -f /usr/share/nginx/html/*

download webtrees and unzip it to nginx web server directory:

wget https://github.com/fisharebest/webtrees/releases/download/2.0.17/webtrees-2.0.17.zip
unzip webtrees-2.0.17.zip -d /usr/share/nginx/html/

now you’ll need to make sure webtrees has correct permissions for the data directory. change the selinux context on the following directory and make sure correct permissions are set:

semanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/nginx/html/webtrees/data(/.*)?"
restorecon -R -v /usr/share/nginx/html/webtrees/data
chmod 777 /usr/share/nginx/html/webtrees/data

install webtrees

navigate to your web browser to complete installation:

http://SERVER_IP/webtrees/

make sure to select “MySQL”: fill in the appropriate data from the database setup step: complete the administrator account sign up as neccesary: (note: it may take a moment or two after clicking ‘next’) create your first family tree and enjoy!

(optional) additional nginx configuration

you may want to modify your nginx configuration to use ‘pretty URLs’ (this is purely preference):

before:

replace /etc/nginx/nginx.conf on your server with my modified version

additionally you’ll need to add the following line to /usr/share/nginx/html/webtrees/data/config.ini.php:

rewrite_urls="1"

after:

closing

today you learned how to install webtrees on Rocky Linux 8. please note that this installation is NOT secure. for now, I’m leaving it as an exercise to the reader to configure HTTPS.

on the webtrees end, all you need to do is change the line containing ‘base_url’ in /usr/share/nginx/html/webtrees/data/config.ini.php to the following:

base_url="https://www.example.com/webtrees"