Cookies help us deliver our services. By using our services, you agree to our use of cookies.
Views

Difference between revisions of "Linux (Ubuntu) Installation - Supporting Software - 16.04"

From IHRIS Wiki

Jump to: navigation, search
(Installing Pear and PECL Packages)
Line 1: Line 1:
This document describes the needed installation and configuration of supporting software for iHRIS on Ubuntu 14.04 LTS, Trusty Tahr.
+
This document describes the needed installation and configuration of supporting software for iHRIS on Ubuntu 16.04 LTS, Xenial Xerus.
 +
'''This will only work with iHRIS 4.3 or greater''' (or additional local changes).  iHRIS 4.3 is currently available for testing and should not be used in production yet.
 +
 
 
{{otherversions|Linux (Ubuntu) Installation - Supporting Software}}
 
{{otherversions|Linux (Ubuntu) Installation - Supporting Software}}
 
== Getting Ready ==
 
== Getting Ready ==
Line 21: Line 23:
 
'''Important''': Make sure your email system is correctly configured.  Under a default Ubuntu installation, you can do this with one of two commands:
 
'''Important''': Make sure your email system is correctly configured.  Under a default Ubuntu installation, you can do this with one of two commands:
 
<source lang="bash">
 
<source lang="bash">
sudo apt-get install postfix
+
sudo apt install postfix
 
sudo dpkg-reconfigure postfix
 
sudo dpkg-reconfigure postfix
 
</source>
 
</source>
Line 39: Line 41:
 
</source>
 
</source>
  
Open /etc/mysql/my.cnf and set the sql-mode variable.
+
Create /etc/mysql/mysql.conf.d/sql-mode.cnf and set the sql-mode variable.
 
<source lang="bash">
 
<source lang="bash">
sudo gedit /etc/mysql/my.cnf
+
sudo gedit /etc/mysql/mysql.conf.d/sql-mode.cnf
 
</source>
 
</source>
Add below line under [mysqld] in Basic Settings:
+
 
 
<source lang="ini">
 
<source lang="ini">
 +
[mysqld]
 
sql-mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
 
sql-mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
 
</source>
 
</source>
Line 58: Line 61:
 
</source>
 
</source>
  
== Installing Pear and PECL Packages ==
+
Now restart mysql so these changes take affect.
 +
<source lang="bash">
 +
sudo service mysql restart
 +
</source>
 +
 
 +
== Installing PHP Packages ==
  
 
We need to install a few Pear and PECL packages for PHP.  For the Pear packages you can do:
 
We need to install a few Pear and PECL packages for PHP.  For the Pear packages you can do:
 
<source lang="bash">
 
<source lang="bash">
sudo apt-get install php-pear php-mdb2 php-mdb2-driver-mysql  php7.0-gd php7.0-tidy php7.0-intl php7.0-bcmath
+
sudo apt install php-pear php-gd php-tidy php-intl php-bcmath php-text-password php-mbstring
sudo pear install text_password
 
</source>
 
If the command for installing text_password, does not work for you <br> Download and Install the [http://www.ubuntuupdates.org/package/core/precise/universe/base/php-text-password package] manually as follows:
 
<source lang="bash">
 
cd /tmp
 
wget http://security.ubuntu.com/ubuntu/pool/universe/p/php-text-password/php-text-password_1.1.1-1_all.deb
 
</source>
 
Install the deb
 
<source lang="bash">
 
sudo dpkg -i php-text-password_1.1.1-1_all.deb
 
</source>
 
NB:
 
At the end of the installation,if you have login issues,check to insure that you are running MDB2-2.5.0b5 and MDB2_Driver_mysqli-1.5.0b4 or above. If you have older version,run below commands to upgrade.
 
<source lang="bash">
 
sudo pear uninstall MDB2_Driver_mysqli
 
sudo pear uninstall mdb2
 
sudo pear install MDB2-2.5.0b5
 
sudo pear install MDB2_Driver_mysqli-1.5.0b4
 
 
</source>
 
</source>
  
==UUID==
+
===UUID===
 
We need to install the UUID module for PHP.  We need to install from PECL.  This can be done by first installing the php5-dev package and the uuid packages.
 
We need to install the UUID module for PHP.  We need to install from PECL.  This can be done by first installing the php5-dev package and the uuid packages.
 
<source lang='bash'>
 
<source lang='bash'>
sudo apt-get install php7.0-dev libpcre3-dev uuid uuid-dev
+
sudo apt install php-uuid
</source>
 
Now install UUID from PECL:
 
<source lang='bash'>
 
sudo pecl install uuid
 
 
</source>
 
</source>
<!--It will ask a few questions and you can just press enter to take the default answers.<br> -->
 
  
 
We'll also need to create the ini file to load UUID into PHP.
 
We'll also need to create the ini file to load UUID into PHP.
Line 111: Line 96:
  
  
==Multibyte String==
+
===APCu===
Multibyte character encoding schemes were developed to express more than 256 characters in the regular bytewise coding system.
 
 
 
*mbstring* provides multibyte specific string functions that help you deal with multibyte encodings in PHP. In addition to that, mbstring handles character encoding conversion between the possible encoding pairs. mbstring is designed to handle Unicode-based encodings such as UTF-8 and UCS-2 and many single-byte encodings
 
 
 
In PHP 7 mbstring is a non-default extension. This means it is not enabled by default. For this case you need to install it manually and configure it.
 
 
 
To install mbstring, run this command
 
 
 
<source lang='bash'>
 
sudo apt-get install php7.0-mbstring
 
</source>
 
 
 
Then make sure you have this file /etc/php/7.0/mods-available/mbstring.ini. If it is not there you need to create it.
 
 
 
<source lang='bash'>
 
sudo pico /etc/php/7.0/mods-available/mbstring.ini
 
</source>
 
 
 
and make sure it has this content
 
 
 
<source lang="ini">
 
extension=mbstring.so
 
</source>
 
 
 
and then symlink it to make it available to apache2 and PHP CLI.
 
 
 
<source lang="bash">
 
sudo ln -s  /etc/php/7.0/mods-available/mbstring.ini  /etc/php/7.0/apache2/conf.d/20-mbstring.ini
 
 
 
sudo ln -s  /etc/php/7.0/mods-available/mbstring.ini  /etc/php/7.0/cli/conf.d/20-mbstring.ini
 
</source>
 
 
 
 
 
==APCu==
 
 
To install APCu you need to run this command:  
 
To install APCu you need to run this command:  
 
<source lang='bash'>
 
<source lang='bash'>
 
sudo apt install php-apcu
 
sudo apt install php-apcu
 
</source>
 
</source>
 
  
  
 
During certain activities like installation and upgrades you may need more memory than APC uses by default.  We also want to turn off the ''slam defense.''  We need to edit the configuration file file for apcu:
 
During certain activities like installation and upgrades you may need more memory than APC uses by default.  We also want to turn off the ''slam defense.''  We need to edit the configuration file file for apcu:
 
<source lang="bash">
 
<source lang="bash">
sudo pico /etc/php/7.0/mods-available/apcu.ini
+
sudo gedit /etc/php/7.0/mods-available/apcu.ini
 
</source>
 
</source>
 
It should look like this:
 
It should look like this:
Line 168: Line 118:
 
See [http://pecl.php.net/bugs/bug.php?id=16843 slam defense] and [http://t3.dotgnu.info/blog/php/user-cache-timebomb this].
 
See [http://pecl.php.net/bugs/bug.php?id=16843 slam defense] and [http://t3.dotgnu.info/blog/php/user-cache-timebomb this].
  
We'll also need to enable this for Apache and CLI by creating 2 symlinks for the apcu file:
 
  
 +
 +
====Debian Squeeze====
 +
If you are using Debian Squeeze, then the value of ''apc.shm_size'' should be:
 
<source lang='bash'>
 
<source lang='bash'>
sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/apache2/conf.d/20-apcu.ini
+
apc.shm_size=100
sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/cli/conf.d/20-apcu.ini
 
 
</source>
 
</source>
  
You'll need to restart Apache after making this change.
+
===Install Memcached===
<source lang="bash">
+
 
sudo /etc/init.d/apache2 restart
+
With version 4.0.4 and greater of iHRIS you can use memcached to improve performance
</source>
+
 
 +
Note:  Memcached is used to cache data from the database.  Thus if you are an a sitaution
 +
where you would need to restart the webserver by
 +
sudo service apache2 restart
 +
you should now do
 +
sudo service apache2 restart && sudo service memcached restart
  
===Debian Squeeze===
+
To install, simply do
If you are using Debian Squeeze, then the value of ''apc.shm_size'' should be:
 
 
<source lang='bash'>
 
<source lang='bash'>
apc.shm_size=100
+
sudo apt install php-memcached memcached
 
</source>
 
</source>
 +
 
===Set ZendOpcache options===
 
===Set ZendOpcache options===
 
Edit the opcache config file with this command:
 
Edit the opcache config file with this command:
Line 240: Line 196:
 
Save and quit.
 
Save and quit.
  
===Restart Apache===
 
Let us restart the Apache webserver using:
 
<source lang="bash">
 
sudo service apache2 restart
 
</source>
 
  
==Install Memcached==
 
  
With version 4.0.4 and greater of iHRIS you can use memcached to improve performance
 
  
Note:  Memcached is used to cache data from the database.  Thus if you are an a sitaution
+
==Restart Apache==
where you would need to restart the webserver by
+
You'll need to restart Apache after making these changes.
sudo service apache2 restart
+
<source lang="bash">
you should now do
+
sudo service apache2 restart
sudo service apache2 restart && sudo service memcached restart
 
 
 
To install,  simply do
 
<source lang='bash'>
 
sudo apt-get install php-memcached memcached
 
 
</source>
 
</source>

Revision as of 13:13, 22 September 2017

This document describes the needed installation and configuration of supporting software for iHRIS on Ubuntu 16.04 LTS, Xenial Xerus. This will only work with iHRIS 4.3 or greater (or additional local changes). iHRIS 4.3 is currently available for testing and should not be used in production yet.


Getting Ready

Here are instructions for installing the supporting software for iHRIS on a Linux (Ubuntu) system. If you need help installing Ubuntu you may want to take a look at these directions for installing a Server or a Desktop system. For a server setup, we recommend using a LTS (long term support) version of Ubuntu.

Note: Unless specifically mentioned, all the commands below are run using a terminal. You can start this in Ubuntu by going to Applications -> Accessories -> Terminal. Any time a command begins with sudo it will prompt for your password because this will be run with administrative privileges. When you run sudo multiple times, only the first time will ask for your password.

Note: Some installation commands will prompt for inputs in the terminal window, usually with a blue background. The mouse doesn't work to click on options here. You can use Tab to move between options and the space bar to check or uncheck selections.

Note: Some commands will launch the gedit file editor. Look at the documentation if you need additional help.

We begin by install a Lamp server (You can find more help here):

sudo tasksel install lamp-server

If you have never used mysql on your system, you will be asked to set the 'root' password for mysql. We will refer to this password as XXXXX below.

Important: Make sure your email system is correctly configured. Under a default Ubuntu installation, you can do this with one of two commands:

sudo apt install postfix
sudo dpkg-reconfigure postfix

Follow the on-screen instructions to set up email on your system. For additional help with installing Postfix, look at these instructions. On Debian systems, the same commands can be used, but exim4 is the default MTA instead of postfix

If you are using another Linux distribution, make sure your system can send email properly before continuing.

Configuring MYSQL

Make sure you have in /etc/mysql/mysql.conf.d/mysqld.cnf the following values set:

sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf
query_cache_limit       = 4M
query_cache_size        = 64M

Create /etc/mysql/mysql.conf.d/sql-mode.cnf and set the sql-mode variable.

sudo gedit /etc/mysql/mysql.conf.d/sql-mode.cnf
[mysqld]
sql-mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

To configure MySQL so iHRIS can create needed functions:

mysql -u root -p

Enter the password you set above (XXXXX) for MySQL. You will now be able to send commands to MySQL and the prompt should always begin with 'mysql> '. Type these commands:

SET GLOBAL log_bin_trust_function_creators = 1;
exit

Now restart mysql so these changes take affect.

sudo service mysql restart

Installing PHP Packages

We need to install a few Pear and PECL packages for PHP. For the Pear packages you can do:

sudo apt install php-pear php-gd php-tidy php-intl php-bcmath php-text-password php-mbstring

UUID

We need to install the UUID module for PHP. We need to install from PECL. This can be done by first installing the php5-dev package and the uuid packages.

sudo apt install php-uuid

We'll also need to create the ini file to load UUID into PHP.

/etc/php/7.0/mods-available/uuid.ini

It should look like this:

extension=uuid.so

We'll also need to enable this for Apache and CLI by creating 2 symlinks for the uuid file:

sudo ln -s /etc/php/7.0/mods-available/uuid.ini /etc/php/7.0/apache2/conf.d/20-uuid.ini
sudo ln -s /etc/php/7.0/mods-available/uuid.ini /etc/php/7.0/cli/conf.d/20-uuid.ini


APCu

To install APCu you need to run this command:

sudo apt install php-apcu


During certain activities like installation and upgrades you may need more memory than APC uses by default. We also want to turn off the slam defense. We need to edit the configuration file file for apcu:

sudo gedit /etc/php/7.0/mods-available/apcu.ini

It should look like this:

extension=apcu.so
apc.enabled=1
apc.write_lock=1
apc.shm_size=100M
apc.slam_defense=0
apc.enable_cli=1

See slam defense and this.


Debian Squeeze

If you are using Debian Squeeze, then the value of apc.shm_size should be:

apc.shm_size=100

Install Memcached

With version 4.0.4 and greater of iHRIS you can use memcached to improve performance

Note: Memcached is used to cache data from the database. Thus if you are an a sitaution where you would need to restart the webserver by

sudo service apache2 restart

you should now do

sudo service apache2 restart && sudo service memcached restart

To install, simply do

 sudo apt install php-memcached memcached

Set ZendOpcache options

Edit the opcache config file with this command:

sudo gedit /etc/php/7.0/mods-available/opcache.ini

It should look like this for a production system:

; configuration for php ZendOpcache module
; priority=05
zend_extension=opcache.so
opcache.memory_consumption=128M
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

For a development system you should modify revalidate_freq from 60 to 2:

opcache.revalidate_freq=2

Configuring Apache Web Server

Document Root

In Ubuntu 16.04, the default document root is /var/www/html so when installing any iHRIS applications you will need to use the new directory to place the symlinks. If you are upgrading you may or may not need to update these depending on if you replaced the Apache configuration files during the previous upgrade.

Enable Rewrite Module

You will see later we are using the apache rewrite module. To enable the module:

sudo a2enmod rewrite

Enable .htaccess Configuration

Now we need to make sure we can use the .htaccess file.

sudo gedit /etc/apache2/apache2.conf

Change:

<Directory /var/www/>
        Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>

to:

<Directory /var/www/>
	Options Indexes FollowSymLinks MultiViews
	AllowOverride All
	Require all granted
</Directory>

Save and quit.



Restart Apache

You'll need to restart Apache after making these changes.

sudo service apache2 restart