How To

Install Canvas LMS on Ubuntu (Easy Guide for 2024!)

Welcome to our guide on how to install Canvas LMS on Ubuntu Linux. Canvas is an open source learning management system (LMS) that has been adopted by schools, universities, and other educational institutions in delivery of online courses and to support online learning. By using Canvas, instructors are able to create and manage course materials, assignments, and assessments content online for students.

Original content from computingforgeeks.com - post 8649

Some of the features of Canvas LMS includes:

  • Availability of Mobile apps for iOS and Android devices.
  • The course homepage and navigation menu are highly customizable.
  • It has grading tools for lectures, readings, and other course materials
  • Students can submit assignments from the portal
  • Discussions forums and collaboration between students is possible
  • It supports integration with third-party tools such as Turnitin and Google Drive

Canvas Software Requirements

Canvas LMS depend on the following software packages to run.

  • Apache Web Server
  • Ruby on Rails
  • PostgreSQL database server

Here are the steps of installing and configuring the Canvas Learning Management System on Ubuntu.

The automatic installation method uses Docker container to run Canvas services.

Install Docker

Run below commands to install the latest release of Docker which works fine for Discourse.

wget -qO- https://get.docker.com/ | sudo sh

If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with:

sudo usermod -aG docker $USER

You can query for installed version using the command below.

$ docker version
Client: Docker Engine - Community
Version: 27.0.3
API version: 1.46
Go version: go1.21.11
Git commit: 7d4bcd8
Built: Sat Jun 29 00:02:23 2024
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 27.0.3
API version: 1.46 (minimum version 1.24)
Go version: go1.21.11
Git commit: 662f78c
Built: Sat Jun 29 00:02:23 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.18
GitCommit: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
runc:
Version: 1.7.18
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Docker should be in a running status.

$ systemctl status  docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled)
Active: active (running) since Mon 2024-07-08 21:40:35 UTC; 1min 18s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 15013 (dockerd)
Tasks: 7
Memory: 20.2M (peak: 22.6M)
CPU: 252ms
CGroup: /system.slice/docker.service
└─15013 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Jul 08 21:40:35 noble systemd[1]: Starting docker.service - Docker Application Container Engine...
Jul 08 21:40:35 noble dockerd[15013]: time="2024-07-08T21:40:35.220816465Z" level=info msg="Starting up"
Jul 08 21:40:35 noble dockerd[15013]: time="2024-07-08T21:40:35.221833716Z" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/res>
Jul 08 21:40:35 noble dockerd[15013]: time="2024-07-08T21:40:35.283782721Z" level=info msg="Loading containers: start."
Jul 08 21:40:35 noble dockerd[15013]: time="2024-07-08T21:40:35.473275822Z" level=info msg="Loading containers: done."
Jul 08 21:40:35 noble dockerd[15013]: time="2024-07-08T21:40:35.489857538Z" level=info msg="Docker daemon" commit=662f78c containerd-snapshotter=false storage-driver=overlay2 version=27.0.3
Jul 08 21:40:35 noble dockerd[15013]: time="2024-07-08T21:40:35.489950479Z" level=info msg="Daemon has completed initialization"
Jul 08 21:40:35 noble dockerd[15013]: time="2024-07-08T21:40:35.519733499Z" level=info msg="API listen on /run/docker.sock"
Jul 08 21:40:35 noble systemd[1]: Started docker.service - Docker Application Container Engine.

Clone the repository:

git clone https://github.com/instructure/canvas-lms.git

Then run installer script.

$ cd canvas-lms
$ ./script/docker_dev_setup.sh

  ________  ________  ________   ___      ___ ________  ________
|\   ____\|\   __  \|\   ___  \|\  \    /  /|\   __  \|\   ____\
\ \  \___|\ \  \|\  \ \  \\ \  \ \  \  /  / | \  \|\  \ \  \___|_
 \ \  \    \ \   __  \ \  \\ \  \ \  \/  / / \ \   __  \ \_____  \
  \ \  \____\ \  \ \  \ \  \\ \  \ \    / /   \ \  \ \  \|____|\  \
   \ \_______\ \__\ \__\ \__\\ \__\ \__/ /     \ \__\ \__\____\_\  \
    \|_______|\|__|\|__|\|__| \|__|\|__|/       \|__|\|__|\_________\
                                                         \|_________|

Welcome! This script will guide you through the process of setting up a
Canvas development environment with docker and dinghy/dory.

When you git pull new changes, you can run ./scripts/docker_dev_update.sh
to bring everything up to date.

> First, we need to install some dependencies.
OK to run 'sudo apt-get update && sudo apt-get install -y docker-compose'? [y/n] y

Agree to all other prompts to finish the installation of Canvas LMS.

Manual Installation of Canvas (Not Recommended)

For manual installation of Canvas LMS on Ubuntu, use the steps below.

Step 1: Install Canvas dependencies

Here we will install Ruby and Node.js software packages. Let’s start with the installation of Node.js.

curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install nodejs
sudo npm install -g npm@latest

Supported Ruby version is on a PPA repository, add it like below.

sudo apt install software-properties-common
sudo add-apt-repository ppa:brightbox/ruby-ng
sudo apt update
sudo apt install ruby2.7 ruby2.7-dev zlib1g-dev libxml2-dev \
                       libsqlite3-dev postgresql libpq-dev \
                       libxmlsec1-dev libidn11-dev curl make g++

Confirm ruby version.

$ ruby -v
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux-gnu]

Finally install Yarn.

sudo npm -g install yarn

Step 2: Install PostgreSQL database server

Canvas uses PostgreSQL to store its data. Install PostgreSQL on Ubuntu using our guide below.

Once the database server is installed, create database for Canvas and user named canvas.

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

Provide user password and confirm when prompted. Then create canvas database.

createdb canvas --owner=canvas

You can optionally set your system username as a postgres superuser.

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

Step 3: Clone Canvas LMS project

Clone the latest source for Canvas.

git clone https://github.com/instructure/canvas-lms.git /var/canvas

Checkout stable branch.

cd /var/canvas
git checkout stable

Step 4: Configure Canvas

Change to /var/canvas directory and pull in the default configuration values.

cd /var/canvas
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

Do the same for Database and Dynamic settings.

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.

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

Install Bundler using Ruby Gems:

sudo gem install bundler --version 2.2.33

Install Canvas Dependencies

bundle config set --local path vendor/bundle
bundle install
yarn install --pure-lockfile && yarn install --pure-lockfile

Population database with tables and data.

bundle exec rails db:initial_setup

Sample output is as shown below.

install canvas ubuntu 18.04 012

Build a number of Canvas assets using:

bundle exec rails canvas:compile_assets

Finally start the Canvas server.

bundle exec rails server

Related Articles

Databases How To Install OpenSearch on Ubuntu 22.04|20.04|18.04 Databases How To Install MongoDB on Ubuntu 24.04 Ubuntu How To Install Erlang on Ubuntu 24.04 (Noble Numbat) Debian Install Grafana Tempo on Ubuntu 24.04 / Debian 13

1 thought on “Install Canvas LMS on Ubuntu (Easy Guide for 2024!)”

Leave a Comment

Press ESC to close