Installation of Canvas on Ubuntu 12.04 LTS on VMWare Virtual Machine

2,189 views
Skip to first unread message

a...@anotherspot.com

unread,
Feb 21, 2013, 7:27:24 AM2/21/13
to canvas-l...@googlegroups.com
Hello,

After following the production guide many times and seeing as more fails than successes in building our test servers I though I'd share a walkthrough of our current setup.
Although not guaranteed to work it seems to work for me - The securing portion still needs some extra effort. 
You'll see some snapshots along the way. Not needed but helped get me out of trouble a couple of times.

Happy for any improvements to be suggested.

Installation was from Ubuntu Server 12.04 LTS with defaults - only package selected in installation was OpenSSH.

Install virtual kernel
sudo apt-get install linux-virtual linux-image-virtual linux-headers-virtual

Remove generic kernel
sudo apt-get remove  linux-headers-3.2.0-23 linux-headers-3.2.0-23-generic linux-image-3.2.0-23-generic
sudo update-grub

(reboot)

Install updates
sudo do-release-upgrade 
sudo apt-get upgrade 
sudo apt-get install build-essential

Install VMTools (Select Install Tools in VMWare Guest Controls)
sudo mkdir /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom/
cp /mnt/cdrom/VMwareTools-9.0.0-782409.tar.gz ~
tar xzvf VMwareTools-9.0.0-782409.tar.gz
cd vmware-tools-distrib
sudo perl ./vmware-install.pl
Yes to vmsync
No to Fusion Options
No to Kernel Build Option 

(shutdown with snapshot) 

Update the package repository
sudo apt-get update

Install git and dependencies
sudo apt-get -y install git zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl python-software-properties

Install PostgreSQL 9.1.3
sudo apt-get -y install postgresql libpq-dev

Install Apache Dev and dependencies
sudo apt-get -y install apache2 apache2-prefork-dev libapr1-dev libaprutil1-dev

(shutdown with snapshot) 

Install RVM and Users for Canvas/RVM
curl -L get.rvm.io | sudo bash -s stable
source /etc/profile.d/rvm.sh
sudo apt-get -y --no-install-recommends install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev bash curl git patch 

sudo nano /etc/environment
"/usr/local/rvm/bin" add to path

Configure Users for Canvas and RVM
sudo adduser --disabled-password --gecos "Canvas User" canvas
sudo adduser canvas rvm
sudo adduser sysadmin canvas
sudo adduser sysadmin rvm
sudo chown -R canvas:canvas /var/www
sudo chmod g+w /var/www

Install Ruby 1.9.3 using RVM (Logout and login first)
source "/usr/local/rvm/scripts/rvm"
rvm install 1.9.3 
rvm use 1.9.3 --default

gem install bundler

Install Passenger (make sure to take note of the passenger installation paths etc)
gem install passenger
passenger-install-apache2-module

Install NodeJS
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get -y install nodejs

Install Redis Server
sudo apt-get -y install redis-server

Install OpenJDK (Avoids some warnings when Jammer gem compiles)
sudo apt-get -y install openjdk-7-jdk openjdk-7-jre-headless

Install Canvas Dependencies , Update Gems and Install Bundle
sudo apt-get -y install libxml2-dev libxslt1-dev imagemagick  libpq-dev libxmlsec1-dev libxmlsec1 zip unzip

Install Canvas Code using GIT
sudo mkdir -p /var/rails/canvas 
sudo chown -R sysadmin /var/rails/canvas
sudo chmod -R 775 /var/rails/canvas
cd /var/rails

Configure Postgresql
sudo -u postgres createuser
Enter name of role to add: canvas
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n

sudo -u postgres createdb canvas_production -O canvas
sudo -u postgres createdb canvas_queue_production -O canvas
sudo -u postgres psql
alter user canvas with encrypted password 'Password';
grant all privileges on database canvas_production to canvas;
grant all privileges on database canvas_queue_production to canvas;
\q

Setup Canvas Prefs
cd /var/rails/canvas
for config in amazon_s3 database delayed_jobs domain file_store outgoing_mail security external_migration cache_store redis memcache logging incoming_mail; do cp config/$config.yml.example config/$config.yml; done

nano config/database.yml
nano config/outgoing_mail.yml
nano config/domain.yml
nano config/cache_store.yml
nano config/redis.yml
nano config/incoming_mail.yml

Setup Canvas QTI Tool
cd /var/rails/canvas/vendor
chmod +x ./QTIMigrationTool/migrate.py

Install Canvas Gemset
source "/usr/local/rvm/scripts/rvm"
cd /var/rails/canvas
bundle install

(shutdown with snapshot) 

Compile Canvas
cd /var/rails/canvas
source "/usr/local/rvm/scripts/rvm"
sudo chown -R sysadmin:sysadmin /var/rails/canvas
RAILS_ENV=production bundle exec rake db:initial_setup 
RAILS_ENV=production bundle exec rake canvas:compile_assets

Secure Canvas (Needs improvement on Ubuntu)
cd /var/rails/canvas
sudo mkdir -p log tmp/pids public/assets public/stylesheets/compiled
sudo touch Gemfile.lock
sudo chown -R canvas config/environment.rb log tmp public/assets public/stylesheets/compiled Gemfile.lock
sudo chown canvas config/*.yml
sudo chmod 400 config/*.yml

Setup Apache
sudo a2enmod rewrite
sudo a2enmod ssl

sudo nano /etc/apache2/mods-available/passenger.load
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p374/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
sudo nano /etc/apache2/mods-available/passenger.conf
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p374/gems/passenger-3.0.19
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p374/ruby

sudo a2enmod passenger

cd /etc/apache2/sites-enabled
sudo unlink 000-default
sudo nano /etc/apache2/sites-available/canvas

irfan...@enovatemedia.com

unread,
Feb 22, 2013, 4:02:16 AM2/22/13
to canvas-l...@googlegroups.com, a...@anotherspot.com
Hi,

I have tried your method but getting error while initializing the DB.


RAILS_ENV=production bundle exec rake db:initial_setup  
   rake aborted!
FATAL:  password authentication failed for user "canvas"

My database.yml file is as follows;

# do not create a queue: section for your test environment
test:
  adapter: postgresql
  encoding: utf8
  database: canvas_test
  host: localhost
  username: canvas
  timeout: 5000

test-in-memory:
  adapter: sqlite3
  encoding: utf8
  database: ':memory:'
  pool: 1

development:
  adapter: postgresql
  encoding: utf8
  database: canvas_development
  timeout: 5000
  queue:
    adapter: postgresql
    encoding: utf8
    database: canvas_queue_development
    timeout: 5000

production:
  adapter: postgresql
  encoding: utf8
  database: canvas_production
  host: localhost
  username: canvas
  password: Password
  timeout: 5000
  queue:
    adapter: postgresql
    encoding: utf8
    database: canvas_queue_production
    host: localhost
    username: canvas
    password: Password
    timeout: 5000

nos...@gmail.com

unread,
Feb 22, 2013, 8:34:32 PM2/22/13
to canvas-l...@googlegroups.com, a...@anotherspot.com
what about the rest of your guide? apache sites-available/canvas config?

irfan...@enovatemedia.com

unread,
Feb 23, 2013, 6:04:01 AM2/23/13
to canvas-l...@googlegroups.com, a...@anotherspot.com, nos...@gmail.com
you can get the apache virtualhost site configuration from https://github.com/instructure/canvas-lms/wiki/Production-Start

Dukhoon Kang

unread,
Feb 22, 2013, 4:24:11 AM2/22/13
to canvas-l...@googlegroups.com

In my case the same error occured when the password not quotd. And solved now.

2013. 2. 22. 오후 6:02에 <irfan...@enovatemedia.com>님이 작성:
--
 
---
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.
 
 

Irsandi Hasan

unread,
Apr 7, 2013, 1:55:13 AM4/7/13
to canvas-l...@googlegroups.com, a...@anotherspot.com
Hello,

I'm follow your installation step, but with the latest stable i got error. have you try this manual with the latest stable ?
i've create a issue here for the error : https://github.com/instructure/canvas-lms/issues/286
Reply all
Reply to author
Forward
0 new messages