Skip to content
R3DDY97 edited this page Feb 4, 2018 · 44 revisions

This installation procedure documentation assumes intended installation of the 0.9.x series of FreeMED on Debian "9", and assumes a working base install of the Debian "9" distribution.


Note: For those adventurous types, there's a Docker image repository for FreeMED located at https://github.com/freemed/freemed-docker


Become root with the following command:

su

and enter your password.

Now enter:

visudo

Add the following line to the end of the file:

your_username_on_your_Debian_installation ALL=(ALL) NOPASSWD: ALL

To save these changes, click on CTRL-O (that is the letter O) and save it to the /etc/sudoers file. (not the /etc/sudoers.tmp file) It will tell you that the file exists. Click to overwrite it. Click on CTRL-X to exit

Install Debian packages for FreeMED

  • Get basic FreeMED dependencies.
  • Make sure that contrib non-free is added to your apt sources in /etc/apt/sources.list
  • Make sure that you have adequate RAM to install the dependencies. If you do not have adequate RAM available, the configuration of the downloaded dependencies will fail. You will need more that 356 MB of RAM.
sudo -s
# Install debian packages
apt-get update
apt-get -y install git mysql-{client,server}-5.7 php7.1-mysql \
        apache2 libapache2-mod-php7.1 libxml-parser-perl libtext-iconv-perl \
        djvulibre-bin netpbm graphicsmagick-imagemagick-compat \
        cups-common cups-client oracle-java9-installer php7.1-cgi php7.1-gd php7.1-curl \
        poppler-utils bzip2  php7.1-cli ghostscript dcmtk gettext \
        texinfo ant ttf-mscorefonts-installer make
# Install gradle
( cd /usr/lib ; wget -c https://services.gradle.org/distributions/gradle-4.5-bin.zip ; unzip gradle-4.5-bin.zip )

During the configuration of these downloaded files, you will be asked to set a root password for mysql on three occasions. Leave the password blank at these times.

cd /usr/share/
git clone git://github.com/freemed/freemed.git
git clone git://github.com/freemed/remitt.git
chown -Rf www-data:www-data freemed
( cd /etc/apache2/conf.d; ln -s /usr/share/freemed/doc/freemed.apache.conf . )
  • Build translations :
( cd /usr/share/freemed/locale; sudo make )
  • Enable PHP7.1 for Apache 2.x
/usr/sbin/a2enmod php7.1
  • In recent version of MySQL, "LOAD DATA INFILE" is disabled by default. Edit your /etc/mysql/my.cnf file and add local-infile to the [mysql] and [mysqld] sections.
  • Restart Apache
/etc/init.d/apache2 restart
  • As a regular user (not root) type:
mysql -uroot
  • When you get to the MySQL prompt, type:
mysql> CREATE DATABASE IF NOT EXISTS freemed;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> GRANT ALL ON freemed.* TO arbitrary_user_name@localhost IDENTIFIED BY 'your_database_password' WITH GRANT OPTION;
Query OK, 0 rows affected (0.03 sec)

mysql> GRANT SUPER ON *.* TO arbitrary_user_name@localhost;
Query OK, 0 rows affected (0.03 sec)
 
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.03 sec)
 
mysql> exit
  • Run
sudo -s
sudo apt-get install maven
cd /usr/share/freemed/
./scripts/configure-settings.php
(When you run this script it will ask you for your FreeMED Installation name.  The name can be anything
that you wish to display.  The name can be more than one word and there can be empty spaces between the
words.
You will also be asked for the mysql host name.  Typically this is 127.0.0.1)
./scripts/install.php
mkdir -p data/cache && chown www-data data/cache -Rf
cd ui/gwt && make

from the FreeMED install directory.

  • Browse to localhost with your browser:
http://localhost/freemed/
  • Enter the administrator username and password.

Installing the mmcache

Without the memory map cache, FreeMED can be very slow when a large number of users are working on it. You can use eaccelerator (instructions below), or install the php5-xcache package, which does much of the same thing, except that it is maintained by a Debian package.

If you get an error like "Cannot access protected property", you are using an old version of eaccelerator, which won't work with FreeMED. Use the latest bleeding edge version or patched version, following the instructions below.

  • As a regular user:
sudo apt-get -y install php5-dev re2c
git clone https://github.com/NewEraCracker/eaccelerator
cd eaccelerator
phpize5 && ./configure --with-eaccelerator-userid=www-data && make all
D=$( sudo make install | grep Install | cut -d/ -f5 )
perl -pi -e 's/httpd/apache2/' eaccelerator.ini
perl -pi -e "s/php4/php5\/$D/" eaccelerator.ini
sudo cp -v eaccelerator.ini /etc/php5/apache2/conf.d/
sudo /etc/init.d/apache2 reload

rlib Build and Install

rlib is a reporting engine used for complex reporting. Many of the reports based on it have been phased out in favor of the JasperReports engine, but this information is provided for those who still wish to use that reporting format. It is not available currently in the Debian repository. The upstream version is available from http://rlib.sicompos.com/

It needs to be patched to appropriately support stored procedure results.

Build and install with:

sudo apt-get -y install libmysqlclient15-dev php5-dev libxml2-dev libglib2.0-dev pkg-config libgd2-noxpm-dev
wget -c http://downloads.sourceforge.net/rlib/rlib-1.3.7.tar.gz
wget -c --no-check-certificate https://gist.githubusercontent.com/jbuchbinder/4035502/raw/e2ce39da942ca5aee36d06c801b0933424889db0/rlib-1.3.7-storedprocedure.diff -O rlib-1.3.7-storedprocedure.diff
tar zxvf rlib-1.3.7.tar.gz
cd rlib-1.3.7
patch -p1 < ../rlib-1.3.7-storedprocedure.diff
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-python
make all && sudo make install

''Please note that it may need to be rebuilt upon upgrade of your version of PHP.''

gsdjvu Build and Install

gsdjvu is the specialized version of Ghostscript which djvulibre requires to be able to perform separations. Without it, it is not possible to encode Djvu pages with any kind of efficiency. Due to its strange terms of licensing, we cannot bundle or prepackage it, but instead provide an installation script to build and install it.

sudo apt-get install build-essential libjpeg62-dev libpng12-dev zlib1g-dev
sudo /usr/share/freemed/scripts/build_gsdjvu.sh

The djvudigital wrapper script used to be included in djvulibre-bin, but is not for some reason. You can install it from the FreeMED scripts directory once gsdjvu is installed:

cd /usr/share/freemed/
sudo cp -v scripts/fax_import/djvudigital /usr/bin/
sudo chmod a+x /usr/bin/djvudigital

Allow ssh access to your FreeMED server only with RSA/DSA keys. Disable password login.

  • Generate the RSA/DSA keys on your system
  • Copy your RSA/DSA public keys to the FreeMED server with the following commands:
  ssh-copy-id -i ~/.ssh/id_rsa.pub username_on_the_FreeMED_server@IP_address_of_the_FreeMED_server
  ssh-copy-id -i ~/.ssh/id_dsa.pub username_on_the_FreeMED_server@IP_address_of_the_FreeMED_server
  • SSH into the FreeMED server as a normal user.
  • Lock down access by SSH to only work via RSA/DSA key, by editing the /etc/ssh/sshd_config file:
sudo vi /etc/ssh/sshd_config

  • Edit this file so that it contains:
   RSAAuthentication yes
   PasswordAuthentication no

  • Reload the sshd server configuration by issuing:
sudo killall -HUP sshd

Using CD/RW Backup Module

sudo access needs to be granted to the cdrecord binary, otherwise www-data doesn't have permission to read the drive information for cdrecord.

Edit the /etc/sudoers file:

sudo vi /etc/sudoers

Add the following to the /etc/sudoers file:

%www-data    ALL=NOPASSWD:/usr/bin/cdrecord

Enabling Apache2 + SSL Support

See documentation at : Setting up Apache + mod_ssl

Building GWT Interface

The GWT interface has to be built if the FreeMED copy is from Subversion, as the compiled pieces are not in Subversion.

Building REMITT

cd /usr/share/remitt
/usr/lib/gradle-2.2.1/bin/gradle war