Version 1 (modified by forgacs, 22 months ago)

--

Origin of this document:  http://folk.uio.no/hvassing/mediamosa-rhel6.html

Installing MediaMosa 2.3.x on RHEL6 with SELinux

About this document

Last updated: 3rd of August, 2011

This document is the result of trial and error in installing MediaMosa on Red Hat Enterprise Linux 6 with SELinux in enforcing mode. It should be noted that this is only intended as a documentation of how to get MediaMosa to work in a test environment and is by no means inteded for production use.

Note that this is only the back-end of MediaMosa, and does not deal with the front-end installation of MediaMosa with Drupal ConstructionKit?, although that might come at some point later.

This document is written by Håvard Hvassing, at the University of Oslo, University Centre for Information Technology Services (USIT). You can reach the author at havard.hvassing@…

Packages from repository

Additional packages that are needed are mentioned in their appropriate section

Please make sure you have the latest packages and versions before installing - this document was written on the 1st of August, 2011. Chances are that most of the packages listed here have been updated since that

yum -y install httpd php php-devel mysql-server lua lua-lpeg gcc php-gd php-mcrypt php-mysql php-bcmath exiv2 php-pecl-imagick ImageMagick

Transcoder

Additional codecs used to transcode the raw-files handled by MediaMosa. MediaMosa supports other and several codecs and transcoders, hosted on different servers. In this setup, the transcoding server is the same as the web-server — a setup which probably should not be used in high load cases

libmp3lame / lame

wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz/download
tar zxf lame-3.98.4.tar.gz
cd lame-3.98.4
./configure --enable-shared
make
make install
ln -s /usr/local/lib/libmp3lame.so.0 /usr/local/lib64/libmp3lame.so.0

faad

wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz
tar zxf faad2-2.7.tar.gz
cd faad2-2.7
./configure --enable-shared
make
make install
ln -s /usr/local/lib/libfaad.so.2 /usr/local/lib64/libfaad.so.2
ln -s /usr/local/lib/libfaad.so.2.0.0 /usr/local/lib64/libfaad.so.2.0.0

x264

yum -y install yasm
wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjf last_x264.tar.bz2
cd x264-snapshot-20110622-2245
./configure --enable-shared
make
make install
ln -s /usr/local/lib/libx264.so /usr/local/lib64/libx264.so
ln -s /usr/local/lib/libx264.so.115 /usr/local/lib64/libx264.so.115
ln -s /usr/local/lib/libx264.so.116 /usr/local/lib64/libx264.so.116

ffmpeg

While we have not done extensive research into what types of codecs are needed, it is assumed the following will cover the basic needs in terms of transcoding. Amend this list as you see fit to better suit your particular needs for transcoding and video- and audio support. MediaMosa also supports other transcoders than ffmpeg and has support for transcoding on external servers, as such, the following is probably only suited for test cases and should not be used in production environments.

wget http://ffmpeg.org/releases/ffmpeg-0.6.3.tar.gz
tar zxf ffmpeg-0.6.3.tar.gz
cd ffmpeg-0.6.3
yum -y install libtheora-devel libvorbis-devel gsm-devel schroedinger-devel openjpeg-devel libdc1394-devel 
./configure --enable-libdc1394 --prefix=/usr --enable-shared  --enable-gpl  --enable-libvorbis --enable-pthreads --enable-libgsm --enable-libtheora --enable-nonfree --disable-stripping --enable-libschroedinger --disable-encoder=libschroedinger --enable-avfilter-lavf --enable-libopenjpeg --enable-version3 --disable-altivec --disable-armv5te --disable-armv6 --disable-vis --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-libmp3lame --enable-libx264
make
make install

You might have to add this to the Apache users path, so that it is looking for the libraries in the correct places.

echo "/usr/local/lib64" >> /etc/ld.so.conf.d/usr_local.conf
ldconfig

A word or two on testing ffmpeg Try first to run ffmpeg as your own user, or as root, normally this should work without any problems. You can test if Apache can run ffmpeg by typing sudo -u apache ffmpeg. If this returns something along the lines of ffmpeg: error while loading shared libraries, chances are that the Apache user is not allowed to read all the libraries needed. See this forum post for more information.

MediaMosa

The following setup uses symbolic links to facilitate easier upgrades of MediaMosa without having to copy the various modules. In addition, in this setup the video storage, /srv/mediamosa, is a catalogue on the internal file system — a setup which is not recommended for production use.

The default DocumentRoot? for Apache on RHEL6 is /var/www/html/, however, due to the aforementioned magic with making upgrading easier, the following setup uses the symbolic link /var/www/mediamosa/prod as the DocumentRoot?.

cd /var/www/
mkdir mediamosa
wget http://www.mediamosa.org/sites/default/files/mediamosa-2.3.13_1.tgz
tar zxf mediamosa-2.3.13_1.tgz
ln -s mediamosa-2.3.13/ /var/www/mediamosa/prod
mkdir mediamosaroot

Faking a NAS or some other mount point

mkdir /srv/mediamosa
chown -R apache:apache /srv/mediamosa
chmod -R 774 /srv/mediamosa

Make sure Apache can access the content of /srv by adding the following SELinux attributes. If you want the full verbose output of these commands, just add -v.

semanage fcontext -a -t httpd_sys_content_t /srv
restorecon /srv

semanage fcontext -a -t httpd_sys_content_t "/srv(/.*)?"
restorecon -R /srv

chmod a+w /var/www/mediamosa/sites/default
cp /var/www/mediamosa/prod/sites/default/default.settings.php /var/www/mediamosa/prod/sites/default/settings.php
chmod a+w /var/www/mediamosa/prod/sites/default/settings.php

Since we are using /var/www/mediamosa/prod as DocumentRoot?, we have to make sure that MediaMosa can access the directory by setting the correct SELinux attributes

semanage fcontext -a -t httpd_sys_content_t /var/www/mediamosa
restorecon -v /var/www/mediamosa

semanage fcontext -a -t httpd_sys_content_t "/var/www/mediamosa(/.*)?"
restorecon -R -v /var/www/mediamosa

Apache is not allowed to send e-mail by default, a restriction that is enforced by SELinux. To allow this, simply do the following:

setsebool httpd_can_sendmail=on

pdf2swf

A PDF to SWF Converter. Generates one frame per page. Enables you to have fully formatted text, including tables, formulas, graphics etc. inside your Flash Movie. It's based on the xpdf PDF parser from Derek B. Noonburg. For more information, see the swftools site

yum -y install gcc-c++
wget http://www.swftools.org/swftools-0.9.1.tar.gz
tar zxf swftools-0.9.1.tar.gz
cd swftools-0.9.1
./configure
make
make install

Final thoughts

Now all that is left, is to set up the Apache config file, and go through the installation wizard. In our experience, this last bit should not represent any trouble if the above has been followed

Please post any support requests on the MediaMosa forum, and send us the link if needed. There is bound to be others out there who have experience with setting up MediaMosa on RHEL6.

Best of luck, Håvard Hvassing

Håvard Hvassing - August 2011