,

How to Install Canvas LMS Platform on Ubuntu Linux

Canvas LMS is a versatile learning management platform with features like course management, user authentication, and device compatibility. It harmonizes with several apps enabling multimedia teaching and learning. Installation includes setting up Ruby, PostgreSQL Server, Yarn, and Rails on Ubuntu, then creating a Database, configuring Canvas, and facilitating Canvas dependencies. A guide for step-by-step environment…

This article explains how to install Canvas LMS on Ubuntu Linux.

Canvas LMS is an adaptable and customizable learning management platform that makes teaching and learning easy. It allows students and educators to create resources that empower everyone to publish and work together while improving global access to education and knowledge.

Some features included with Canvas LMS are course management, user authentication, enrollment, viewing and editing posts from any device, and many more.

Canvas LMS integrates seamlessly with hundreds of apps, empowering teachers and students with countless tools to make teaching and learning more accessible and fun.

Whether a learner or a trainer, you can create innovative and meaningful content using Canvas LMS.

For more about Canvas LMS, please check its Homepage

  • Ruby version 2.5.3
  • Rails version 5.2.1
  • PostgreSQL Server

Install Ruby

You’ll need to install some dependencies to install Ruby and Rails on Ubuntu. To make that happen, install Node.js and Yarn repositories. This will make installing the dependencies easier.

First, install these curl and git packages.

sudo apt update
sudo apt install curl git

Then, run the commands below to add Node.js and Yarn repositories and keys to your system. Then, install some core packages to get your environment going.

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update
sudo apt-get install nodejs zlib1g-dev build-essential libpq-dev libssl-dev redis-server libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev zlib1g-dev libxml2-dev libsqlite3-dev libpq-dev libxmlsec1-dev make g++ libxslt1-dev libcurl4-openssl-dev libffi-dev

When you’re done, Continue below:

After adding the repositories and installing the necessary packages above, install Ruby with your local profile settings using rbenv. You’ll then use rbenv to install ruby-build.

cd ~/
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

After setting up your local profile, run the commands below to install Ruby version 2.5.3. If a newer version is available, replace the version number with that. Then, visit this site to find out about Ruby’s latest versions.

rbenv install 2.5.3
rbenv global 2.5.3

To verify that Ruby is installed, run the commands below:

ruby -v

You should see similar lines below:

ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]

Another package management you’ll want to install is bundler. For Canvas LMS, install bundler version 1.13.6 by running the commands below:

gem install bundler -v 1.13.6

Now run the command below after installing the bundler.

rbenv rehash

Install PostgreSQL Server

PostgreSQL server can be installed on Ubuntu by running the commands below:

sudo apt-get install postgresql

The commands above won’t necessarily install the latest version of PostgreSQL. If you want the latest, you may want to read the post below:

After installing the PostgreSQL server, you can run the commands below to create a database user called canvas. When prompted to create a password, type and confirm one, then continue.

sudo -u postgres createuser canvas --no-createdb --no-superuser --no-createrole --pwprompt

After that, run the commands below to create a new database called canvas_production, then make canvas owner.

sudo -u postgres createdb canvas_production --owner=canvas

Exit and continue with installing Canvas LMS.

After installing Postgres, you must set your system username as a Postgres superuser. You can do so by running the following commands:

sudo -u postgres createuser $USER
sudo -u postgres psql -c "alter user $USER with superuser" postgres

Install Yarn

Now that the Ruby environment is set up run the commands below to install Rails. Rails can be installed from Node.Js. First, run the commands below to install the Node.js repository, then install the Node.js package.

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get update && sudo apt-get install yarn=1.10.1-1

Rubygems also come installed by default. However, it could be an old version, which will cause problems. Update using:

gem update --system

Install Canvas LMS

Now that your environment is ready run the commands below to install Canvas LMS and build your first site. Next, run the commands below.

The best way to use this guide is to follow each step as it happens. No code or step is needed to make this example application, which has been left out, so you can follow along step-by-step.

First, open a terminal, navigate to the home folder, and download Canvas packages.

cd ~/
git clone https://github.com/instructure/canvas-lms.git
cd canvas-lms
git checkout stable

While still in your home folder, run the commands below to configure the Canvas environment.

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

Next, run the commands below to create a Canvas dynamic settings file and database configuration file.

cp config/dynamic_settings.yml.example config/dynamic_settings.yml
cp config/database.yml.example config/database.yml

Edit the file config/database.yml and set your Canvas Database credentials.

nano config/database.yml

Edit the production configuration lines and save.

.
production:
   adapter: postgresql
   encoding: utf8
   database: canvas_production
   host: localhost
   username: canvas
   password: passwore_here
   timeout: 5000

Finally, run the commands below to download all Canvas dependencies.

bundle install
yarn install --pure-lockfile && yarn install --pure-lockfile
sudo npm install -g coffee-script@1.6.2

When you finish those, run the commands below to set up Canvas.

bundle exec rails db:initial_setup
bundle exec rails canvas:compile_assets
bundle exec rails server

Open up a browser on the same computer as the one running the server, navigate to http://localhost:3000/, and log in with the user credentials you set up during database configuration.

http://localhost:3000/

Congratulation! You have successfully installed the Canvas LMS platform on Ubuntu 16.04 | 18.04 | 18.10

You may also like the post below:

Richard Avatar

Comments

  1. Mauro Junior Avatar
    Mauro Junior

    Hi, Firstly thanks by the article!
    I had trying to instal in my ubuntu 18.04, but when I run bundle install I get this error:
    An error occurred while installing nokogiri-xmlsec-instructure (0.9.6), and Bundler cannot continue.
    Make sure that `gem install nokogiri-xmlsec-instructure -v ‘0.9.6’ –source ‘https://rubygems.org/’` succeeds before bundling.

    I tryed to install nokogiri-xmlsec-instructure by the tip on my error but I had this message xmlsecrb.h:8:25: fatal error: libxml/tree.h: No such file or directory

    Can you help me?

  2. Oliver Fornander Avatar
    Oliver Fornander

    If you have followed the instructions you have to cd into the install location for canvas, that’s where you should run the “bundle install” command. after that try again.

  3. I installed Canvas LMS on ubuntu 18.04 TLS but when i run on web browser no display content of this site and in terminal windows show “Completed 500 Internal server error”

    Can you help me.

  4. t3nshi Avatar

    Your tutorial is inaccurate, or maybe a bit outdated. The “`bundle exec rails db:initial_setup“` command should be done after the “`bundle exec rails canvas:compile_assets“` not before, otherwise the db setup will fail and crash the installation. Just to let know if anybody else come across this tutorial on 2020. By the way if your interested I can provide some updated steps. thanks for the tutorial, cheers!

    1. Hi can you pls send an installation update to me

  5. Pls send me updated steps

  6. mohaideen Avatar

    I have follow the above steps all but changed the ruby version from 2.5 to 2.7 because Gemfile.d/_before.rb mentioned the ruby version >=2.7 is only support so changed the ruby version using rvm ten facing node_module issue remove the yarn.lock file then run yarn install command after working fine.

Leave a Reply to t3nshi Cancel reply

Your email address will not be published. Required fields are marked *


Exit mobile version