Software Collections Quickstart

-1+1 (No Ratings Yet)

As I discussed in an article entitled Red Enterprise Linux Release Speed, developers sometimes have a problem with how slow Red Hat’s Enterprise Linux releases new versions of software. Well, the good news is, Software Collections are here. Software Collections provide Red Hat Enterprise Linux users with newer versions of programming languages and server daemons like python, perl, ruby, php, mysql, mariadb, etc.

This is a quick start guide to help you get comfortable with both programming languages and server daemons provided as software collections.


First, add the right channel to your system

rhn-channel -u fatherlinux --add --channel=rhel-x86_64-server-6-rhscl-1-beta

To discover what packages are available, do a quick list, and grep for rhscl.

yum list available | grep rhscl
mariadb55.x86_64                      1-6.el6               rhel-x86_64-server-6-rhscl-1-beta
mariadb55-mariadb.x86_64              5.5.30-9.el6          rhel-x86_64-server-6-rhscl-1-beta
mariadb55-mariadb-bench.x86_64        5.5.30-9.el6          rhel-x86_64-server-6-rhscl-1-beta
mariadb55-mariadb-devel.x86_64        5.5.30-9.el6          rhel-x86_64-server-6-rhscl-1-beta
mariadb55-mariadb-libs.x86_64         5.5.30-9.el6          rhel-x86_64-server-6-rhscl-1-beta
mariadb55-mariadb-server.x86_64       5.5.30-9.el6          rhel-x86_64-server-6-rhscl-1-beta
mariadb55-mariadb-test.x86_64         5.5.30-9.el6          rhel-x86_64-server-6-rhscl-1-beta

Now, let’s install a few interesting packages

yum install python33-*
yum install python27-*
yum install mariadb55-mariadb-server

Basic Usage & Testing

To test python 3.3, let’s fire up Idle, the built in editor

scl enable python33 idle

It’s also easy to enable a software collection, for the duration of a shell session

scl enable python27 bash

Enabling Servers

Servers provided by Software Collections are configured and used similar to normal system daemons. One important thing to note, is that with Software Collections, multiple servers that require the same port may be installed side by side, so care must be taken to determine which one is started by default. Historically, this is something that systems administrators did not have to frequently worry about.

Before starting MariaDB, make sure that the system version of MySQL 5.1 is not installed or has been disabled.

chkconfig --list mysqld
mysqld         	0:off	1:off	2:off	3:off	4:off	5:off	6:off

Now, start MariaDB. As things start, you will notice that everything happens in /opt. All of the MariaDB system tables are created in /opt and do not interfere with the system version of mysqld.

chkconfig mariadb55-mysqld on
/etc/init.d/mariadb55-mysqld start

A few other important thing to note are; the logs and socket are placed in the system directories, so a standard MySQL client can and will connect by default.


Also, notice that the normal MySQL port is used and looks like a standard MySQL server daemon.

netstat -anp | grep 3306
tcp        0      0      *                   LISTEN      21104/mysqld


Now, we are going to put Python 2.7 and MariaDb in action using SQLAlchemy. Enable both at the same time.

scl enable python33 mariadb55 bash

Notice that the binary is in /opt/rh. Also, notice that the version is correct.

which mysql
mysql --version
mysql  Ver 15.1 Distrib 5.5.30-MariaDB, for Linux (x86_64) using readline 5.1

A little bit of SQL Alchemy, and you can create a new database.

>>> import sqlalchemy
>>> print(sqlalchemy.__version__)
>>> engine = sqlalchemy.create_engine('mysql://root@localhost')
>>> engine.execute("CREATE DATABASE test5")

Finally, check that the database was created.

Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 11
Server version: 5.5.30-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> show databases;
| Database           |
| information_schema |
| mysql              |
| performance_schema |
| test               |
| test5              |
5 rows in set (0.00 sec)

Join the Red Hat Developer Program (it’s free) and get access to related cheat sheets, books, and product downloads.


What did you think of this article?
-1+1 (No Ratings Yet)

    1. The “enablement” of a collection only lasts for the running of the process that “scl enable” started. Any other application on the machine will run using the native installs (assuming it has some). Does that answer your question?

    2. To add to what Landon said, the daemons will start and run permanently. The chkconfig is like any other damon on the box.

      The enablement of a software collection is not permanent. You must run “scl enable COLLECTION PROGRAM” every time you want to enable the collection.

      For example, if you have a Ruby 1.9 script called cleanup.rb, you would have to run “scl enable ruby193 cleanup.rb” every time you want to run it or in your cron jobs, etc.

      1. Pawel, There is not a way to enable it permanently, but, here are a couple of bash tricks that might help.

        You can create a function that takes command line options. Think of this as an alias on steroids. Add the following to your .bashrc

        python27() {
        scl enable python27 “python $*”

        Then test:

        python27 –version
        Python 2.7.5

        This doesn’t help with your magic line in scripts, but will make it easier to call scripts:

        [smccarty@keith ~]$ cat

        import sys

        print “Hello, World!”, sys.version

        Call it normal and notice, the default installation of python is used:

        [smccarty@keith ~]$ ./
        Hello, World! 2.6.6 (r266:84292, Sep 4 2013, 07:46:00)
        [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]

        Call it with our alias, and notice that Python 2.7 is used:

        [smccarty@keith ~]$ python27
        Hello, World! 2.7.5 (default, May 23 2013, 06:08:09)
        [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]

        Hope that helps!!

Leave a Reply