Software Collections

From SME Server
Revision as of 00:18, 29 December 2014 by RequestedDeletion (talk | contribs) (remove WIP box)
Jump to navigationJump to search
Important.png Note:
Software Collections is only available for SME Server 9.x 64-bit


Is this article helpful to you?
Please consider donating or volunteering
Thank you!

About

For certain applications, more recent versions of some software components are often needed in order to use their latest new features. Software Collections provides a set of dynamic programming languages, database servers, and various related packages that are either more recent than their equivalent versions included in the base SME Server 9.x system.


Installation

One must enable the scl repository. See the Software Collections scl repository page on how to enable this repository.


After enabling the scl repo, the scl packages can be installed by issuing the following command:

yum install scl-utils

Installation of a collection

All Software Collections of Red Hat are browsable : https://www.softwarecollections.org/en/scls/ and available : https://www.softwarecollections.org/repos/rhscl/

You have to enable the correct repository for example scl-php55 or scl-php54

yum list available \* --disablerepo=* --enablerepo=scl-php54


and to install a collection: (example)

 yum install php54 --enablerepo=scl-php54

An overview of installed collections one can use:

scl -l

Collections will be installed in:

/opt/rh

as defined by the collection packager and noted here:

/etc/scl/prefixes

The one that build the software collection (called a provider) can tag his collections with a provider name. In the above case in '/opt/rh', the provider is Redhat. For SME Server this could be '/opt/sme' or personal collections e.g. '/opt/stephdl'

The /opt is the highly recommended installation location. However, in the case of SME Server, considerations to install in a different location could be considered regarding default backups etc. e.g. '/home/e-smith/files/scl/sme'.


Usage of collections

All below TBA

Running an Executable from a Software Collection

Running a Shell Session with a Software Collection as Default

Running a System Service from a Software Collection

Migrate from stock application stack to a collection

Examples
run php54 on a hosted website (virtual host)

Install php54 from scl repo

yum --enablerepo=scl-php54 install php54-php.x86_64  

Verify the installation,

 scl enable php54 'php -v' 

It should return this version (or higher)

PHP 5.4.16 (cli) (built: Jul 10 2014 10:06:38)

Create a template fragment that will enable apache to invoke php54 for a virtual domain

nano /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/70php54

paste this code fragment (including the last empty line):

{ 
  use esmith::DomainsDB;
  my $domains = esmith::DomainsDB->open_ro;
	if (($domains->get_prop($virtualHost, 'php54') || 'disabled')
         eq 'enabled')
		{
				$OUT = "    #Enable php54 through Cgi-Bin wrapper. Needs a wrapper script in /cgi-bin/php54-wrapper\n";
				$OUT .= "    AddHandler php-cgi .php\n";
				$OUT .= "    Action php-cgi /cgi-bin/php54-wrapper\n";
				$OUT .= "    <Location />\n";
				$OUT .= "       Options +ExecCGI\n";
				$OUT .= "    </Location>\n";
		}
 }

and Save with <CTRL>-X - yes.

Create the cgi-wrapper script:

nano ~<Ibayname of MyVirtualDomain>/../cgi-bin/php54-wrapper

Insert this code fragment:

#!/bin/bash
source /opt/rh/php54/enable
exec php-cgi

and Save with <CTRL>-X - yes.

Then execute these commands:

cd ~<Ibayname of MyVirtualDomain>/../cgi-bin/
restorecon -RF php54-wrapper
chown www:www php54-wrapper
chmod ugo-rwx php54-wrapper
chmod ug+rx php54-wrapper

The template fragment for httpd.conf needs a database setting to be enabled for the (virtual) domain.

Check with

db domains show <myVirtualDomain.com>

Edit with

db domains setprop <myVirtualDomain.com> php54 enabled

To enable this run:

expand-template /etc/httpd/conf/httpd.conf
/etc/init.d/httpd-e-smith restart

Notes:

  • This version of php uses the /opt/rh/php54/root/etc/php.ini file which uses default settings as configured by RedHat, use at your own risk. Adjust the settings according to your (security) needs.
  • Using Cgi-Bin wrapper scripts makes your system vulnerable to Shellshock server bash vulnerability, make sure your server runs the latest version of bash.
  • This example and code still have to be tested (I will soon).
  • Source: This HowTo for CENTOS6

Building your own software collections

Please consider building your collection on non production systems only. For a full reference please refer to the developers manual here.


To be able to build your own software collection, an extra scl package has to be installed:

yum install scl-utils-build --enablerepo=scl


References

  1. Software Collections website
  2. SRPM of RHSCL6
  3. Release Notes & Documentation