Skip to content

Installation (0.8.x legacy)

Jeff Buchbinder edited this page Apr 7, 2014 · 1 revision

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

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 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
apt-get update
apt-get -y install subversion mysql-{client,server}-5.1 php5-mysql \
        apache2 libapache2-mod-php5 libxml-parser-perl libtext-iconv-perl \
        djvulibre-bin netpbm graphicsmagick-imagemagick-compat \
        cups-common cups-client gs-common php5-cgi php5-gd php5-curl \
        xpdf-utils bzip2 pdfjam php5-cli gs dcmtk gettext \
        texinfo openjdk-6-jdk ant msttcorefonts make

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.

##### Remove Suhosin -- if you don't do this, don't complain that stuff breaks ...
apt-get --purge remove php5-suhosin

cd /usr/share/
git clone git://github.com/freemed/freemed-0.8.x.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 . )
  • Enable PHP5 for Apache 2.x
/usr/sbin/a2enmod php5
  • 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
  • Now configure FreeMED to use those
cd /usr/share/freemed
vi lib/settings.php
  • Change
define ('DB_USER', "root");

to

define ('DB_USER', "user you set in GRANT");

and change

define ('DB_PASSWORD', ""); 

to

define ('DB_PASSWORD', "password you set in GRANT"); 
  • Browse to localhost with your browser:
http://localhost/freemed/
  • Enter the mysql password and choose the FreeMED admin password and verify it.

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
wget -c http://www.debiantutorials.com/static/eaccelerator-0.9.6.1.tar.bz2
tar jxvf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1
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

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