Yacht Management Software (YMS) Installation

1. Install requirements

1.1 Generic
- MariaDB
- Python 3
  - python3-bcrypt
  - python3-mysqldb
- optional 
  - gettext
  - mupdf-tools for extended pdf file management

1.2 Native GUI
- Python GTK3
  - python3-gi
  - gir1.2-gtk-3.0
  - gir-rsvg-2.0

1.3 Web GUI
- Webserver
- PHP (>= 8.0)
  - php-mysql
  - php-xml

2. Create database

Create a database for YMS on your server, as well as a MariaDB user who has
the privileges for accessing and modifying it.

  CREATE DATABASE yms;

Create system user for native gui.

  CREATE USER 'ymssys'@'localhost' IDENTIFIED BY '********';
  GRANT SELECT, INSERT, UPDATE, DELETE ON yms.* TO 'ymssys'@'localhost';

Create database-user for web application with minimum necessary rights.

  CREATE USER 'ymsweb'@'localhost' IDENTIFIED BY '********';
  GRANT SELECT, INSERT, UPDATE, DELETE ON yms.* TO 'ymsweb'@'localhost';

3. Run database import

Import the mariadb.sql file into your database, which will create the tables.

  mariadb yms < mariadb.sql

According to your desired language import minimal required dataset into your
new database. For german use

   mariadb yms < minimal.sql

or alternatively for english language

   mariadb yms < minimal_en.sql

Optional import some sample data

  mariadb yms < mariadb_sample.sql

4. Initialize document storage
Customize path and access rights to your needs

  mkdir /var/local/yms
  mkdir /var/local/yms/thumb
  chown -R www-data /var/local/yms
  chmod -R 750 /var/local/yms

To grant access for the local gui the directory has to be writeable by a special
group (here as example 'yms'). The user which runs the local gui (here
'guiuser') has also to be a member of that group as well as the webserver user
'www-data'.

  groupadd yms
  usermod -aG yms www-data
  usermod -aG yms guiuser
  chgrp yms /var/local/yms
  chgrp yms /var/local/yms/thumb
  chmod -R 770 /var/local/yms

4. Setup local GUI

Create a local database user with same name as your computer user and allow
database access with current unix credentials. E.g if your current unix user
is "ymsgui":
   mysql> CREATE USER 'ymsgui'@'localhost' IDENTIFIED VIA unix_socket;
   mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON yms.* TO 'ymsgui'@'localhost';

Execute "install.sh" to install the software to your local operating system.
This has to be done as user "root" or with "sudo".

6. Install webgui

6.1 Upload webgui files

Upload all files and directories (except the install directory) to your
webserver.
Disallow access to include files (.inc). There is an example _htaccess
file.

6.2. Create and edit webgui config file

Rename sample configfile config.inc-sample:

  mv config.inc-sample config.inc

Open config.inc in a text editor and fill in your database details.
If you want to use local unix socket connection set host = socket.

6.3. Check file access rights for security

Configfile should be readable by webserver but not writeable.

  chmod 640 config.inc
  chgrp www-data config.inc

7. Start using YMS

Use webgui:
Start your browser and login to YMS with the initial username/password:
captain/captain

Use local client:
Start "yms", the default configuration file is automatically created

Change the password for the main web user using the local GUI before
normal use.
