Difference between revisions of "How to setup a webtrees server on a Debian 9 Proxmox container"

From steamWiki
Jump to: navigation, search
(Created page with "[https://www.webtrees.net webtrees] is a pretty cool opensource genealogy web server. It allows you to setup a website to display your family history. You can use [https://w...")
 
Line 3: Line 3:
 
This article describes how I setup a webtrees server on a [https://www.debian.org/ Debian] 9 based [https://linuxcontainers.org/ Linux Container (LXC)] under [https://www.proxmox.com/en/ Proxmox] and made the page available on the internet using an [https://httpd.apache.org/ Apache2] [https://en.wikipedia.org/wiki/Reverse_proxy Reverse Proxy]
 
This article describes how I setup a webtrees server on a [https://www.debian.org/ Debian] 9 based [https://linuxcontainers.org/ Linux Container (LXC)] under [https://www.proxmox.com/en/ Proxmox] and made the page available on the internet using an [https://httpd.apache.org/ Apache2] [https://en.wikipedia.org/wiki/Reverse_proxy Reverse Proxy]
  
 +
=Setup the Container=
 
#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
###run ''apt update''
+
##run ''apt update''
###run ''apt upgrade''
+
##run ''apt upgrade''
###run ''apt install sudo unzip''
+
##run ''apt install sudo unzip''
##Update the timezone
+
#Update the timezone
###run ''timedatectl set-timezone America/New_York''
+
##run ''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 [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones table]
+
##*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
+
#Add a user and give them sudo access
###useradd admin
+
##useradd admin
###usermod -aG sudo admin
+
##usermod -aG sudo admin
##Exit the web console and ssh in as the admin user
+
#Exit the web console and ssh in as the admin user
#Setup a [https://mariadb.org/ MariaDB] database
+
=Setup a [https://mariadb.org/ MariaDB] database=
##install the necessary packages, secure the installation, and log into the mysql database
+
#install the necessary packages, secure the installation, and log into the mysql database
###run ''sudo apt install mariadb-server mariadb-client''
+
##run ''sudo apt install mariadb-server mariadb-client''
###run ''sudo mysql_secure_installation''
+
##run ''sudo mysql_secure_installation''
####The current root password is blank
+
###The current root password is blank
####Create a new root password
+
###Create a new root password
####Answer Yes to all questions
+
###Answer Yes to all questions
###run ''sudo mysql'' to login as root
+
##run ''sudo mysql'' to login as root
##Create a database and user for webtrees
+
#Create a database and user for webtrees
###run ''CREATE DATABASE webtreesDB;''
+
##run ''CREATE DATABASE webtreesDB;''
###run ''GRANT ALL PRIVILEGES ON webtreesDB.* TO 'webtrees'@'localhost' IDENTIFIED BY 'webtreespassword';''
+
##run ''GRANT ALL PRIVILEGES ON webtreesDB.* TO 'webtrees'@'localhost' IDENTIFIED BY 'webtreespassword';''
###run ''FLUSH PRIVILEGES;''
+
##run ''FLUSH PRIVILEGES;''
###run ''exit''
+
##run ''exit''
#Setup an [https://httpd.apache.org/ Apache2] webserver
+
=Setup an [https://httpd.apache.org/ Apache2] webserver=
##run ''sudo apt install apache2''
+
#run ''sudo apt install apache2''
##check http://<containername>/ and you should see the default Apache2 server page
+
#check http://<containername>/ and you should see the default Apache2 server page
#Setup [https://www.php.net/ PHP]7
+
=Setup [https://www.php.net/ PHP]7=
##run ''sudo apt install php libapache2-mod-php php-mysql php-apcu php-xml php-gd''
+
#run ''sudo apt install php libapache2-mod-php php-mysql php-apcu php-xml php-gd''
##run ''systemctl restart apache2''
+
#run ''systemctl restart apache2''
##run ''sudo nano /var/www/html/info.php'' and type the following in.  The save and exit nano.
+
#run ''sudo nano /var/www/html/info.php'' and type the following in.  The save and exit nano.
 
  <nowiki><?php
 
  <nowiki><?php
 
phpinfo();
 
phpinfo();
 
?></nowiki>
 
?></nowiki>
##go to ''http://<containername>/info.php and you should see the default PHP info page
+
#go to ''http://<containername>/info.php and you should see the default PHP info page
##run ''sudo rm /var/www/html/info.php
+
#run ''sudo rm /var/www/html/info.php
#Setup webtrees
+
=Setup webtrees=
##run ''cd /var/www/html''
+
#run ''cd /var/www/html''
##run ''sudo wget https://github.com/fisharebest/webtrees/releases/download/1.7.13/webtrees-1.7.13.zip''
+
#run ''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
+
#*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
##run ''sudo unzip webtrees-1.7.13.zip''
+
#run ''sudo unzip webtrees-1.7.13.zip''
##run ''sudo rm webtrees-1.7.13.zip''
+
#run ''sudo rm webtrees-1.7.13.zip''
##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 ''webtreespassword'' as the password
+
##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 "Conan the Barbarian Family Tree"
+
##Create a new family tree named something like "Conan the Barbarian Family Tree"
###Give it a short name like "conan"
+
##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 "Show list of family trees" is set to ''yes'' if you think you'll ever have more than one family tree on your page.
+
###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''
###*'''from''' ''define('WT_BASE_URL', $base_uri);''
+
##*'''from''' ''define('WT_BASE_URL', $base_uri);''
###*'''to''' ''define('WT_BASE_URL', 'https://mypublicdomain.com/webtrees/');''
+
##*'''to''' ''define('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)
+
#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 do the following
+
#If you want to put an htpasswd based password on the front of the site then do the following
###run ''sudo htpasswd -c /etc/apache2/.webtrees_htpasswd username''
+
##run ''sudo htpasswd -c /etc/apache2/.webtrees_htpasswd username''
##add the following to ''/etc/apache2/sites-enabled/000-default.conf''
+
#add the following to ''/etc/apache2/sites-enabled/000-default.conf''
 
  <nowiki>Redirect permanent /webtrees https://steamforge.net/webtrees</nowiki>
 
  <nowiki>Redirect permanent /webtrees https://steamforge.net/webtrees</nowiki>
##add the following to ''/etc/apache2/sites-enabled/000-default-ssl.conf'' (leave off the first block about Authentication if you didn't create ''.webtrees_htpasswd'')
+
#add the following to ''/etc/apache2/sites-enabled/000-default-ssl.conf'' (leave off the first block about Authentication if you didn't create ''.webtrees_htpasswd'')
 
  <nowiki>#webtrees
 
  <nowiki>#webtrees
        <Location /webtrees>
+
<Location /webtrees>
            AuthType Basic
+
    AuthType Basic
            AuthName "Enter username/password to access webtrees"
+
    AuthName "Enter username/password to access webtrees"
            AuthBasicProvider file
+
    AuthBasicProvider file
            AuthUserFile "/etc/apache2/.webtrees_htpasswd"
+
    AuthUserFile "/etc/apache2/.webtrees_htpasswd"
            Require valid-user
+
    Require valid-user
  
            ProxyPreserveHost On
+
    ProxyPreserveHost On
            ProxyPass http://containername/webtrees
+
    ProxyPass http://containername/webtrees
            ProxyPassReverse http://containername/webtrees
+
    ProxyPassReverse http://containername/webtrees
        </Location></nowiki>
+
</Location></nowiki>

Revision as of 20:01, 21 April 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

Setup the Container

  1. Using the Proxmox web interface, create a new Container using the Debian 9 template.
  2. Log into the container, with the root account, using the Proxmox web console
  3. Update, Upgrade, and Install a few packages
    1. run apt update
    2. run apt upgrade
    3. run apt install sudo unzip
  4. Update the timezone
    1. run 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
  5. Add a user and give them sudo access
    1. useradd admin
    2. usermod -aG sudo admin
  6. Exit the web console and ssh in as the admin user

Setup a MariaDB database

  1. install the necessary packages, secure the installation, and log into the mysql database
    1. run sudo apt install mariadb-server mariadb-client
    2. run sudo mysql_secure_installation
      1. The current root password is blank
      2. Create a new root password
      3. Answer Yes to all questions
    3. run sudo mysql to login as root
  2. Create a database and user for webtrees
    1. run CREATE DATABASE webtreesDB;
    2. run GRANT ALL PRIVILEGES ON webtreesDB.* TO 'webtrees'@'localhost' IDENTIFIED BY 'webtreespassword';
    3. run FLUSH PRIVILEGES;
    4. run exit

Setup an Apache2 webserver

  1. run sudo apt install apache2
  2. check http://<containername>/ and you should see the default Apache2 server page

Setup PHP7

  1. run sudo apt install php libapache2-mod-php php-mysql php-apcu php-xml php-gd
  2. run systemctl restart apache2
  3. run sudo nano /var/www/html/info.php and type the following in. The save and exit nano.
<?php
phpinfo();
?>
  1. go to http://<containername>/info.php and you should see the default PHP info page
  2. run sudo rm /var/www/html/info.php

Setup webtrees

  1. run cd /var/www/html
  2. run sudo wget https://github.com/fisharebest/webtrees/releases/download/1.7.13/webtrees-1.7.13.zip
  3. run sudo unzip webtrees-1.7.13.zip
  4. run sudo rm webtrees-1.7.13.zip
  5. visit http://containername/webtrees/ to finish the setup
    1. fix any server configuration or server capacity problems (there shouldn't be any if the above packages were installed)
    2. for the database login info enter webtrees as the user and webtreespassword as the password
    3. for the database name enter webtreesDB
    4. 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
    5. Enter your name, select a username, select a password, and select an email for the next sections.
    6. Sign in to Webtrees using the username and password you just picked out
    7. Create a new family tree named something like "Conan the Barbarian Family Tree"
    8. Give it a short name like "conan"
    9. Under Website preferences
      1. Select America/New_York (or whatever your location is) for the timezone
      2. 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.
    10. Under Sign-in and registration
      1. 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)
      2. Set Show acceptable use agreement on "Request a new user account" page to no (or whatever you want)
    11. Under Languages
      1. uncheck any languages you don't want to support
      2. check any extra languages you do want to support

Setup the Reverse Proxy

  1. On your webtrees container modify line 173 of /var/www/html/webtrees/includes/sessions.php
  2. Log into your Reverse Proxy machine/container (assumed to be on Debian 9 with permanent redirects from http to https)
  3. If you want to put an htpasswd based password on the front of the site then do the following
    1. run sudo htpasswd -c /etc/apache2/.webtrees_htpasswd username
  4. add the following to /etc/apache2/sites-enabled/000-default.conf
Redirect permanent /webtrees https://steamforge.net/webtrees
  1. add the following to /etc/apache2/sites-enabled/000-default-ssl.conf (leave off the first block about Authentication if you didn't create .webtrees_htpasswd)
#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>