Installing Canvas LMS on Ubuntu Server
Instructure's Canvas LMS is a popular open-source learning management system that offers a variety of tools and features to educators for online teaching and learning. In this tutorial, we will be learning how to install Canvas on an Ubuntu server.
Prerequisites
- Ubuntu Server installed
- A terminal window opened
- Sudo user
Step 1: Updating Ubuntu
Before we begin installing Canvas, we need to update and upgrade the Ubuntu server with the latest patches and packages. To do this, open a terminal window and execute the following command:
sudo apt update && sudo apt upgrade -y
Step 2: Installing required packages
To install Canvas, we need to install a few packages that are required for its smooth installation and operation. Execute the following command to install them:
sudo apt install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs npm yarn imagemagick postfix
Step 3: Installing Ruby 2.7.2
Canvas requires Ruby 2.7.2 to run properly. We will install it by adding the Brightbox PPA repository, updating our package lists, and then installing it via apt. Execute the following commands one by one:
sudo apt-add-repository -y ppa:brightbox/ruby-ng
sudo apt update
sudo apt install ruby2.7 ruby2.7-dev
Step 4: Cloning Canvas LMS
Now that we have all the necessary packages and software installed on our server, we can clone the Canvas LMS repository using Git. Execute the following command to clone the latest version of Canvas LMS:
git clone https://github.com/instructure/canvas-lms.git
cd canvas-lms
Step 5: Installing Canvas LMS
Navigate to the root directory of the cloned Canvas LMS project and execute the following commands:
bundle config set system 'true'
bundle install --path vendor/bundle --without=sqlite
This will install all the necessary gems and dependencies that are required for Canvas to run.
Step 6: Configuring Canvas LMS
Now that we have installed Canvas LMS, we need to configure it to work with our Ubuntu server. Execute the following command to generate the configuration files:
cp config/environments/example.rb config/environments/development.rb
Then, we need to edit the development.rb file to include our database configuration. Execute the following command to edit the file:
nano config/database.yml
In the file, look for the section development: &default and replace it with the following:
development:
adapter: postgresql
encoding: unicode
database: canvas_development
pool: 5
username: canvas
password: canvas
host: localhost
port: 5432
Save and exit the file by pressing CTRL + X and then Y.
Step 7: Setting up the database
Canvas requires a PostgreSQL database to store its data. To create a new database, execute the following commands:
sudo -u postgres createuser canvas -D -A
sudo -u postgres createdb canvas_development
sudo -u postgres psql -c "ALTER USER canvas WITH PASSWORD 'canvas';"
Step 8: Precompiling assets
Before starting the canvas server, we need to compile its assets using the following command:
bundle exec rake canvas:compile_assets
Step 9: Starting the Canvas server
Finally, we can start the Canvas server by executing the following command:
bundle exec rails server -p 3000
Step 10: Accessing Canvas LMS
Canvas should now be up and running. To access it, launch a web browser and go to http://localhost:3000.
Congratulations! You have successfully installed and configured the Canvas LMS on an Ubuntu server.