Page 1 of 6

Install TNG on a Synology NAS

Posted: Mon Oct 16, 2017 1:21 am
by steven
Requirements:
Synology Disk Station running DSM 6.0 or above (Manual permission instructions are included for older versions)
TNG (The Next Generation of Genealogy Sitebuilding) Version 11.0 or above.

Before installing TNG, a DYNAMIC website with a unique folder name must be created for TNG. Instructions to set up and configure the website can be found here: Create a Web Site
The instructions contain a HTML example page that can be placed in the TNG folder, temporarily, to verify connecting to the NAS using your domain name over the internet.



1 - Synology Packages Required

Web Station
phpMyAdmin (Note phpMyAdmin will automatically install MariaDB)
After installing both packages start MariaDB.
When MariaDB starts you must create a password.
The MariaDB password is the same password you will use for phpMyAdmin.

Setup a MariaDB database
Login to phpMyAdmin using the username root and your MariaDB password.
When phpMyAdmin starts you will see a screen like the one below.

Image

Select the User Account tab and the following screen appears. Then select the Add User Account option shown at the red arrow below.

Image

On the user account page enter the user name, host name and password.
The user name is the name you want to give TNG to access the database.
In his example the database name will be the same as the username.
TNG uses a user name and a password to access the database.

Image

For the Host Name select local from the pull down menu.
Enter a password you want to use for your database and re-type to confirm. You can use special characters but avoid using the following characters: ampersand, single quotes, double quotes or slashes.
This is the password TNG will use to access the database. It IS NOT the MariaDB password. You can select Generate to have phpMyAdmin create a password as well. Make sure you copy and paste or write down the password somewhere safe. You will need it to connect TNG to the database.
Check the box Create database with same name and grant all privileges.

Image

You do not need to grant the TNG user global privileges however privileges can always be changed later if you want this user to access another database.

If you want to use SSL enable it on your Disk Station. Enabling SSL on the database may prevent TNG from connecting to the database correctly.
When finished select the Go button at the lower right of the screen.

To check the new user has the correct privileges, select the home button in phpMyAdmin and select the User accounts tab.
Locate the new user you just created and select edit privileges.

The line at the top should look something like:
User account 'tngusername'@'localhost' - Database tngdatabasename
Select the database button and select edit privileges again.

Image

All boxes should be checked except the grant box, under administration. It is not necessary for TNG. It enables this user to add users and privileges without reloading the privilege tables.

Remember to select the go button if you make any changes so they are accepted.
The empty database is created and ready so Close phpMyAdmin.



2 - Extract the TNG files to your Synology DSM
Back to menu


Login to DSM and open File Station. Navigate to the new TNG folder for the website. Delete all files created for testing the internet connection, during the website setup . Then upload or copy the TNG zip file to the TNG folder. Alternately, you can enable SMB settings and MAP NAS drives directly to a MAC or PC. Using this protocol you can copy the files directly across the LAN. If you have a remote application, enable FPT or SFPT to upload files to the NAS.

Image

Right click the TNG zip file and select > Extract > Extract Here

Image

DSM will extract all files to the TNG folder with 555 permissions, for the internet, inherited from the web folder.

Image



3 - Changing File Permissions
Back to menu


A Synology NAS runs Linux but file permissions are unique due to the DSM configuration. TNG or an FTP program cannot change permissions on a Synology NAS. TNG file permissions must be changed using DSM File Station (more info can be found in the Synology Knowledge Base) or manually using SSH and a terminal emulator.

The web folder permissions are 555 for http connections and 777 for DSM administrators when Web Station is installed. DO NOT CHANGE PERMISSIONS ON THE WEB FOLDER. Changing web folder permissions may prevent web access to your website or allow access to files that should be protected.

To set global permissions on the TNG folder, open file station, navigate to and select the TNG folder then right click on properties.
Image

When the property window opens, select permissions.
Image

The window displays the permission settings which are greyed out because they are inherited from the web folder.
Click the Apply to this folder, sub-folder and files checkbox. So permissions are applied to all the TNG folders and files.
Image

Select Advanced options then click Make inherited permissions explicit
Image

Once permissions become explicit, they can be edited. Synology displays two different icons for http (internet clients).
The first icon represents the owner. Image The second icon represents users. Image

Image

Select the owner icon, then Edit. Click the Write checkbox, which gives the owner write permissions.
Then select Done.
Image

Select the users icon, then Edit. Click the Write checkbox to deselect all boxes, then check the List folders/Read data check box. This will allow users to access the website and access PHP scripts to display TNG pages.
Select Done when finished.
Image

Ensure the Apply to this folder, sub-folder and files checkbox is checked, then select Save.
Image

Experienced users, familiar with terminal emulation software and using SSH, can set permissions manually.
TNG recommends the settings below.

Use CHMOD commands to set the following permissions on these files:
chmod 666 adminlog.txt
chmod 666 config.php
chmod 666 genlog.txt
chmod 666 importconfig.php
chmod 666 logconfig.php
chmod 666 mapconfig.php
chmod 666 pedconfig.php
chmod 666 subroot.php
chmod 666 templateconfig.php
chmod 666 whatsnew.txt

Use CHMOD commands to set the following permissions on these folders:
chmod 755 photos
chmod 755 histories
chmod 755 documents
chmod 755 headstones
chmod 755 media
chmod 755 gedcom
chmod 755 gendex
chmod 755 backups

Due to the DSM permission configuration 755 may not work on these folders. If it does not work, a higher permission setting may be required.


To test your permissions return to the TNG readme file on your browser and select next twice to move to the folders page. Select the backup folder, change the name and select the rename button. If it renames the file your permissions change was successful.
You can change the name back or leave the new name and proceed with Finish the TNG installation.



4 - Finish the TNG installation
Back to menu


Your permissions are set, so use your web browser to return to the Readme instructions to complete your TNG installation. To start the TNG installation you must load your new web page in a browser. DO NOT use a Windows or MAC explorer type program and DO NOT use the Synology QuickConnect feature because it connects to DSM not your web pages. You MUST use a browser.

To run locally type your local server IP address followed by /readme.html or /tngfoldername/readme.html
So it looks something like 192.168.1.15/readme.html or 192.168.1.15/tngfoldername/readme.html
To run or check web access, start your browser and enter: http://yourdomainname/readme.html or
http://yourdomainname/tngfoldername/readme.html depending on how you setup your web access.
The TNG readme page should appear. If the page does not appear check the spelling and IP address.
If you used a web address try checking the virtual host port and make sure your firewall or router does not block access to the port.

When the TNG readme page appears select Express Installation as shown below.

Image

Item 3 - DO NOT SELECT THE SET PERMISSIONS BUTTON because this will generate an error and the correct permissions were set earlier. (TNG cannot change file permissions on a Synology DSM.)

Item 4 - You should change the folder names per the TNG recomendations.

Item 5 - Select the default language and character set from the pull down menu.

Item 6 - The database connection settings are simple if you are using MariaDB version 5 or above.

Image

Enter the DATABASE NAME you created for TNG.
Then enter the TNG database USER NAME and PASSWORD you created earlier.

Go to DSM and open the MariaDB version used for the TNG database.
Ensure the TCP/IP box is not checked, unless you need to enable remote access to the database. Checking this box allows direct access to the database from the internet.
Someone guessing you user name and password can corrupt or even destroy the database.

Image

Select the MariaDB copy icon as shown at the arrow above and paste the value in the Database Socket window in TNG. It is more secure to use a database socket than the TCP/IP port.

Select the Save and Verify Button. If you entered the information correctly TNG will display a message about the TNG connection status. If TNG does not connect, check your spelling for typos, verify the information used to create your MariaDB database and the socket path are correct.

Now there are only 3 more steps so you are nearly finished.

Image

Item 7 - Do not change the database collation unless you changed the default collation when the database was created. Select the Save and Create tables button. TNG will create all the necessary tables in the MariaDB database. TNG will display a status message when table creation is complete.

Item 8 - Create a user name and password for your access to TNG. You can use special characters but avoid using the following characters: ampersand, single quotes, double quotes or slashes. This should be different from all the other user names and passwords you have created. The first user you create will be the administrator. In the email field, enter the TNG admin email you want to use for user contact and select the Create User button. TNG should display a success status message.

Item 9 - If you like, you can enter another ID and the name for your tree. Select the Create Tree button. TNG should display a success status message.

When the installation is complete close and restart your web browser.

Enter http://www.yourdomainname or http://www.yourdomainname/tngfoldername and the TNG page should appear. Complete any additional TNG instructions.
When the TNG install is complete go to the admin home page, select setup and then the diagnostics tab.
Scroll down and check the status of each line.
If any lines show a yellow or red warning, check the warning information to determine the corrective action.
If you entered the permissions correctly you should not see any warnings.

Image

At this point you can enter people manually or import a GEDCOM.
Keep in mind if you import a very large GEDCOM it may take a while.
My GEDCOM is 80.86GB and it takes about twenty minutes to import.
TNG has a progress bar which works great in version 11.0.2 on the Synology DSM unless you are using SSL.

If you have questions about your TNG software contact TNG or check the TNG WIKI pages for help and information.

If you have technical questions about your Synology DSM contact Synology Tech Support or check the Synology Forums for help and additional information.

Back to menu

Re: Install TNG on a Synology NAS

Posted: Mon Apr 09, 2018 1:27 pm
by Paul Barrett
There seems to be a conundrum with permissions.

After some experimentation it seems TNG won't install unless it has Full Control (i.e. incl admin rights) to certain folders, while phpMyAdmin throws a hissy fit and won't let you in if certain permissions aren't locked down to read only. These are incompatible views. I think the solution may be to flush full control down through the TNG folders whilst limiting the phpMyAdmin folder to read only. But with permissions being inherited from the \web root, it is not immediately apparent how to do this

Re: Install TNG on a Synology NAS

Posted: Mon Apr 09, 2018 2:55 pm
by steven
DO NOT change permissions on the web folder. Additionally the TNG folder should never use inherited permissions from the web folder. So you should make inherited permissions explicit on the TNG folder and sub-folders. However, media folders inside the TNG folder can use inherited permissions. Using this permission structure phpMyAdmin is left as is and you are only working on the TNG folder and it’s sub-folders.

To change inherited permissions on the TNG parent login to DSM and select File Station. Navigate to the web folder then right click the TNG folder and select properties. Select the permissions tab and check the Apply to this folder, sub-folders and files box. Then the advanced tab and select the make inherited permissions explicit line. Then give all read and write rights to http. Then select administrators and select all rights for this group.

Re: Install TNG on a Synology NAS

Posted: Tue Apr 10, 2018 12:58 pm
by Paul Barrett
Steve wrote: Mon Apr 09, 2018 2:55 pm Then select the permission inspector and give read and write rights to system, http and users. Do not grant delete rights to these groups. Then give all rights to administrators.
Just to the web root folder? If I cascade these permissions down, we'll be back to inherited permissions?

Re: Install TNG on a Synology NAS

Posted: Tue Apr 10, 2018 3:09 pm
by steven
DO NOT change permissions on the web folder. Additionally the TNG folder should never inherit permissions from the web folder. So you should remove inherited permissions from the TNG folder. However, media folders inside the TNG folder can use inherited permissions. Using this permission structure phpMyAdmin is left as is and you are only working on the TNG folder and it’s sub-folders.
Change permissions on the TNG folder. Do not change permissions on the web folder.

Re: Install TNG on a Synology NAS

Posted: Wed Apr 11, 2018 2:51 am
by Paul Barrett
OK.

I found that Permissions Inspector would not let me apply any permissions. To set the correct permissions for TNG, I had to go to Advanced Options and select the option to Exclude Inherited Permissions, then create the permissions in the normal way.

Re: Install TNG on a Synology NAS

Posted: Wed Apr 11, 2018 9:07 am
by steven
This is the reason I use the chmod command to change permissions instead of DSM. Since the latest upgrade I started using DSM to change permissions. When you create a new folder inside the web folder, using File Station, permissions are automatically inherited. The inherited permissions give administrators full control and http read/write but the remaining groups and users have no permissions. These settings may not work for some programs, although I have not found one yet. This is why I included a link to Synology for setting permissions using DSM. When you manually set permissions using chmod, it overrides the Synology settings.

Users should be careful when changing permissions they are unsure about. Incorrect entries can disable web station, phpMyAdmin or programs located in the web folder..

Re: Install TNG on a Synology NAS

Posted: Wed Apr 11, 2018 11:18 am
by Paul Barrett
Understood.

I'm uncomfortable with CLI solutions though - they are not for the faint-hearted or the relative novice. Like me. I could do untold damage with the best of intentions. So, whilst it may be more limiting, I prefer the constraints of DSM and the relative protections it provides. :)

Re: Install TNG on a Synology NAS

Posted: Mon Nov 26, 2018 1:34 pm
by Paul Barrett
I am attempting a new, non wordpress, TNG installation.

I have followed the permissions in File Station process, but when I run the TNG installation I fall at step 3 with this error:

Snag_234e20b.png
Snag_234e20b.png (39.29 KiB) Viewed 871327 times
Any suggestions please? Shall I use PuTTY

Re: Install TNG on a Synology NAS

Posted: Mon Nov 26, 2018 6:36 pm
by Paul Barrett
It turns out that message was sourious. I ignored it an carried on and all the subsequent steps worked.

But the site would not run. Error 403

I repeated the installation. No dice.

On a hunch, i changed the php version back to php5.6

It worked. The site could now be accessed.

Then I went back into Web Station and reset php to php7.0

And the site continues to work

Snag_34bd712.png
Snag_34bd712.png (37.91 KiB) Viewed 871325 times