Python and Ruby Selector

We have the ability to deploy Python and Ruby applications via application server. Python and Ruby Selector uses mod_passenger to host Python and Ruby .

This feature is available for CloudLinux 6 or later. It supports only cPanel servers.

You can find a list of supported alt-python and alt-ruby versions using the following commands.

For alt-python:
yum grouplist | grep alt-python
For alt-ruby:
yum grouplist | grep alt-ruby

Python and Ruby Selector Installation


The instructions below are suitable only for EasyApache 3 and EasyApache 4. You should follow this instruction if you use LiteSpeed.

Install tools to create isolated Python environments and Passenger Apache module. For servers with EasyApache3:

yum install lvemanager alt-python-virtualenv alt-mod-passenger
for EasyApache4:
yum install lvemanager alt-python-virtualenv ea-apache24-mod-alt-passenger

To use Python Selector you should install alternative Python packages:

yum groupinstall alt-python
To use Ruby Selector install alternative Ruby packages:
yum groupinstall alt-ruby 
To use MySQL database you should install alt-python27-devel package:
yum install alt-python27-devel


After installation, please make sure that you have unmarked appropriate checkboxes in LVE Manager Options tab to show Ruby or Python App in web-interface. Find the instructions on the link.


Adding Python and Ruby modules requires executing permissions to gcc/make binaries. Please enable compilers in Compiler Access section of WHM, then run: cagefsctl --force-update

End User Access

  1. In Software/Services area choose Select Python Environment/Select Ruby Environment .

  1. Create project form will appear. Choose interpreter version for your application, application folder name (project path) and URI for accessing your application. Click “Create project” to create an application.

After a little while a new application entry will be appended to the web-page.

  1. You can edit path (folder name of the project in the home directory, for example, /home/clman1/project_name ), uri for application, wsgi handler. If you click Edit - the value is converted to input field and thus becomes editable. When editing is complete, click Save .

  1. Wsgi entry is to specify python wsgi application entry point. It must be specified as filename, must be callable and separated by colon. If your app is running from file flask/ by calling callable app, set flask/ .

  1. When Show control is clicked, python extensions section will be expanded. It gives the ability to add or remove python modules. When start typing in input field, appropriate hints are shown in drop-down list. Choose the entry you want from drop-down and click Add .

If you click Delete , the corresponding module entry will disappear.

In addition to setting path, uri and wsgi , the interpreter version can be changed as well by changing the value in select drop-down.

  1. No changes are applied to application environment until Update button is clicked. Before the Update button is clicked, all changes can be reverted with Reset button.

The newly created application will be supplied with stub only. A real application ought to be put into application folder. After application is placed into application folder, the wsgi parameter can be set.

Click Remove to delete the application - the application folder itself will remain unmoved.

Note. For LVE Manager version 0.9-10 and higher:

When creating an application you can use the key --domain , which attaches application to domain. If --domain key is not specified, then the main users domain will be used by default.

To create application run:

/usr/bin/selectorctl --interpreter=<python|ruby> --version=VERSION[--user=USER] [--domain=DOMAIN] [--print-summary] [--json]–-create-webapp <FOLDER_NAME> <URI>
When changing application URI, --domain key can be used simultaneously, in this case not only URI will be changed, but also the application domain.

To change application URI run:

/usr/bin/selectorctl --interpreter=<python|ruby> [--user=USER][--domain=NEW_DOMAIN] [--print-summary] [--json] --transit-webapp<FOLDER_NAME> <NEW_URI> 
The possibility to choose domain when creating an application was added to web interface as well.

Also, you can run simple commands from web interface (e.g. you can install packages from specific repositories or control web applications by means of django -admin).

Command Line

All the actions mentioned in Deploy and Settings section can be performed from the command line:

To create application run:

/usr/bin/selectorctl --interpreter=<python|ruby> --version=VERSION [--user=USER] [--print-summary] [--json] --create-webapp <FOLDER_NAME> <URI>
To delete application:
/usr/bin/selectorctl --interpreter=<python|ruby> [--user=USER] [--print-summary] [--json] --destroy-webapp <FOLDER_NAME>
To change application folder name:
/usr/bin/selectorctl --interpreter=<python|ruby> [--user=USER] [--print-summary] [--json] --relocate-webapp <FOLDER_NAME> <NEW_FOLDER_NAME>

To change application URI :

/usr/bin/selectorctl --interpreter=<python|ruby> [--user=USER] [--print-summary] [--json] --transit-webapp <FOLDER_NAME> <NEW_URI>

To change application interpreter version:

/usr/bin/selectorctl --interpreter=<python|ruby> [--user=USER] [--print-summary] [--json] --set-user-current --version=<NEW VERSION> <FOLDER_NAME>
To set application WSGI handler ( Python only):
/usr/bin/selectorctl --interpreter=python [--user=USER] [--print-summary] [--json] --setup-wsgi=<file_path:callable> <FOLDER_NAME>
To install modules to application environment:
/usr/bin/selectorctl --interpreter=python [--user=USER] [--print-summary] [--json] --enable-user-extensions=<module1[,module2...]> <FOLDER_NAME>
To remove modules from application environment:
/usr/bin/selectorctl --interpreter=python [--user=USER] [--print-summary] [--json] --disable-user-extensions=<module1[,module2...]> <FOLDER_NAME>
To list modules installed in application environment:
/usr/bin/selectorctl --interpreter=python [--user=USER] [--print-summary] [--json] --list-user-extensions <FOLDER_NAME>
To print applications summary for a user:
/usr/bin/selectorctl --interpreter=python [--user=USER] [--json] --user-summary
To list available interpreters:
/usr/bin/selectorctl --interpreter=python [--user=USER] [--json] --list
To restart application:
selectorctl --interpreter ruby --user cltest1 --domain --restart-webapp testapp
To choose Ruby version:
selectorctl --interpreter=ruby --user=$USER -v 2.0

Hide Python and Ruby Selector Icons

It is possible to hide or show Python and Ruby Selector icons by marking or unmarking proper checkboxes in LVE Manager Options tab.

The same result can be accomplished in CLI by running:

cloudlinux-config set --json --data '{"options":{"uiSettings":{"hideRubyApp":false, "hidePythonApp":false}}}'


If you are using cPanel/WHM, you can also configure hide/show CloudLinux Python/Ruby Selectors in WHM | Feature Manager. For that, you’d need to first uncheck Hide Python App in web-interface in the LVE Manager. This will make the menu appear for all accounts. After that, you are free to disable this app in WHM | Feature Manager for the required feature lists.

Deploying Trac using Python Selector

  1. In Setup Python App create an application. Trac project WSGI script will be located in App Directory ( e.g. trac ).

App URI – is a URL where web-interface is located. ( e.g. Trac – web-interface is located in YOUR_DOMAIN/trac ).

Trac needs Python version from 2.5 to 3.0, in actual example version 2.7 is used.

  1. When the App is created, add the following modules: Trac, Genshi, MySQL-python .

2.1. Alternatively, connect to the server via SSH and perform the following steps:

source ~/virtualenv/trac/2.7/bin/activate;


~/virtualenv/trac/2.7/bin/easy_install Trac mysql-python (using easy_install );


~/virtualenv/trac/2.7/bin/pip install trac mysql-python (using pip ).
  1. In cPanel create MySQL database and a user. Add user to database.

In this example DB tractest_trac and user tractest_trac were created.

  1. Connect to the server via SSH using your cPanel account.

Create Trac project: ~/virtualenv/trac/2.7/bin/trac-admin ~/trac_project initenv

For "Database connection string" parameter enter the following: mysql://user:password@localhost/database_name – here the data for connecting MySQL database are specified.


In case of "... The charset and collation of database are 'latin1' and 'latin1_swedish_ci' error the database must be created with one of (('utf8', 'utf8_bin'), ('utf8mb4', 'utf8mb4_bin')) ..." while creating the project, you should change database encoding.

To change encoding, in cPanel run phpMyAdmin , choose DB , go to Operations , choose the necessary encoding in Collation section and click Go .

After that you have to repeat the procedure of creating a project. When done, the Trac project must appear: ~/trac_project

  1. To create project frontend run the following:
~/virtualenv/trac/2.7/bin/trac-admin ~/track_project deploy ~/trac

~/track_project — is the path to the project, ~/trac — is the path, that was specified while setting App Directory .

Create topic directory by default:

cd ~/public_html/trac
mkdir chrome 
cp -R ~/trac/htdocs/ ~/public_html/trac/chrome/
- all project static files are located in this directory; the changes can be added here as well.
  1. To add path to WSGI file in created application:

Go back to cPanel Setup Python App , change “WSGI file location” for your application to cgi-bin/trac.wsgi , click Update to apply changes and then click Restart .

Your Existing application now must look like the following:

  1. Adding authorization:

In ~/public_html/trac/.htaccess after CLOUDLINUX PASSENGER CONFIGURATION section add the following lines:

AuthType Basic
AuthName "trac"
AuthUserFile /home/tractest/trac/passwd
Require valid-user
  1. Add new user and create passwd file /usr/local/apache/bin/htpasswd with ~/trac/passwd admin.

Enter password.

~/virtualenv/trac/2.7/bin/trac-admin ~/track_project permission add admin TRAC_ADMIN

Add admin user to TRAC_ADMIN group.

Here the path trac directory is equal to App Directory in your project.

Now Trac is available via YOUR_DOMAIN/trac .

Trac with MySQL

To use Trac with MySQL database you should install alt-python27-devel package.

To install run:

yum install alt-python27-devel --enablerepo=cloudlinux-updates-testing 

Deploying Redmine using Ruby Selector


Provided instructions are valid for older Redmine version 2.6.0. New versions guide could be found at

  1. In cPanel create MySQL database and add user to it. In the example given, the databace redminet_redmine was created and user redminet_redmine was added.

  2. In Setup Ruby App section create an application.

App Directory is the directory where all static files will be placed ( e.g. redmine ). App URI is web-interface URL ( e.g. redmine web-interface will be located in YOUR_DOMAIN/redmine ).

  1. After the application was created, add the following modules: bundle, i18n#0.6.11, builder#3.0.4, rails#3.2.19, mime-types#1.25.1, mocha#1.0.0, jquery-rails#3.1.2, coderay, fastercsv, request_store, rbpdf, mysql2, selenium-webdriver, rmagick, shoulda#3.3.2, ruby-openid#2.3.0, request_store#1.0.5, capybara#2.1.0, net-ldap#0.3.1, rack-openid, shoulda-matchers#1.4.1, redcarpet#2.3.0, yard, rake#10.4.2, bigdecimal.

Note : If error occurs while installing rmagic module, then you need to install ImageMagick-devel package on your server:

yum install ImageMagick-devel
The installation process takes quite along time, about 7-8 minutes. When done, click Restart button to restart the application.

3.1 Alternatively, after the application was created, you can add only one module - bundle .

  1. Enter the server via SSH, using your cPanel account.

Download the application .

In the description given, the latest version Redmine (2.6.0) is assumed. tar xzf redmine-2.6.0.tar.gz

Hereinafter 'redmine' is App Directory meaning which was specified while setting Ruby application.

cp -R ~/redmine-2.6.0/* ~/redmine
cd ~/redmine/config
cp database.yml.example database.yml
Edit config/database.yml - add MySQL database connection settings to Production section.
cp -R ~/redmine/public/* ~/public_html/redmine/
cd ~/public_html/redmine
cat htaccess.fcgi.example >> .htaccess
cp dispatch.fcgi.example dispatch.fcgi
Go to cd ~/redmine directory.

Add gem "bigdecimal" line into Gemfile file.

Run alternately:

source ~/rubyvenv/redmine/2.1/bin/activate
~/rubyvenv/redmine/2.1/bin/bundle install
(if running the alternative installation)
~/rubyvenv/redmine/2.1/bin/rake generate_secret_token
RAILS_ENV=production ~/rubyvenv/redmine/2.1/bin/rake db:migrate
- Database migration;

RAILS_ENV=production ~/rubyvenv/redmine/2.1/bin/rake redmine:load_default_data

  • Loading default data into database.

EasyApache 4

Since cPanel/WHM version 66 provides ea-ruby24-mod_passenger (more information on the link ), this allows creating Ruby applications with cPanel application manager.

CloudLinux already has Python and Ruby Selector , which allows creating applications with ea-apache24-mod-alt-passenger . However, it does not allow using cPanel application manager .

It is not correct to install both of those packages on the server because they contain the same passenger module for Apache web server.

The new ea-ruby24-mod_passenger is available for download from our updates-testing (beta) repository which allows you to run applications via cPanel application manager and CloudLinux Python and Ruby Selector .

To install run:

# yum install lvemanager alt-python-virtualenv
# yum install ea-ruby24-mod_passenger --enablerepo=cl-ea4-testing

To install Ruby or Python Selector follow the instructions on the link.