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
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:
Install package prerequisites and extra repos (some packages further below require the most recent versions which aren't in the shipped repos
canvas# yum updatecanvas# 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-develcanvas# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm |
[root@icat-ron-canvas canvas]# setenforce 0
[root@icat-ron-canvas canvas]# getenforce
Permissive
vi /etc/selinux/config
SELINUX=permissive
# 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
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
# adduser canvasuser# passwd canvasuser <myGreatPassword># vi /root/.bash_profilePATH=/opt/ruby-enterprise-1.8.7-2012.02/bin:$PATH:$HOME/bin # source /root/.bash_profile |
http://www.if-not-true-then-false.com/2012/install-postgresql-on-fedora-centos-red-hat-rhel/
vi /etc/yum.repos.d/CentOS-Base.repo[base]...exclude=postgresql* [updates]...exclude=postgresql* |
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
service postgresql-9.2 initdb
service postgresql-9.2 start
chkconfig --levels 235 postgresql-9.2 on
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 -lList of databasesName | 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/postgrestemplate1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres: postgres=CTc/postgres(5 rows) |
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 |
service postgresql-9.2 restart
Not required, but recommended to match production environment as closely as possible
yum install redischkconfig --level 235 redis onservice 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.
http://www.rubyenterpriseedition.com/download.html
tar xvfz ruby-enterprise-1.8.7-2012.02.tar.gz./ruby-enterprise-1.8.7-2012.02/installerln -s /opt/ruby-enterprise-1.8.7-2012.02/bin/ruby /usr/bin/ruby |
/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
# CanvasLoadModule 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> ServerName icat-ron-canvas.its.sfu.ca 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> |
# 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.18PassengerRuby /opt/ruby-enterprise-1.8.7-2012.02/bin/rubyPassengerDefaultUser 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 requestPassengerHighPerformance on# Increase the log-level a bit while we get familiar with PassengerPassengerLogLevel 1# Set idle timeouts to 0 so that all Rails apps stick aroundRailsAppSpawnerIdleTime 0RailsFrameworkSpawnerIdleTime 0PassengerPoolIdleTime 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 abovePassengerMinInstances 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 |
cd /varmkdir railsmkdir rails/canvaschown -R canvasuser rails/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/ |
[root@icat-ron-canvas canvas]# gem install bundler[root@icat-ron-canvas canvas]# gem install sqlite3-ruby[root@icat-ron-canvas canvas]# bundle install |
cd /tmpcurl -O http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpmyum localinstall -y --nogpgcheck nodejs-stable-release.noarch.rpmyum install -y nodejs-compat-symlinks npmyum install -y xmlsec1-opensslcd /usr/lib64ln -s libxmlsec1-openssl.so.1 libxmlsec1-openssl.so cd /var/rails/canvasgem install execjs |
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.
export RAILS_ENV=productionbundle exec rake db:initial_setup |
bundle exec rake canvas:compile_assets
ln -s /var/rails/canvas/script/canvas_init /etc/init.d/canvas_init
service httpd start
/etc/init.d/canvas_init start
/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.