Webtrees Installation

Webtrees is the web’s leading on-line collaborative genealogy application. Here are the steps I followed to install it on my server.

This post was published quite some time ago and likely contains out of date information.

After the initial setup of my new server, installation of a basic Webtrees site was simple. Create the database, configure Nginx, download, install and configure Webtrees itself.

Database Creation

Create an account and a database for Webtrees:

mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5340 to server version: 3.23.54
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql> CREATE DATABASE alltheforest_com;
Query OK, 1 row affected (0.00 sec)
 
mysql> GRANT ALL PRIVILEGES ON alltheforest_com.* TO "alltheforest_com"@"localhost"
    -> IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)
  
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> EXIT
Bye

Nginx Configuration

I created the /etc/nginx/conf.d/alltheforest.com.conf file:

server {
    listen 80;
    server_name alltheforest.com;
    client_max_body_size 64M;

    index index.php index.html;
    include /etc/nginx/default.d/*.conf;
    root  /var/www/alltheforest.com/webtrees;

    location / {
        try_files $uri $uri/ /index.php?q=$request_uri;
    }
}

Restart the nginx service:

systemctl restart nginx

Webtrees Install

Firstly I created a new directory for the site:

mkdir -p /var/www/alltheforest.com

Then I downloaded and extracted the latest version of Webtrees:

curl -L https://launchpad.net/webtrees/1.6/1.6.2/+download/webtrees-1.6.2.zip -o /tmp/webtrees.zip
unzip /tmp/webtrees.zip -d /var/www/alltheforest.com

Using Curl to download webtrees I had to include the -L parameter to tell Curl to follow redirects.

Themes and Plugins

First I downloaded and installed my chosen theme, Rural by Jaubart:

curl -o /tmp/rural.zip http://www.jaubart.com/storage/rural-webtrees-1_6_2.zip
unzip /tmp/rural.zip -d  /var/www/alltheforest.com/webtrees/themes

File and Directory Permissions

Set permissions on files, and change the context on the data directory so nginx can write to it:

find /var/www/alltheforest.com/webtrees/ -type f -exec chmod 664 {} +
find /var/www/alltheforest.com/webtrees/ -type d -exec chmod 775 {} +
chown -R apache.nobody /var/www/alltheforest.com/webtrees
chcon -hR system_u:object_r:httpd_sys_content_t /var/www/alltheforest.com/webtrees/data/

Note that if the chcon line results in an error about a missing context, remove the selinux-policy package and re-run the command:

yum erase selinux-policy
chcon -hR system_u:object_r:httpd_sys_content_t /var/www/alltheforest.com/webtrees/data/

Next Steps

At this point the Webtrees installation was complete. I pointed DNS for alltheforest.com to the new server and browsed to it in Chrome. WebTrees presented a final installation wizard, which created the initial database entries.

I could also have restored my database from backup at this point, however would need to ensure the restored /var/www/alltheforest.com/webtrees/data/config.ini.php file had the correct database details.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *