MasonSql Installation on Ubuntu 18_04 LTS (Bionic)

Install Packages

NOTE: Installation instructions are to be carried out with root user.

# packages needed to modules compilation

apt-get -y install cpanminus build-essential

Install Apache 2.4 version

Using mpm_event o mpm_worker we found some errors in the execution and therefore the recommended configuration is to enable mpm_prefork

apt-get -y install apache2 libapache2-request-perl
a2dismod mpm_event
a2dismod mpm_worker
a2enmod mpm_prefork

# E' necessario disabilitare i site di default di apache
a2dissite 000-default
a2dissite default-ssl

# moduli necessari
a2enmod rewrite ssl

# mod_perl
apt-get -y install libstring-diff-perl libapache2-mod-perl2 libapache2-mod-apreq2
a2enmod perl apreq2

Install PostgreSQL

sudo apt-get -y install wget ca-certificates gnupg
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" >/etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt-get update
apt-get -y upgrade
apt-get -y install postgresql-12 postgresql-client-12 postgresql-plperl-12 postgresql-contrib-12

## file /etc/postgresql/12/main/postgresql.conf
listen_addresses = '*'

## file /etc/postgresql/12/main/pg_hba.conf (copiare in alto)
# Supporto Leader.IT
host    all     all     192.168.1.202/32  md5

systemctl enable postgresql
systemctl start postgresql
cd /tmp
# Inserimento utente per attività di amministrazione del server postgres
PSQLADM=myuser
su -c "createuser --superuser --encrypted --login --pwprompt $PSQLADM" postgres

Installazione MasonSQL

  • Per il corretto funzionamento con Apache 2.4 è necessario copiare il contenuto della directory '/opt/masonsql' da una precedente installazione con Apache 2.4
  • oppure copiare i file da SVN:
apt-get -y install subversion
svn co https://www.leader.it/svn/masonsql/trunk /opt/masonsql
chown -R root.www-data /opt/masonsql
find /opt/masonsql -type f -exec chmod 640 {} \;
find /opt/masonsql -type d -exec chmod 750 {} \;
chmod 750 /opt/masonsql/bin/cronjobs
rm -r /opt/masonsql/mason/*
chmod 770 /opt/masonsql/mason /opt/masonsql/log/
  • Installare Dojo Toolkit 1.13.0 nella cartella /COPIA/dojo-release-1.13.0
  • Copiare il file mancante
cd /COPIA
cp dojo-release-1.13.0-src/themes/flat/dijit/images/loadingAnimation.gif dojo-release-1.13.0-src/dijit/themes/claro/images/loadingAnimation.gif
cp dojo-release-1.13.0/themes/flat/dijit/images/loadingAnimation.gif dojo-release-1.13.0/dijit/themes/claro/images/loadingAnimation.gif
  • Creare i link a Dojo nella cartella /opt/masonsql/htdocs/lib
    • ln -s /COPIA/dojo-release-1.13.0 /opt/masonsql/htdocs/lib/dojo-release-1.13.0
    • ln -s /COPIA/dojo-release-1.13.0 /opt/masonsql/htdocs/lib/dojo-release-1.13.0-src
  • Copiare FCKeditor nella cartella /opt/masonsql/htdocs/lib/FCKeditor
  • Creare i link a FCKeditor nella cartella /opt/masonsql/htdocs/lib
    • ln -s /COPIA/FCKeditor /opt/masonsql/htdocs/lib/FCKeditor

Copia Demo MasonSQL

  • Copiare la cartella /opt/demo_masonsql da un server Demo (ad esempio masonsql-doc4.leader.it)
# nel server sorgente
tar czf /tmp/demo_masonsql.tgz /opt/demo_masonsql --exclude 'opt/demo_masonsql/tmp/*'
# nel server di destinazione
tar xzf /tmp/demo_masonsql.tgz -C /

Certificati SSL

Configurare Lets Encript ( Vedi: LetsencryptSSL ), oppure se il sito non è raggiungibile da Internet generare un certificato Self Signed:
mkdir -p /opt/demo_masonsql/etc/ssl
cd /opt/demo_masonsql/etc/ssl
SERVER="demo_masonsql.mydomain.com"
# Private Key
openssl genrsa -des3 -out $SERVER.key 1024
# CSR (Certificate Signing Request)
# Importante indicare come "Common Name" il nome del server
openssl req -new -key $SERVER.key -out $SERVER.csr
# Togliere la passprase dalla chiave
cp $SERVER.key $SERVER.key.psw
openssl rsa -in $SERVER.key.psw -out $SERVER.key && rm $SERVER.key.psw
# Generare il certificato _Self Signed_
# Scadenza 100 anni
openssl x509 -req -days 36500 -in $SERVER.csr -signkey $SERVER.key -out $SERVER.crt

Configurazione Demo MasonSQL

  • Modificare il file /opt/demo_masonsql/etc/apache2.demo_masonsql.conf per puntare ai file dei certificati SSL e i riferimenti alle URL del nuovo server.
  • Inserire i ruoli dell'applicazione e creare il database
CREATE ROLE masonsql LOGIN
  ENCRYPTED PASSWORD 'md5638cacca5821ab9b66754ccf47724c3f'
  NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE ROLE report LOGIN
  ENCRYPTED PASSWORD 'md5763732ffc641c4eb774c9b21fd0a62f3'
  NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE DATABASE masonsql WITH ENCODING='UTF8' CONNECTION LIMIT=-1;
GRANT CONNECT, TEMPORARY ON DATABASE masonsql TO masonsql,report;
REVOKE CONNECT,TEMPORARY ON DATABASE masonsql FROM public;
  • Permessi PostgreSQL nel file /etc/postgresql/9.6/main/pg_hba.conf
# MasonSql framework
local masonsql all                                     password
host  masonsql all        127.0.0.1    255.255.255.255 password
  • Copiare il database masonsql da un server Demo (ad esempio masonsql-doc4.leader.it)
# nel server sorgente
su -c "pg_dump -c -R -S postgres masonsql" postgres | gzip >/tmp/masonsql.pg_dump.gz
# nel server di destinazione
gunzip </tmp/masonsql.pg_dump.gz | su -c 'psql masonsql' postgres

Moduli e librerie

  • Da repository
apt-get -y install libstring-diff-perl libapache2-request-perl libjson-xs-perl libjson-perl
apt-get -y install libapache-dbi-perl libstring-random-perl libdbd-pg-perl libfile-find-rule-perl
apt-get -y install libdatetime-perl liburi-perl libxml-simple-perl libdate-calc-perl
apt-get -y install libfile-mimeinfo-perl libxml-libxml-perl

  • Da CPAN
apt-get -y install cpanminus
cpanm CGI HTTP::Request::JSON DBD::Pg Mail::Sender App::cpanminus Apache2::AuthCookie SQL::Statement 
cpanm HOP::Lexer SQL::Dialects::ANSI Sys::RunAlone MIME::Parser Archive::Tar::Wrapper Archive::Zip
cpanm Perl6::Form HTTP::BrowserDetect IPC::Run::SafeHandles Captcha::reCAPTCHA XML::Simple::Sorted
cpanm ODF::lpOD DTL::Fast Image::Info HTML::Mason File::MimeInfo File::Find::Rule
cpanm Spreadsheet::WriteExcel Types::Serialiser

Libreoffice

# libreoffice
apt-get install libreoffice-writer-nogui
# Se si usano i fogli di calcolo nel formato ODS
apt-get install libreoffice-calc-nogui


# pdftk
cd /tmp
apt-get -y install openjdk-11-jre-headless
wget http://de.archive.ubuntu.com/ubuntu/pool/universe/p/pdftk-java/pdftk-java_3.0.2-2_all.deb
dpkg -i pdftk-java_3.0.2-2_all.deb
# ALTERNATIVE 
apt-get -y install pdftk-java

# Change shell and home-user used by apache2 
systemctl stop apache2
usermod --shell /bin/false --home /opt/heidix/tmp www-data
systemctl start apache2

Attivazione MasonSQL

# Creare i link per il site masonsql
ln -s /opt/demo_masonsql/etc/apache2.demo_masonsql.conf /etc/apache2/sites-available/demo_masonsql.conf

# Logs
mkdir /var/log/apache2/demo_masonsql
chown root.www-data /var/log/apache2/demo_masonsql
chmod 770 /var/log/apache2/demo_masonsql
chmod 755 /var/log/apache2

# Crontab
echo "
# MasonSQL: provvede all'invio dei messaggi email e sms dalla coda
* * * * * root [ -e /opt/masonsql/bin/cronjobs ] && /opt/masonsql/bin/cronjobs /opt/demo_masonsql/etc/apache2.demo_masonsql.conf

# demo_masonsql - cartella file temporanei
12 4  * * *     root find /opt/demo_masonsql/tmp -maxdepth 1 -mindepth 1 -mtime +7 -exec rm -r '{}' ';'
" >>/etc/crontab

# e abilitare il servizio web
a2ensite demo_masonsql

Reportman Installation

Warning!: Reportman's use is deprecated; use only for projects that already use it.

For installation, refer to deploy with Ubuntu Precise and then add the i386 libraries to Ubuntu 16.04 listed here in the /opt/masonsql/report folder:

  • libcrypto.so.0.9.8
  • libgcrypt.so.11
  • libgnutls.so.26
  • liblber-2.4.so.2
  • libldap_r-2.4.so.2
  • libpq.so.5.2
  • libpq.so (link to libpq.so.5.2)
  • libsasl2.so.2
  • libssl.so.0.9.8
  • libtasn1.so.3

Report Manager Installation on Ubuntu Precise
Topic revision: r12 - 07 Sep 2023, GuidoBrugnara
This site is powered by FoswikiCopyright (©) Leader.IT - Italy P.I. IT01434390223 Privacy policy & use of cookies