Canvas on Centos 6.1

2,307 views
Skip to first unread message

Jason Sizemore

unread,
Dec 6, 2012, 2:49:18 PM12/6/12
to canvas-l...@googlegroups.com
Any body set up Canvas on Centos 6.1? 

Thanks 

Steve Hillman

unread,
Dec 6, 2012, 3:42:22 PM12/6/12
to canvas-l...@googlegroups.com
We've got it running on CentOS 6.3, which is probably going to be pretty close to what you've got. We've got all of the steps documented to get from vanilla OS install to running Canvas Production instance. I can send it along to you if you need it..

Jason Sizemore

unread,
Dec 6, 2012, 9:41:41 PM12/6/12
to canvas-l...@googlegroups.com
Yes that would be great.

Thank you Steve 

Jason Sizemore

unread,
Dec 6, 2012, 9:45:07 PM12/6/12
to canvas-l...@googlegroups.com
Also I am using Centos 6.3 do not know why I listed 6.1.  I have mostly working having issues with PostgreSQL. It is a new system for me.

jo...@seventwofive.com

unread,
Dec 13, 2012, 11:44:05 AM12/13/12
to canvas-l...@googlegroups.com
Steve,

Could you share the documented steps you mentioned here? It would be greatly appreciated!

Thanks!
Joshua


On Thursday, December 6, 2012 3:42:22 PM UTC-5, Steve Hillman wrote:

Steve Hillman

unread,
Dec 13, 2012, 12:10:05 PM12/13/12
to canvas-l...@googlegroups.com, jo...@seventwofive.com
Sure.

This is cut&pasted from our internal Wiki, so excuse any formatting messiness:

Prerequisites

This install guide will show you how to create a VM and install Canvas from a git repo. There are a few thing you should have in place before starting

  1. VMware Fusion (Mac) or Workstation (PC) installed and licensed (or VirtualBox, which is free)
  2. Your own github repo if you intend to do development work on Canvas. Otherwise use Instructure's repo

Installing CentOS


CentOS is the "free" version of Red Hat and most closely matches what we run in our production environments. The steps below guide you through installing all of the prerequisites needed for Canvas, but first you must install the OS itself. It is assumed that you have VMWare Fusion installed on a Mac (or VMWare Workstation on a PC). Once that is installed and licensed:

  1. Grab the CentOS 6.3 netinstall ISO from http://mirror.its.sfu.ca/mirror/CentOS/6.3/isos/x86_64/
  2. Launch VMWare and choose to create a new VM. Point it at this ISO as the source
  3. The CentOS installer will launch. Once it prompts you for the source location for the installer image, choose URL and enter "http://mirror.its.sfu.ca/mirror/CentOS/6.3/os/x86_64/"
  4. Choose the defaults with respect to disk layout, etc. No need to preserve what's on your "disk", as VMware created a blank disk image for you
  5. Choose a "Basic Server" install.
  6. Once the install completes, login as root on the console
  7. type "ifconfig -a" and find out what IP address VMware assigned to the VM
  8. From your host machine, ssh ro...@ip.address
  9. The remaining steps below can be done from your SSH session

Setting up CentOS

Install package prerequisites and extra repos (some packages further below require the most recent versions which aren't in the shipped repos 

canvas# yum update
canvas# yum -y install mysql-devel mysql-libs postgresql-libs postgresql-devel git libcurl-devel libxslt-devel libxslt-devel m2crypto gcc-c++ openssl-devel readline-devel httpd-devel apr-devel  apr-util-devel sqlite-devel

 

Disable SELinux

[root@icat-ron-canvas canvas]# setenforce 0
[root@icat-ron-canvas canvas]# getenforce 
Permissive

vi /etc/selinux/config

SELINUX=permissive

Disable IPtables

# service iptables stop
# chkconfig iptables off

You obviously shouldn't disable IPtables on a machine that has internet access, but for a VM running on your desktop NAT'd behind VMWare, this is safe to do. If you need to reach your VM from the world (i.e. run it in bridged network mode), configure iptables to allow port 80 and 443 inbound

Edit /etc/hosts

When you installed your OS image on your VM, you would have been prompted for a hostname. Add that hostname to /etc/hosts either beside the localhost entry or by adding another entry using whatever IP address VMware assigned your VM (something like 172.16.168.x). You can make up any hostname you want (e.g. canvas-me.its.sfu.ca) unless you want it reachable from somewhere other than your desktop (not recommended). Once you've picked a hostname, ensure you substitute it in various configuration locations below where you see icat-ron-canvas.its.sfu.ca. You will also need to add it to your Mac's /etc/hosts file if you want to seamlessly access it from your Mac's browser. Ensure you use the 172.16.x.y IP address in your Mac's /etc/hosts file

Create Canvas User

# adduser canvasuser
# passwd canvasuser
  <myGreatPassword>
# vi /root/.bash_profile
PATH=/opt/ruby-enterprise-1.8.7-2012.02/bin:$PATH:$HOME/bin
 
# source /root/.bash_profile

Install PostgresSQL Server

http://www.if-not-true-then-false.com/2012/install-postgresql-on-fedora-centos-red-hat-rhel/

Exclude PostgresSQL packages

vi /etc/yum.repos.d/CentOS-Base.repo
[base]
...
exclude=postgresql*
  
[updates]
...
exclude=postgresql*


Install PostgreSQL 9.2 with YUM

rpm -Uvh http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm

yum install -y postgresql postgresql-server postgresql-contrib

Initialize DB

service postgresql-9.2 initdb

Start server

service postgresql-9.2 start

Start Postgres on every boot

chkconfig --levels 235 postgresql-9.2 on


Create Canvas Postgres DB

su - postgres
-bash-4.1$ psql -c "alter user postgres with password 'myGreatPostgresPassword'"
-bash-4.1$ psql
postgres=# create user canvasuser password 'canvasPostgresPassword';
CREATE ROLE
\q
 
-bash-4.1$ createdb canvas_production -O canvasuser
-bash-4.1$ createdb canvas_queue_production -O canvasuser
-bash-4.1$ psql -l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-------------------------+------------+----------+-------------+-------------+-----------------------
canvas_production | canvasuser | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
canvas_queue_production | canvasuser | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
(5 rows)

Allow access to database

vi /var/lib/pgsql/9.2/data/pg_hba.conf
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust

Start database

service postgresql-9.2 restart

 

Install Redis

Not required, but recommended to match production environment as closely as possible

yum install redis
chkconfig --level 235 redis on
service redis start

This will install the redis server binary in /usr/sbin/redis-server using the config file at /etc/redis.conf. The default config file listens only on localhost and has data persistence enabled. This should be fine for testing purposes.

Install Ruby Enterprise

http://www.rubyenterpriseedition.com/download.html

tar xvfz ruby-enterprise-1.8.7-2012.02.tar.gz
./ruby-enterprise-1.8.7-2012.02/installer
ln -s /opt/ruby-enterprise-1.8.7-2012.02/bin/ruby /usr/bin/ruby

 

Install Phusion Passenger and Apache Configuration

/opt/ruby-enterprise-1.8.7-2012.02/bin/passenger-install-apache2-module

passenger-config --root chcon -R -h -t httpd_sys_content_t /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/gems/1.8/gems/passenger-3.0.18

Add to '/etc/httpd/conf/httpd.conf'

# Canvas
LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/gems/1.8/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
 
<VirtualHost *:80>
  ServerAlias icat-ron-canvas
  DocumentRoot /var/rails/canvas/public     
  ErrorLog /var/log/httpd/canvas_errors.log
  LogLevel warn
  CustomLog /var/log/httpd/canvas_access.log combined
  SetEnv RAILS_ENV production
  <Directory /var/rails/canvas/public>
    Allow from all
    Options -MultiViews
  </Directory>
</VirtualHost>

Create '/etc/httpd/conf.d/passenger.conf'

# For details on Passenger-specific Apache directives, see: 
PassengerRoot /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/gems/1.8/gems/passenger-3.0.18
PassengerRuby /opt/ruby-enterprise-1.8.7-2012.02/bin/ruby
PassengerDefaultUser canvasuser
# enable "high performance mode" which is incompatible with some apache modules
# such as mod_rewrite -- we don't think we need those, so this takes some load off httpd for each request
PassengerHighPerformance on
# Increase the log-level a bit while we get familiar with Passenger
PassengerLogLevel 1
# Set idle timeouts to 0 so that all Rails apps stick around
RailsAppSpawnerIdleTime 0
RailsFrameworkSpawnerIdleTime 0
PassengerPoolIdleTime 0
# Related: Minimum/maximum number of instances to start *once the application has been accessed*
PassengerMaxPoolSize 10
# Settings below here are only supported on Passenger 3.0 and above
PassengerMinInstances 2
# PreStart URLs. Passenger will "ping" this/these URL(s) to invoke the apps when Apache starts
# (note, Passenger internally replaces the host part of the URL with 'localhost', but the URL must match the VirtualHost)
PassengerPreStart http://icat-ron-canvas-its.sfu.ca/  <-- your hostname here

Install Code from git

https://github.com/instructure/canvas-lms/wiki/Production-Start

Create canvas home directory


Substitute "instructure" for "yourGitID" below if you're not forking your own repo for Canvas
cd /var
mkdir rails
mkdir rails/canvas
chown -R canvasuser rails/canvas
 
[root@icat-ron-canvas rails]# git clone https://github.com/<yourGitID>/canvas-lms.git canvas
[root@icat-ron-canvas rails]# cd canvas/
[root@icat-ron-canvas canvas]# git checkout --track -b stable origin/stable
[root@icat-ron-canvas rails]# chown -R canvasuser:canvasuser canvas/

Bundler and Canvas GEM dependencies

[root@icat-ron-canvas canvas]# gem install bundler
[root@icat-ron-canvas canvas]# gem install sqlite3-ruby
[root@icat-ron-canvas canvas]# bundle install

JavaScript Runtime using NodeJS

cd /tmp
yum localinstall -y --nogpgcheck nodejs-stable-release.noarch.rpm
yum install -y nodejs-compat-symlinks npm
yum install -y xmlsec1-openssl
cd /usr/lib64
ln -s libxmlsec1-openssl.so.1 libxmlsec1-openssl.so
 
cd /var/rails/canvas
gem install execjs

Copy and Edit config files from canvas prod or test nodes

Assuming you have a running copy of Canvas somewhere, grab your customized config files from there. If not, make sure you create or edit database.yml, domain.yml, redis.yml, and security.yml at the very least.

 

Populate Database with Canvas

export RAILS_ENV=production
bundle exec rake db:initial_setup

 

File Generation

bundle exec rake canvas:compile_assets

Install delayed jobs

ln -s /var/rails/canvas/script/canvas_init /etc/init.d/canvas_init

Start up Canvas

service httpd start

Start Delayed Jobs

/etc/init.d/canvas_init start

Jason Sizemore

unread,
Dec 13, 2012, 2:38:53 PM12/13/12
to canvas-l...@googlegroups.com
Thanks Steve for all the help in this. I can post the notes I have done on my own if people would like that.

Jason Sizemore

unread,
Dec 14, 2012, 9:26:28 AM12/14/12
to canvas-l...@googlegroups.com
Also wanted to add to these directions

 yum install xmlsec1-openssl-devel
 yum install xmlsec1-openssl

New dependencies

The location for the rpm of nodejs seems to be off line. You cannot get to http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm

I had to compile it from source not the best way but it will work.

cd /usr/local/src
tar zxvf node-v0.8.15.tar.gz
cd node-v0.8.15
./configure
make
make install

I also had a problem with building the dependencies with bundle install. Error said something like "Can't find the 'libpq-fe.h header"

This fixed that
gem install pg -- --with-pgsql-lib=/usr/pgsql-9.2/lib --with-pg-config=/usr/pgsql-9.2/bin/pg_config
Message has been deleted

Ron Santos

unread,
May 28, 2013, 12:43:15 AM5/28/13
to canvas-l...@googlegroups.com, jo...@seventwofive.com
Note, support for Ruby 1.8.7 has been dropped with the May 11 release. I suggest to install Ruby 1.9.3 instead. This post might help you installing Ruby 1.9.3 with RVM and Passenger on Centos 6 - http://www.rabblemedia.net/blog/installing-rvm-ruby-on-rails-and-passenger-on-centos-6/

Ron Santos
Senior Systems Engineer
Institutional, Collaborative, and Academic Technologies (ICAT)
IT Services
Simon Fraser University www.sfu.ca



From: craigbo...@gmail.com
To: canvas-l...@googlegroups.com
Cc: jo...@seventwofive.com
Sent: Thursday, May 23, 2013 12:41:17 PM
Subject: [Canvas] Re: Canvas on Centos 6.1

I  have followed the guide https://groups.google.com/forum/#!searchin/canvas-lms-users/canvas$20centos/canvas-lms-users/5HSvVtEAAyk/4dqEaDZKKREJ down to "Install Phusion Passenger and Apache Configuration" with no problems. Using the following command:
 
/opt/ruby-enterprise-1.8.7-2012.02/bin/passenger-install-apache2-module
 
results in:
 

/opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find passenger (>= 0) amongst [bigdecimal-1.1.0, bundler-1.3.5, bundler-1.3.5, debugger-linecache-1.1.2, debugger-ruby_core_source-1.2.2, io-console-0.3, json-1.5.5, minitest-2.5.1, rake-10.0.4, rake-0.9.2.2, rdoc-3.9.5, rubygems-bundler-1.1.1, rvm-1.11.3.7] (Gem::LoadError)

        from /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'

        from /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems.rb:1208:in `gem'

        from /opt/ruby-enterprise-1.8.7-2012.02/bin/passenger-install-apache2-module:18

passenger-config --root chcon -R -h -t httpd_sys_content_t /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/gems/1.8/gems/passenger-3.0.18

 

Any ideas on how to address this issue so I can complete the install would be great. I am installing on CentOS 6.

--
 
---
You received this message because you are subscribed to the Google Groups "Canvas LMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to canvas-lms-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages