Note |
---|
This documentation is for Release 6.x3. For documentation on previous releases, please select from the options below. |
These instructions provide a recipe for building your own all-in-one Avalon system from scratch on CentOS or Red Hat Enterprise Linux, version 6.x is supported, 7.x will be supported soon. Please note that while an all-in-one installation as outlined here is certainly suitable for testing and demos, a single, all-in-one, server may not be suitable for production environments.
...
Port | Purpose | External? | |||
---|---|---|---|---|---|
80 | HTTP (Avalon) | Yes | 1935 | RTMP (red5) | Yes |
5080 | HTTP (red5) | No | |||
8983 | HTTP (Solr) | No | |||
8984 | HTTP (Fedora) | No | |||
8080 | HTTP (Matterhorn) | Yes |
...
See documentation for your version of MySQL Server for detailed syntax (http://dev.mysql.com/doc/refman/5.1/en/create-database.html )
...
Media Streaming Server
Red5 is an open source alternative to Adobe Media Server. If using the Adobe Media Server you can skip to the next step.
Create a red5 user.
Code Block |
---|
useradd red5 |
Download and install Red5.
Code Block |
---|
wget http://repo.avalonmediasystem.org/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 |
Give Red5 permissions to the red5 directory and the init script.
Code Block |
---|
Warning |
Red5 is no longer the default streaming server for Avalon 6.3. With the upgrade to MediaElementjs 4, we now rely completely on HLS. |
By default, Avalon prechunks HLS artifacts that can be served by any webserver, see: Matterhorn's distribute-streaming workflow. However many consider that inflexible and inconvenient.
An HLS-enabled server like Wowza (commercial) or Nginx + the HLS module (open-source) can take an mp4 created from distribute-streaming and stream it on the fly. Then prechunking can be disabled by commenting out the distribute-hls
operation. Instructions for setting up Nginx will follow soon.
FFmpeg
Installation prerequisites
...
The following commands need to run under a user other than root. Change to the red5 another user to continue.
Code Block |
---|
su - red5someuser |
Run the ffmpeg installer
Code Block |
---|
rpmdev-setuptree rpm -ivh https://github.com/avalonmediasystem/avalon-installer/blob/master/files/ffmpeg/ffmpeg-2.4.2-1.el6.src.rpm?raw=true # Retrieving https://github.com/avalonmediasystem/avalon-installer/blob/master/files/ffmpeg/ffmpeg-2.4.2-1.el6.src.rpm # 1:ffmpeg warning: user makerpm does not exist - using root # warning: group makerpm does not exist - using root ########################################### [100%] # warning: user makerpm does not exist - using root # warning: group makerpm does not exist - using root # Build ffmpeg binary as non-root and install as root rpmbuild -bb rpmbuild/SPECS/ffmpeg24.spec |
...
Code Block |
---|
su - root rpm -ivh /home/red5someuser/rpmbuild/RPMS/x86_64/ffmpeg-*.rpm |
...
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)
su - root
chown avalon:avalon /var/www/avalon/public/
su - avalon
mv public/* /var/www/avalon/public/
rmdir public
mv * /var/www/avalon/ |
Configure Avalon
Info | ||
---|---|---|
| ||
As of 6.3, Avalon is using the flexible and increasingly popular Config gem. Default settings for Avalon can be selectively overwritten by putting custom ones in |
Configure Avalon
|
Warning |
---|
If using vim with default settings and pasting the the code below, it will automatically comment out the last line. To prevent that, enable paste using the command :set paste and then use just ctrl+shift+v instead of going into insert mode. |
...
Code Block |
---|
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') begin gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems') ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global" require 'rvm' RVM.use_from_path! File.dirname(File.dirname(__FILE__)) rescue LoadError raise "RVM gem is currently unavailable." end end # If you're not using Bundler at all, remove lines bellow ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__)) require 'bundler/setup' |
Configure database settings
Anchor | ||||
---|---|---|---|---|
|
Code Block |
---|
cd /var/www/avalon/config cp authentication.yml.example authentication.yml |
...
Code Block |
---|
vim database.yml |
Replace database.yml with the correct values for your production environment
Code Block |
---|
development:
adapter: mysql2
host: localhost
database: rails
username: rails
password: rails
pool: 5
timeout: 5000 |
Install the mysql2 adapter
Code Block |
---|
yum install cmake #<--will be required for rugged gem
yum install mariadb-devel
su - avalon
gem install activerecord-mysql2-adapter
gem install mysql2
vim /var/www/avalon/Gemfile |
Add this line to the Gemfile
Code Block |
---|
gem 'mysql2', '~>0.3.20' |
If you are using mysql instead of sqllite (as is done throughout this document), then comment out the following lines in the Gemfile
...
Code Block |
---|
development:
adapter: mysql2
host: localhost
database: rails
username: rails
password: rails
pool: 5
timeout: 5000 |
Install the mysql2 adapter
Code Block |
---|
yum install cmake #<--will be required for rugged gem
yum install mariadb-devel
su - avalon
gem install activerecord-mysql2-adapter
gem install mysql2
vim /var/www/avalon/Gemfile |
Run the bundle install
Code Block |
---|
# as root
yum install nodejs # Javascript runtime
# as avalon
cd /var/www/avalon
gem update debugger-ruby_core_source
gem install bundler
bundle install --with mysql |
Finish configuring Avalon
...
Code Block |
---|
development: dropbox: path: '/var/avalon/dropbox/' upload_uri: 'sftp://localhost/var/avalon/dropbox' username: 'test' password: 'test' notification_email_address: '' domain: port: 80 |
...
Code Block |
---|
cd /var/www/avalon/config
rake secret |
grab the output of rake secret and add it to secrets.yml where instructed.
More information: Configuration Files#config/secrets.yml
Create controlled_vocabulary.yml
Code Block |
---|
cp controlled_vocabulary.yml.example controlled_vocabulary.yml |
Create the database using rake
...
Anchor | ||||
---|---|---|---|---|
|
Code Block |
---|
cd /var/www/avalon/config rake db:create |
If you get an error message saying that you can't connect to the database, take a look at this post and follow some of the troubleshooting steps.
Run the database migrations
Code Block |
---|
rake db:migrate |
Set rails environment to development, if it has not defaulted to this. On the first line of /var/www/avalon/config/environment.rb make sure it says 'development'
Code Block |
---|
ENV['RAILS_ENV'] ||= 'development' |
Visit your new Avalon site!
You should be able to visit the webpage with just the hostname (ie http://localhost)
Click on "Sign in" in the upper right corner of the website main page. Set up a default identity with the following properties.
Code Block |
---|
archivist1@example.com
<some password> |
This is a known identity with administrative privileges.
Redis & Resque
Avalon uses Resque for background processing, which relies Redis as its key-value store.
Install Redis
Code Block |
---|
yum install redis |
Start Resque
Code Block |
---|
# as avalon (replace production with development if necessary)
cd /var/www/avalon/
RAILS_ENV=production BACKGROUND=yes bundle exec rake resque:scheduler
RAILS_ENV=production BACKGROUND=yes QUEUE=* bundle exec rake resque:work |
Resque logs to log/resque.log in the avalon directory.
To restart rescue, simple kill its two processes (`ps aux | grep resque`) and run the above commands again.
Red5 Avalon Security Webapp
Code Block |
---|
cd /usr/local/red5/webapps
wget https://github.com/avalonmediasystem/avalon-installer/raw/master/modules/avalon/files/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
Code Block |
---|
avalon.serverUrl=http://localhost/ |
Restart Red5
Code Block |
---|
service red5 restart |
...
secret |
grab the output of rake secret and add it to secrets.yml where instructed.
More information: Configuration Files#config/secrets.yml
Create controlled_vocabulary.yml
Code Block |
---|
cp controlled_vocabulary.yml.example controlled_vocabulary.yml |
Create the database using rake
Code Block |
---|
# as avalon user
cd /var/www/avalon
rake db:create |
If you get an error message saying that you can't connect to the database, take a look at this post and follow some of the troubleshooting steps.
Run the database migrations
Code Block |
---|
rake db:migrate |
Set rails environment to development, if it has not defaulted to this. On the first line of /var/www/avalon/config/environment.rb make sure it says 'development'
Code Block |
---|
ENV['RAILS_ENV'] ||= 'development' |
Visit your new Avalon site!
You should be able to visit the webpage with just the hostname (ie http://localhost)
Click on "Sign in" in the upper right corner of the website main page. Set up a default identity with the following properties.
Code Block |
---|
archivist1@example.com
<some password> |
This is a known identity with administrative privileges.
Redis & Resque
Avalon uses Resque for background processing, which relies Redis as its key-value store.
Install Redis
Code Block |
---|
yum install redis |
Start Resque
Code Block |
---|
# as avalon (replace production with development if necessary)
cd /var/www/avalon/
RAILS_ENV=production BACKGROUND=yes bundle exec rake resque:scheduler
RAILS_ENV=production BACKGROUND=yes QUEUE=* bundle exec rake resque:work |
Resque logs to log/resque.log in the avalon directory.
To restart rescue, simple kill its two processes (`ps aux | grep resque`) and run the above commands again.
Additional Configurations
...