Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Table of Contents

Recipe instructions for building your own Avalon setup from scratch on CentOS or Red Hat Enterprise Linux

Ready the installation Environment

Install EPEL

Code Block
rpm -ivh http://linux.mirrors.es.net/fedora-epel/6/i386/epel-release-6-8.noarch.rpm

This package has libyaml-devel which is required by ruby and not provided by Redhat.

Make sure a valid hostname is resolvable

The default hostname is “avalon.dev”, so name the machine this and enter it into /etc/hosts

Code Block
# hostname
avalon.dev
# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 avalon.dev

Stop iptables 
Anchor
iptables
iptables

Code Block
service iptables stop

Disable SELinux

Code Block
echo 0 > /selinux/enforce 
vi /etc/selinux/config #change the value of `SELINUX` from `enforcing` to `permissive`

Add the NUL repository 
Anchor
NUL
NUL

Create the NUL repository config file:

...

Code Block
curl http://yumrepo-public.library.northwestern.edu/RPM-GPG-KEY-nul -o /etc/pki/rpm-gpg/RPM-GPG-KEY-nul

Disable SELinux

Code Block
echo 0 > /selinux/enforce 
vi /etc/selinux/config #change the value of `SELINUX` from `enforcing` to `permissive`

...

Code Block
service iptables stop

Install Development Libraries

...

Install Development Libraries and packages for building Ruby

Code Block
yum groupinstall "Development Tools"

Install development packages for building Ruby

Code Block

yum install readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel libxml2-devel libxslt-devel
Tomcat

Install Apache Tomcat with the nulrepo-public repository configured and enabled.

...

<Connector port="8983" protocol="HTTP/1.1"

Add Tomcat manager user

By default, no user has access to the Tomcat Manager App. 

...

Try it out on your local machine and on another machine. If you can't reach the app from another machine, your iptables might need to be changed to allow access.

Solr

Avalon makes use of Solr through the Blacklight gem for faceting and relevance-based searching.

Download the solr tarball and unpack it

...

(from http://www.apache.org/dyn/closer.cgi/lucene/solr/4.2.0)

Code Block
wget http://archive.apache.org/dist/lucene/solr/4.2.0/solr-4.2.0.tgz
tar xvf solr-4.2.0.tgz
mv solr-4.2.0 /usr/local/solr
cd /usr/local/solr/dist/
cp solr-4.2.0.war /usr/local/tomcat/webapps/solr.war
mv solr-4.2.0.war /usr/local/solr/solr.war

Add XML configurations

Place into /usr/local/tomcat/conf/Catalina/localhost/solr.xml:

Code Block
<Context docBase="/usr/local/solr/solr.war" debug="0" crossContext="true">
 <Environment name="solr/home" type="java.lang.String" value="/usr/local/solr" override="true"/>
</Context>

Place into /usr/local/solr/solr.xml:

Code Block
<?xml version="1.0" encoding="UTF-8" ?>
  <solr persistent="true">
    <cores defaultCoreName="avalon" adminPath="/admin/cores" zkClientTimeout="${zkClientTimeout:15000}" hostPort="8983" hostContext="solr">
    <core instanceDir="avalon/" name="avalon"/>
  </cores>
</solr>

...

Download and

...

Install Avalon specific Solr files from github

Code Block
mkdir /usr/local/solr/lib
mv /usr/local/solr/dist/* /usr/local/solr/lib/
mv /usr/local/solr/contrib /usr/local/solr/lib/
 
wget https://github.com/avalonmediasystem/puppet-solr/archive/master.zip
unzip master
mv puppet-solr-master/files/avalon /usr/local/solr
chown -R tomcat7:tomcat /usr/local/solr/
chown -R tomcat7:tomcat /usr/local/tomcat
service tomcat restart

...

If you can't access the dashboard, check the tomcat logs in /usr/local/tomcat/logs/. Catalina.out and localhost.<date>.log have been the most helpful.

 

MySQL

Avalon uses MySQL for storing search queries, user data and roles, and as a back end for asynchronously sending requests to Matterhorn.

Install MySQL server 

Code Block
yum install mysql-server
service mysqld start

Create databases and users

Enter the mysql monitor:

Code Block
#mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
...etc...
mysql>

...

Code Block
create database rails;
create user 'rails'@'localhost' identified by 'rails';
grant all privileges on rails.* to 'rails'@'localhost';
flush privileges;

Check your work and exit

Code Block
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| fedora3            |
| mysql              |
| rails              |
| test               |
+--------------------+
5 rows in set (0.00 sec)
mysql> select user, host from mysql.user;
+--------+--------------+
| user   | host         |
+--------+--------------+
| root   | 127.0.0.1    |
|        | 129.79.32.87 |
| root   | 129.79.32.87 |
|        | localhost    |
| fcrepo | localhost    |
| rails  | localhost    |
| root   | localhost    |
+--------+--------------+
7 rows in set (0.00 sec)
 
mysql> exit;
Bye

Please see documentation for your version of MySQL Server for detailed syntax (http://dev.mysql.com/doc/refman/5.1/en/create-database.html )

Fedora Commons repository

Download and run the fcrepo installer

...

Code Block
chown -R tomcat7:tomcat /usr/local/fedora
service tomcat restart

 

...

Red5

...

Media Server

Red5 is an open source alternative to Adobe Flash Media Server.

Create a red5 user.

Code Block
useradd red5

Download and install Red5.

Code Block
wget http://red5.org/downloads/red5/1_0_1/red5-1.0.1.tar.gz
tar xvf red5-1.0.1.tar.gz
mv red5-server-1.0 /usr/local/red5

Download the init script and add it to the init.d directory.

Code Block
wget https://raw.github.com/avalonmediasystem/avalon-installer/master/modules/red5/templates/red5_init_script.erb -O red5_init_script.sh
mv red5_init_script.sh /etc/rc.d/init.d/red5

chown -R red5:red5 

Give red5 permissions to the Red5 directory and the init script.

Code Block
chown -R red5:red5 /usr/local/red5
chmod +x /etc/rc.d/init.d/red5

 

...

FFmpeg

Installation prerequisites

Install prerequisite packages using yum and the NUL-public repository:

...

Code Block
yum install SDL-devel a52dec-devel bzip2-devel faad2-devel freetype-devel frei0r-plugins-devel \
	gsm-devel imlib2-devel lame-devel libdc1394-devel libraw1394-devel librtmp-devel libtheora-devel \
	libva-devel libfaac-devel libvdpau-devel libstdc++-devel libvorbis-devel libvpx-devel \
	mediainfo opencore-amr-devel opencv-devel openjpeg-devel openssl-devel schroedinger-devel \
	speex-devel texi2html vo-aacenc-devel x264-devel xvidcore-devel yasm zlib-devel

Install rpmdev-setuptree

Code Block
yum install rpmdevtools

Install ffmpeg srpm

Log in as the user red5, because the following commands need to run under a user other than root.

...

Code Block
su - root
rpm -ivh /home/red5/rpmbuild/RPMS/x86_64/ffmpeg-*.rpm

HTTPD

Install and start the httpd service.

Code Block
yum install httpd
service httpd start

Add avalon user and create avalon directory

Code Block
useradd avalon
mkdir /var/www/avalon
chown -R avalon:avalon /var/www/avalon

Matterhorn

Install Matterhorn

Create a user for Matterhorn and then install Matterhorn

Code Block
useradd matterhorn
 
wget https://github.com/avalonmediasystem/avalon-felix/archive/1.4.x.tar.gz
tar xvf 1.4.x
mv avalon-felix-1.4.x /usr/local/matterhorn

wget https://raw.github.com/avalonmediasystem/config-files/master/matterhorn/matterhorn_init.sh
mv matterhorn_init.sh /etc/init.d/matterhorn

chmod +x /etc/init.d/matterhorn
chown -R matterhorn:matterhorn /usr/local/matterhorn

Add avalon user and create avalon directory.

Code Block
useradd avalon
chmod +xmkdir /etcvar/init.dwww/matterhornavalon
chown -R matterhornavalon:matterhornavalon /usrvar/localwww/matterhornavalon

Create and configure streaming directories.

Code Block
mkdir -p /usr/local/red5/webapps/avalon/streams
mkdir /var/avalon
mkdir -p /var/www/avalon/public/streams

chown red5:avalon /usr/local/red5/webapps/avalon/streams
chmod 0775 /usr/local/red5/webapp/avalon/streams
ln -s /usr/local/red5/webapps/avalon/streams /var/avalon/rtmp_streams
 
mkdir /var/avalon/hls_streams
chown root:root /var/avalon/hls_streams/
ln -s /var/avalon/hls_streams/ /var/www/avalon/public/streams

chmod 0775 /var/avalon/hls_streams/

Configure Matterhorn

Download Matterhorn config and verify property values.

Code Block
wget https://raw.github.com/avalonmediasystem/config-files/master/matterhorn/config.properties
vim config.properties 

...

Code Block
usermod -G avalon matterhorn

Apache Passenger and Ruby

...

Code Block
yum install sqlite-devel

Change current user to avalon then install RVM and ruby 1.9.3-p448.

Code Block
su - avalon
curl -L https://get.rvm.io | bash -s stable --ruby=1.9.3

Source the RVM shell shell (as avalon user)

Code Block
source /home/avalon/.rvm/scripts/rvm

Install Passenger via Gem Gem (as avalon user)

Code Block
gem install passenger

Check to make sure passenger installed in the expected location (as avalon user)

Code Block
$ passenger-config --root
/home/avalon/.rvm/gems/ruby-1.9.3-p429/gems/passenger-3.0.19

Install Passenger apache module requirements (as root)

Code Block
su - root
yum install curl-devel httpd httpd-devel apr-devel apr-util-devel

Build passenger for your version of Apache and Ruby (as avalon user)

Code Block
su - avalon
passenger-install-apache2-module #copy the suggested Apache configuration file settings for later

Create an apache configuration file (as root)

Code Block
su - root
vi /etc/httpd/conf.d/passenger.conf

...

Code Block
[root@localhost ~]# /etc/init.d/httpd restart
[root@localhost ~]# su - avalon
[avalon@localhost ~]$ which passenger-status
~/.rvm/gems/ruby-1.9.3-p448/bin/passenger-status

Avalon

Grab Avalon code from github

Code Block
cd ~
git clone git://github.com/avalonmediasystem/avalon.git
cd avalon
git checkout master #make sure you are in the master branch (should be by default)
rm .rvmrc
mv public/* /var/www/avalon/public/
mv  * /var/www/avalon/

Configure Avalon 

Create /var/www/avalon/.ruby-version and add:

Code Block
1.9.3-p448

Create /var/www/avalon/config/setup_load_paths.rb and add:

...

Code Block
cd /var/www/avalon/config
cp authentication.yml.example config/authentication.yml
vi database.yml

Configure database settings
Anchor
mysql2
mysql2

Code Block
vim database.yml

...

Code Block
gem 'mysql2', '~>0.3.11'

Run the bundle install

Code Block
su - avalon
cd /var/www/avalon
gem update debugger-ruby_core_source
bundle install

Finish configuring Avalon

Edit /var/www/avalon/config/solr.yml

...

Code Block
development:
  dropbox:
    path: '/var/avalon/dropbox/'
    upload_uri: 'sftp://localhost/var/avalon/dropbox'
    username: 'test'
    password: 'test'
    notification_email_address: ''

Create the database using rake

Code Block
su - avalon
cd /var/www/avalon
rake db:create

...

http://stackoverflow.com/questions/5376427/cant-connect-to-local-mysql-server-through-socket-var-mysql-mysql-sock-38

Run the database migrations

Code Block
rake db:migrate

Set rails environment to development (it is by default)

On the first line of /var/www/avalon/config/environment.rb make sure it says 'development' like so:

Code Block
ENV['RAILS_ENV'] ||= 'development'

Visit your new Avalon site!

You should be able to visit the webpage with just the hostname. ex: http://localhost (if you want to test from your local machine)

Sign in

Click on "Sign in" in the upper right corner of the website main page.

Skip the sign-in fields and click the Create identity button using these values:

archivist1@example.com

password/password

This is a known identity with administrative privileges.

 

Start delayed_job:

As avalon user:

Code Block
cd /var/www/avalon/
bundle exec rake delayed_job:start

Delayed Job handles background jobs.  DelayedJob logs to log/delayed_job.log in the avalon directory. 

Red5 Avalon Security Webapp

Code Block
cd /usr/local/red5/webapps
wget https://github.com/avalonmediasystem/config-files/raw/master/red5/red5-avalon.tar.gz
tar xvzf red5-avalon.tar.gz
chown -R red5:red5 avalon/

Edit /usr/local/red5/webapps/avalon/WEB-INF/red5-web.properties:

avalon.serverUrl=http://localhost/

Restart red5

Code Block
service red5 restart

If Red5 is installed and running you should be able to access this page: http://avalon.dev:5080/

Dropbox

Code Block
groupadd -r dropbox
useradd -r avalondrop
mkdir -p /var/avalon/dropbox
chown avalondrop:dropbox /var/avalon/dropbox
chmod 2775 /var/avalon/dropbox

...