官方安装教程地址:https://github.com/instructure/canvas-lms/wiki/Production-Start
大家可以按照官方的地址一步一步安装。
Canvas被Black Duck标榜为"唯一的一款商业开源学习管理系统,而且是唯一的一款部署在云端的学习管理系统LMS"。
sudo apt-get install postgresql-9.3
sudo -u postgres createuser canvas --no-createdb \
--no-superuser --no-createrole --pwprompt
sudo -u postgres createdb canvas_production --owner=canvas
sudo apt-get install git-core
git clone https://github.com/instructure/canvas-lms.git canvas
cd canvas
git branch --set-upstream-to origin/stable
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.2 ruby2.2-dev zlib1g-dev libxml2-dev \
libsqlite3-dev postgresql libpq-dev \
libxmlsec1-dev curl make g++
sudo apt-get install ruby2.1 ruby2.1-dev zlib1g-dev libxml2-dev \
libsqlite3-dev postgresql libpq-dev \
libxmlsec1-dev curl make g++
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs
sudo -u postgres createuser $USER
sudo -u postgres psql -c "alter user $USER with superuser" postgres
sudo gem install bundler --version 1.12.5
bundle install --path vendor/bundle
for config in amazon_s3 database \
delayed_jobs domain file_store outgoing_mail security external_migration; \
do cp config/$config.yml.example config/$config.yml; done
cp config/database.yml.example config/database.yml
nano config/database.yml
cp config/outgoing_mail.yml.example config/outgoing_mail.yml
nano config/outgoing_mail.yml
cp config/domain.yml.example config/domain.yml
nano config/domain.yml
cp config/security.yml.example config/security.yml
nano config/security.yml
cd /var/canvas
RAILS_ENV=production bundle exec rake db:initial_setup
sudo adduser --disabled-password --gecos canvas canvasuser
cd /var/canvas
mkdir -p log tmp/pids public/assets public/stylesheets/compiled
touch Gemfile.lock
sudo chown -R canvasuser config/environment.rb log tmp public/assets \
public/stylesheets/compiled Gemfile.lock config.ru
npm install
RAILS_ENV=production bundle exec rake canvas:compile_assets
sudo chown canvasuser config/*.yml
sudo chmod 400 config/*.yml
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update
sudo apt-get install passenger libapache2-mod-passenger apache2
sudo a2enmod rewrite
sudo a2enmod ssl
sudo unlink /etc/apache2/sites-enabled/000-default.conf
sudo nano /etc/apache2/sites-available/canvas.conf
内容:可以对应修改一下域名等信息<VirtualHost *:80>
ServerName canvas.example.com
ServerAlias files.canvas.example.com
ServerAdmin youremail@example.com
DocumentRoot /var/canvas/public
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteCond %{REQUEST_URI} !^/health_check
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
ErrorLog /var/log/apache2/canvas_errors.log
LogLevel warn
CustomLog /var/log/apache2/canvas_access.log combined
SetEnv RAILS_ENV production
<Directory /var/canvas/public>
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerName canvas.example.com
ServerAlias files.canvas.example.com
ServerAdmin youremail@example.com
DocumentRoot /var/canvas/public
ErrorLog /var/log/apache2/canvas_errors.log
LogLevel warn
CustomLog /var/log/apache2/canvas_ssl_access.log combined
SSLEngine on
BrowserMatch "MSIE [2-6]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
# the following ssl certificate files are generated for you from the ssl-cert package.
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
SetEnv RAILS_ENV production
<Directory /var/canvas/public>
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
sudo a2ensite canvas
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server
cd /var/canvas/
cp config/cache_store.yml.example config/cache_store.yml
nano config/cache_store.yml
sudo chown canvasuser config/cache_store.yml
sudo chmod 400 config/cache_store.yml
配置内容如下test:
cache_store: redis_store
development:
cache_store: redis_store
production:
cache_store: redis_store
cd /var/canvas/
cp config/redis.yml.example config/redis.yml
nano config/redis.yml
sudo chown canvasuser config/redis.yml
sudo chmod 400 config/redis.yml
配置内容如下:production:
servers:
- redis://localhost
sudo ln -s /var/canvas/script/canvas_init /etc/init.d/canvas_init
sudo update-rc.d canvas_init defaults
sudo /etc/init.d/canvas_init start
sudo /etc/init.d/apache2 restart