Installing and Setting Up YouData on RHEL

This guide describes how to install YouData on Red Hat Enterprise Linux (RHEL).

Install Ruby

YouData requires Ruby version 1.9.2.

Install MongoDB

YouData uses MongoDB database.
Install MongoDB as advised in official installation help:

Create a file /etc/yum.repos.d/10gen.repo and add there:

name=10gen Repository  

Then install MongoDB:

sudo yum install mongo-10gen mongo-10gen-server

Edit MongoDB settings /etc/mongod.conf if necessary.

Start MongoDB server:

service mongod start

Copy the codebase

Use git to clone the YouData codebase. If you don’t have git installed, you can
install it with command yum install git.

cd /var/www
git clone git://

Create directories for temporary files

YouData needs tmp/files/ and tmp/zip/ in its application root.

mkdir tmp/files
mkdir tmp/zip

Create a new user who runs the web application

adduser youdata

Change the ownership of the application to the new user:

chown -R youdata:youdata youdata/

Install gem packages

Install the gem packages the application is dependent on.
Run the bundle install command in the application root directory as a new youdata user.

gem install bundler
bundle install --deployment

If your firewall blocks the Git protocol port 9418 and Bundler fails to load
some gems, you can use HTTPS protocol instead for example for gems loaded
from Github with following command:

git config --global url. git://

Install and configure Apache web server

Install Apache web server.

yum install -y httpd httpd-devel

When uploading a file to YouData the application saves the file first in
a temp directory. The default directory is /tmp. You can change that to
something else with option SetEnv TMPDIR <directory> in the
Apache configuration file /etc/httpd/conf/httpd.conf..

Install and configure Passenger

It is easy to deploy Rails applications with Passenger.
Passenger starts the application automatically when the web server is started.

gem install passenger

Add Passenger configurations to Apache configuration file /etc/httpd/conf/httpd.conf
as the installation program advises, something like this:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.8/ext/apache2/
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.8  
PassengerRuby /usr/local/bin/ruby

Change the DocumentRoot to point to YouData codebase’s public folder in the
Apache configuration’s VirtualHost section.

Passenger finds the application root directory from parent directory of public folder.
If DocumentRoot is a symbolic link to public folder then you must tell
Passenger where the application is with option PassengerAppRoot <path/to/root>.

Install xsendfile module

YouData needs X-Sendfile module
to send files to user.

yum install mod_xsendfile

Add these lines to Apache configuration file /etc/httpd/conf/httpd.conf
after the other LoadModules:

LoadModule xsendfile_module modules/
XSendFile on  
XSendFilePath /var/www/youdata/tmp

Install and configure mod_porter module

YouData uses mod_porter for file uploads.
First install the required libapreq2 packages:

yum install libapreq2 libapreq2-devel

Clone the mod_porter repository to somewhere and build it:

git clone
cd modporter  

Create temp directories for apreq2 and mod_porter (make sure they have enough
space to hold at least twice the size of files you want to upload):

mkdir /example/directory/apreq
mkdir /example/directory/porter

Make apache user the owner of these directories:

chown -R apache /example/directory/apreq
chown -R apache /example/directory/porter

Finally configure the Apache server to use mod_porter. Add the following lines
to /etc/httpd/conf/httpd.conf:

LoadModule apreq_module modules/
APREQ2_ReadLimit 50G  
APREQ2_TempDir /example/directory/apreq

LoadModule porter_module modules/  
PorterDir /example/directory/porter

And add the following line inside the VirtualHost-file or VirtualHost-section
with port 80 (the location depends on your configuration):

Porter On

Start the services

Sign in as the youdata user to complete the following steps

sudo su youdata

Start the background worker process for delayed_job

Start the background work process

RAILS_ENV=production script/delayed_job start

Set up cronjobs for scheduled tasks

Removal of temporary files and expired anonymously sent files is handled with cronjobs. Open the crontab for editing with:

crontab -e

Add the following lines to the crontab file:

15 0 * * * cd /var/www/youdata/ && /usr/local/bin/bundle exec rake cron RAILS_ENV=production
*/30 * * * * cd && find /var/www/youdata/tmp/files/* -type d -amin +60 -exec rm -rf {} \;  
*/30 * * * * cd && find /var/www/youdata/tmp/zip/* -type d -amin +60 -exec rm -rf {} \;

The first line removes all the anonymously added files which are over 14 days old every day at 00:15. The last two
lines remove temporary files generated by the application every 30 minutes.