Difference between revisions of "How to setup a webtrees server on a Debian 9 Proxmox container"
From steamWiki
| Line 6: | Line 6: | ||
#Using the Proxmox web interface, create a new Container using the Debian 9 template. | #Using the Proxmox web interface, create a new Container using the Debian 9 template. | ||
#Log into the container, with the root account, using the Proxmox web console | #Log into the container, with the root account, using the Proxmox web console | ||
| − | #Update, Upgrade, and Install a few packages | + | #Update, Upgrade, and Install a few packages by running <pre>apt update apt upgrade apt install sudo unzip</pre> |
| − | + | #Update the timezone by running <pre>timedatectl set-timezone America/New_York</pre> | |
| − | # | + | #*change ''America/New_York'' to a location relevant to your physical location using the "TZ database name" in this [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones table] |
| − | # | + | #Add a user and give them sudo access by running <pre>useradd admin usermod -aG sudo admin</pre> |
| − | #Update the timezone | + | #Exit the web console and ssh in as the admin user <pre>ssh admin@CONTAINERNAME</pre> |
| − | + | ||
| − | + | =Setup a [https://mariadb.org/ MariaDB] Database= | |
| − | #Add a user and give them sudo access | + | #install the necessary packages, secure the installation, and log into the mysql database by running <pre> sudo apt install mariadb-server mariadb-client sudo mysql_secure_installation |
| − | + | #*The current root password is blank | |
| − | + | #*Create a new root password | |
| − | #Exit the web console and ssh in as the admin user | + | #*Answer Yes to all questions |
| − | =Setup a [https://mariadb.org/ MariaDB] | + | ##Log into the mysql database as root by running <pre>sudo mysql</pre> |
| − | #install the necessary packages, secure the installation, and log into the mysql database | + | #Create a database and user for webtrees by running <pre>CREATE DATABASE webtreesDB; GRANT ALL PRIVILEGES ON webtreesDB.* TO 'webtrees'@'localhost' IDENTIFIED BY 'WEBtreesPASSWORD'; FLUSH PRIVILEGES; exit</pre> |
| − | + | ||
| − | # | + | =Setup an [https://httpd.apache.org/ Apache2] Web Server= |
| − | # | + | #Install Apache 2 by running <pre>sudo apt install apache2</pre> |
| − | # | + | #visit http://CONTAINERNAME/ in a browser and you should see the default Apache2 server page |
| − | # | + | |
| − | ## | ||
| − | #Create a database and user for webtrees | ||
| − | |||
| − | # | ||
| − | # | ||
| − | # | ||
| − | =Setup an [https://httpd.apache.org/ Apache2] | ||
| − | # | ||
| − | # | ||
=Setup [https://www.php.net/ PHP]7= | =Setup [https://www.php.net/ PHP]7= | ||
| − | # | + | #Install necessary PHP packages by running <pre>sudo apt install php libapache2-mod-php php-mysql php-apcu php-xml php-gd</pre> |
| − | + | #Edit the ''php.ini'' file by running <pre>sudo nano /etc/php/7.0/apache2/php.ini</pre> and configuring ''upload_max_filesize'' <pre>upload_max_filesize = 20M</pre> to ensure that you can upload reasonably sized GEDCOM files from the web interface | |
| − | + | #Restart Apache2 by running <pre>systemctl restart apache2</pre> | |
| − | # | + | #Ensure that PHP is running with the following <pre>sudo nano /var/www/html/info.php</pre> fill it in with the following <pre><?php phpinfo(); ?><//pre> save and exit by hitting ''Ctrl+C'' and ''Y'' Then go to ''http://<containername>/info.php and you should see the default PHP info page |
| − | # | + | #Delete this page by running <pre>sudo rm /var/www/html/info.php</pre> |
| − | |||
| − | phpinfo(); | ||
| − | ?></ | ||
| − | |||
| − | # | ||
=Setup webtrees= | =Setup webtrees= | ||
| − | # | + | #Change directories to the web root by running <pre>cd /var/www/html</pre> |
| − | # | + | #Download the latest copy of webtrees by running <pre>sudo wget https://github.com/fisharebest/webtrees/releases/download/1.7.13/webtrees-1.7.13.zip</pre> You can change the version number at the end of the above command to reflect the latest stable release available at https://github.com/fisharebest/webtrees/releases |
| − | + | #Uncompress the files by running <pre>sudo unzip webtrees-1.7.13.zip</pre> | |
| − | # | + | #Delete the compressed file by running <pre>sudo rm webtrees-1.7.13.zip</pre> |
| − | # | ||
#visit http://containername/webtrees/ to finish the setup | #visit http://containername/webtrees/ to finish the setup | ||
##fix any server configuration or server capacity problems (there shouldn't be any if the above packages were installed) | ##fix any server configuration or server capacity problems (there shouldn't be any if the above packages were installed) | ||
| − | ##for the database login info enter ''webtrees'' as the user and '' | + | ##for the database login info enter '''webtrees''' as the user and '''WEBtreesPASSWORD''' as the password |
| − | ##for the database name enter ''webtreesDB'' | + | ##for the database name enter '''webtreesDB''' |
| − | ##you can leave the table prefix name ''<blank>'' since this is a container and you probably shouldn't be sharing the database with other webtrees installations | + | ##you can leave the table prefix name '''<blank>''' since this is a container and you probably shouldn't be sharing the database with other webtrees installations |
| − | ##Enter your name, select a username, select a password, and select an email for the next sections. | + | ##Enter your '''name''', select a '''username''', select a '''password''', and select an '''email''' for the next sections. |
| − | ##Sign in to Webtrees using the username and password you just picked out | + | ##Sign in to Webtrees using the '''username''' and '''password''' you just picked out |
| − | ##Create a new family tree named something like | + | ##Create a new family tree named something like '''Conan the Barbarian Family Tree''' |
| − | ##Give it a short name like | + | ##Give it a short name like '''conan''' |
| − | ##Under ''Website preferences'' | + | ##Under '''Website preferences''' |
| − | ###Select ''America/New_York'' (or whatever your location is) for the timezone | + | ###Select '''America/New_York''' (or whatever your location is) for the timezone |
| − | ###Make sure | + | ###Make sure '''Show list of family trees''' is set to '''yes''' if you think you'll ever have more than one family tree on your page. |
| − | ##Under ''Sign-in and registration'' | + | ##Under '''Sign-in and registration''' |
| − | ###Set ''Welcome text on sign-in page'' to ''Predefined text that states that only family members can request a user account'' (or whatever you want) | + | ###Set '''Welcome text on sign-in page''' to '''Predefined text that states that only family members can request a user account''' (or whatever you want) |
| − | ###Set ''Show acceptable use agreement on "Request a new user account" page'' to ''no'' (or whatever you want) | + | ###Set '''Show acceptable use agreement on "Request a new user account" page''' to '''no''' (or whatever you want) |
| − | ##Under ''Languages'' | + | ##Under '''Languages''' |
###uncheck any languages you don't want to support | ###uncheck any languages you don't want to support | ||
###check any extra languages you do want to support | ###check any extra languages you do want to support | ||
| + | |||
=Setup the Reverse Proxy= | =Setup the Reverse Proxy= | ||
| − | #On your webtrees container modify line 173 of ''/var/www/html/webtrees/includes/sessions.php'' | + | #On your webtrees container modify line 173 of ''/var/www/html/webtrees/includes/sessions.php'' by running <pre>sudo nano /var/www/html/includes/sessions.php</pre> and changing <pre>define('WT_BASE_URL', $base_uri);</pre> to <pre>define('WT_BASE_URL', 'https://mypublicdomain.com/webtrees/');</pre> |
| − | |||
| − | |||
#Log into your Reverse Proxy machine/container (assumed to be on Debian 9 with permanent redirects from http to https) | #Log into your Reverse Proxy machine/container (assumed to be on Debian 9 with permanent redirects from http to https) | ||
| − | #If you want to put an htpasswd based password on the front of the site then | + | #If you want to put an ''htpasswd'' based password on the front of the site then create an htpasswd file by running <pre>sudo htpasswd -c /etc/apache2/.webtrees_htpasswd username</pre> |
| − | + | #Add a redirect (from HTTP to HTTPS) to Apache by running <pre>sudo nano /etc/apache2/sites-enabled/000-default.conf</pre> and adding the following under the '''<VirtualHost *:80>''' tag <pre>Redirect permanent /webtrees https://steamforge.net/webtrees</pre> | |
| − | # | + | #Add the Proxy calls to Apache by running the following <pre>sudo nano /etc/apache2/sites-enabled/000-default-ssl.conf</pre> and adding the following under the '''<VirtualHost _default_:443> tag <pre>#webtrees <Location /webtrees> AuthType Basic AuthName "Enter username/password to access webtrees" AuthBasicProvider file AuthUserFile "/etc/apache2/.webtrees_htpasswd" Require valid-user ProxyPreserveHost On ProxyPass http://containername/webtrees ProxyPassReverse http://containername/webtrees </Location></pre> (leave off the first block about Authentication if you didn't create ''.webtrees_htpasswd'') |
| − | |||
| − | # | ||
| − | |||
| − | <Location /webtrees> | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | </Location></ | ||
[[Category: Linux]] | [[Category: Linux]] | ||
Revision as of 19:55, 9 July 2019
webtrees is a pretty cool opensource genealogy web server. It allows you to setup a website to display your family history. You can use webtrees to create your family tree or import a family tree from popular services like Ancestry.com and MyHeritage.com.
This article describes how I setup a webtrees server on a Debian 9 based Linux Container (LXC) under Proxmox and made the page available on the internet using an Apache2 Reverse Proxy
Contents
Setup the Container
- Using the Proxmox web interface, create a new Container using the Debian 9 template.
- Log into the container, with the root account, using the Proxmox web console
- Update, Upgrade, and Install a few packages by running
apt update apt upgrade apt install sudo unzip
- Update the timezone by running
timedatectl set-timezone America/New_York
- change America/New_York to a location relevant to your physical location using the "TZ database name" in this table
- Add a user and give them sudo access by running
useradd admin usermod -aG sudo admin
- Exit the web console and ssh in as the admin user
ssh admin@CONTAINERNAME
Setup a MariaDB Database
- install the necessary packages, secure the installation, and log into the mysql database by running
sudo apt install mariadb-server mariadb-client sudo mysql_secure_installation
- The current root password is blank
- Create a new root password
- Answer Yes to all questions
- Log into the mysql database as root by running <pre>sudo mysql
- Create a database and user for webtrees by running
CREATE DATABASE webtreesDB; GRANT ALL PRIVILEGES ON webtreesDB.* TO 'webtrees'@'localhost' IDENTIFIED BY 'WEBtreesPASSWORD'; FLUSH PRIVILEGES; exit
Setup an Apache2 Web Server
- Install Apache 2 by running
sudo apt install apache2
- visit http://CONTAINERNAME/ in a browser and you should see the default Apache2 server page
Setup PHP7
- Install necessary PHP packages by running
sudo apt install php libapache2-mod-php php-mysql php-apcu php-xml php-gd
- Edit the php.ini file by running
sudo nano /etc/php/7.0/apache2/php.ini
and configuring upload_max_filesizeupload_max_filesize = 20M
to ensure that you can upload reasonably sized GEDCOM files from the web interface - Restart Apache2 by running
systemctl restart apache2
- Ensure that PHP is running with the following
sudo nano /var/www/html/info.php
fill it in with the following<?php phpinfo(); ?><//pre> save and exit by hitting ''Ctrl+C'' and ''Y'' Then go to ''http://<containername>/info.php and you should see the default PHP info page
- Delete this page by running <pre>sudo rm /var/www/html/info.php
Setup webtrees
- Change directories to the web root by running
cd /var/www/html
- Download the latest copy of webtrees by running
sudo wget https://github.com/fisharebest/webtrees/releases/download/1.7.13/webtrees-1.7.13.zip
You can change the version number at the end of the above command to reflect the latest stable release available at https://github.com/fisharebest/webtrees/releases - Uncompress the files by running
sudo unzip webtrees-1.7.13.zip
- Delete the compressed file by running
sudo rm webtrees-1.7.13.zip
- visit http://containername/webtrees/ to finish the setup
- fix any server configuration or server capacity problems (there shouldn't be any if the above packages were installed)
- for the database login info enter webtrees as the user and WEBtreesPASSWORD as the password
- for the database name enter webtreesDB
- you can leave the table prefix name <blank> since this is a container and you probably shouldn't be sharing the database with other webtrees installations
- Enter your name, select a username, select a password, and select an email for the next sections.
- Sign in to Webtrees using the username and password you just picked out
- Create a new family tree named something like Conan the Barbarian Family Tree
- Give it a short name like conan
- Under Website preferences
- Select America/New_York (or whatever your location is) for the timezone
- Make sure Show list of family trees is set to yes if you think you'll ever have more than one family tree on your page.
- Under Sign-in and registration
- Set Welcome text on sign-in page to Predefined text that states that only family members can request a user account (or whatever you want)
- Set Show acceptable use agreement on "Request a new user account" page to no (or whatever you want)
- Under Languages
- uncheck any languages you don't want to support
- check any extra languages you do want to support
Setup the Reverse Proxy
- On your webtrees container modify line 173 of /var/www/html/webtrees/includes/sessions.php by running
sudo nano /var/www/html/includes/sessions.php
and changingdefine('WT_BASE_URL', $base_uri);todefine('WT_BASE_URL', 'https://mypublicdomain.com/webtrees/'); - Log into your Reverse Proxy machine/container (assumed to be on Debian 9 with permanent redirects from http to https)
- If you want to put an htpasswd based password on the front of the site then create an htpasswd file by running
sudo htpasswd -c /etc/apache2/.webtrees_htpasswd username
- Add a redirect (from HTTP to HTTPS) to Apache by running
sudo nano /etc/apache2/sites-enabled/000-default.conf
and adding the following under the <VirtualHost *:80> tagRedirect permanent /webtrees https://steamforge.net/webtrees
- Add the Proxy calls to Apache by running the following
sudo nano /etc/apache2/sites-enabled/000-default-ssl.conf
and adding the following under the <VirtualHost _default_:443> tag#webtrees <Location /webtrees> AuthType Basic AuthName "Enter username/password to access webtrees" AuthBasicProvider file AuthUserFile "/etc/apache2/.webtrees_htpasswd" Require valid-user ProxyPreserveHost On ProxyPass http://containername/webtrees ProxyPassReverse http://containername/webtrees </Location>(leave off the first block about Authentication if you didn't create .webtrees_htpasswd)