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-distribsudo perl ./vmware-install.plYes 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
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