How to Install Canvas LMS on Ubuntu 18.04

canvas-lms
canvas-lms

Getting  Canvas LMS Pre-installed

If you want to skip the installation of Canvas LMS and purchase a pre-installed VPS Canvas already installed, or alternatively, have a secure instance of Canvas LMS hosted on your own domain, please contact me by email  (joseph@ripplesoftware) or via contact page for more details.

The full instructions for installing Canvas LMS on your own Ubuntu 18.04 server are below.

Installing Canvas LMS on Ubuntu 18.04

8GB of ram is recommended for a server running Canvas LMS. However, it is possible that you can install and run Canvas LMS on a server with only 4GB or less. This installation was done on a Digital Ocean Ubuntu 18.04 VPS. Be sure to point your domain’s name-servers at your correct cloud host and edit your DNS networking so that your domain is pointed at your server before you begin. You can check using nslookup command as shown below. The result should show the IP of the sever you are setting up.

Check if your domain is being resolved properly

Install NTP Network Time Protocol

Install NTP Network Time Protocol

Setup crontab

Enable Persistant log jourlanling

Enable Swap space

Install Firewalld and config

Install Fail2ban

Install required OS Packages

Install required Python Packages

Configure Apache

Enable Apache Security Modules

Configure Firewall

Install Ruby

Install Passenger for Ubuntu 18 via Yum and Other Gems

Update and restart Apache

Install PostgresSQL

At the psql# prompt

Exit from the postgres user and return to root

Install PostgreSQL specific Ruby gems and configure firewall

Install Yarn and NodeJS

Install Redis (Not required)

Modify Ubuntu user default shell

change

to

Create system user for canvas

Download Canvas Repository

Edit config files

Add the database credentials created in PostgreSQL to database config file

Add the domain information to config file

Replace the key with random characters

Configure with SMTP settings for mail

Configure with SMTP settings for mail

Configure the environment

Copy the following code into the /etc/.bashrc file and save

Bundle and Install Canvas

Exit from the canvas user to root user

Move the Canvas v-host file into place

Paste the following code into the file

Connect SSL Cert with EFF Certbot

Start Canvas Service

At this point you should be able to visit your site from the domain you used during the setup. If you see a permissions error, you should make sure that the permissions have been set correctly for the public/ folder.

If you to do not see the Canvas LMS home page to login, you can check the Apache logs or the Canvas application logs to see what has gone wrong.

10 Comments on How to Install Canvas LMS on Ubuntu 18.04

  1. Install required OS Packages shows errors
    E: Package ‘apache’ has no installation candidate
    E: Unable to locate package sqlite-devel
    E: Unable to locate package xmlsec1-openssl
    E: Unable to locate package xmlsec1-devel
    E: Unable to locate package xmlsec1-openssl-devel
    E: Unable to locate package libxslt-devel

    • I have modified the installation of OS packages section to break down into multiple parts. If apt-get still cannot locate a package you should look up each package and find out how to install on your version of Ubuntu. Also it sounds like you are likely using Ubuntu version 20.04 since python-pip is available for Ubuntu 18.04 but not 20.04. These instructions are written for Ubuntu 18.04. I don’t believe that Canvas LMS has been tested or is supported for Ubuntu 20.04.

      • Hi there, I am using Digital Ocean VPS and Ubuntu 18.04. I notices these errors.

        1. after input: sudo sh -c ‘echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list’sudo apt-get update

        you get this error: N: Ignoring file ‘passenger.listsudo’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension

        2. gem install bcrypt -v ‘3.1.13’ –source ‘https://rubygems.org/‘
        needs to change “‘” to “‘”

        3. when input: touch /home/canvas/.bash_profile
        gets error msg: touch: cannot touch ‘/home/canvas/.bash_profile’: No such file or directory

        4. when input: /etc/.bashrc >> export RAILS_ENV=production
        gets error msg: /etc/.bashrc: command not found

        • Thanks for finding those error and pointing them out to me. I have corrected the code. If you notice any other errors, please let me know!

          • 1. input: chkconfig ntpd on
            error: chkconfig: command not found

            input: systemctl enable ntpd
            error: Failed to enable unit: Unit file ntpd.service does not exist.

            input: systemctl start ntpd
            error: Failed to start ntpd.service: Unit ntpd.service not found.

            2.
            input: apt-get install -y libxslt-devel libxmlsec1-openssl libxmlsec1 libxml2 libxml2-dev xmlsec1-devel xmlsec1-openssl-devel
            error:
            E: Unable to locate package libxslt-devel
            E: Unable to locate package xmlsec1-devel
            E: Unable to locate package xmlsec1-openssl-devel

            3. input: apt-get install -y mod_ssl mod_evasive mod_security
            error:
            E: Unable to locate package mod_ssl
            E: Unable to locate package mod_evasive
            E: Unable to locate package mod_security

            Should it be sudo a2enmod ssl??

            3. setsebool -P httpd_can_sendmail 1
            error: setsebool: SELinux is disabled.

            4. apt-get install -y dirmngr gnup
            error: E: Unable to locate package gnup
            (should it be gnupg?)

            5. apt-get install -y libapache2-mod-passenger

            error:
            E: Unable to correct problems, you have held broken packages.
            root@CanvasLMS:~# apt-get install -y libapache2-mod-passenger
            Reading package lists… Done
            Building dependency tree
            Reading state information… Done
            Some packages could not be installed. This may mean that you have
            requested an impossible situation or if you are using the unstable
            distribution that some required packages have not yet been created
            or been moved out of Incoming.
            The following information may help to resolve the situation:

            The following packages have unmet dependencies:
            libapache2-mod-passenger : Depends: passenger (= 1:6.0.6-1~xenial1) but it is not going to be installed
            E: Unable to correct problems, you have held broken packages.

            fix:

            sudo apt-get install -y dirmngr gnupg
            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 bionic main > /etc/apt/sources.list.d/passenger.list’
            sudo apt-get update

            sudo apt-get install -y libapache2-mod-passenger

            6. input: apt-get install -y bundle
            E: Unable to locate package bundle

            7. input: yarn install –pure-lockfile
            msg
            yarn install v1.22.5
            info No lockfile found.
            warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
            [1/4] Resolving packages…
            [2/4] Fetching packages…
            [3/4] Linking dependencies…
            [4/4] Building fresh packages…

          • There should have been an update a at the first line, so I modified include that. It will fix most of those errors. Otherwise, I found Canvas to be a brutal installation with so many dependencies. If you want I can provide a VPS instance of Canvas on Ubuntu, but it’s costly.

  2. RAILS_ENV=production bundle exec rake brand_configs:generate_and_upload_all

    Got error :

    Could not find thrift-0.9.3.0 in any of the sources
    Run `bundle install` to install missing gems.

    Please help me out

  3. above error was fixed

    but now I’m getting this following error when i enter /etc/init.d/canvas_init start :

    The git source https://github.com/rails-api/active_model_serializers.git is not yet checked out. Please run `bundle install` before trying to start your application

    I’M USING UBUNTU 18.04

    please help

Leave a Reply to Joseph Lee Cancel reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.