52
How to install Open edx on Ubuntu 20.04
Open edX is an open-source platform you can use to create and host online courses. It was originally developed in 2012 by scientists at MIT and Harvard University and has since been adopted by organizations of all shapes and sizes to power a wide range of online learning use cases.
Open edX is the world's leading online learning platform. Google, Microsoft LaaS are just some of its users who use it to train employees and onboard new customers.
It has also been adopted by Harvard, MIT, Arizona State University among others for both interactive content delivery as well as progress tracking capabilities in large courses with multiple participants at once through an open-source system that can be downloaded easily free of cost from their website.
You can find some of the real-world examples here:
One of the most prominent features of the Open edX learning platform is self-paced training, which allows students to learn at their own pace. Other features include online discussion groups, wiki-based collaborative learning, learning assessments as a student progresses through a course, right-to-left language support, learner analytics, cohort-specific content.
As you complete this article, your production-ready Open edX platform is installed on a Ubuntu 20.4 server that can serve thousands of students and host multiple courses with ease.
Since 2012 Open edX team released 12 versions of this learning management system. Each new release contains several new features for learners, course teams, and developers. You can view full release notes for each version on the Open edX website.
This article describes the steps needed to install Lilac on Ubuntu 20.04.
An understanding of the following items is required for this installation option:
- Basic terminal usage
- The basics of how Python web applications are built, installed, and deployed.
- How to manage a Linux system, including supervisor.
- The basics of configuration management and automation using Ansible.
A single server can support hundreds of registered students if the following requirements are met.
You need a Ubuntu 20.04 amd64 server(oraclejdk required). This server should be accessible over SSH and have a public IP address associated with it for hosting your Open edX instance publicly available on the internet.
To run Open edX successfully, you need a minimum of 8GB of memory. Please ensure that your server has more memory than that. For better performance, you can utilize a larger compute instance size depending on the amount of memory you need to serve students.
If you want to have a few courses and video materials, it's suggested that you have more than 50GB of disk space.
If wget is not installed already, run sudo apt-get install wget
An understanding of the following items is required for this installation option:
After creating your Ubuntu server, Open the following HTTP ports used by Open edx
- 80
- 443
- 22
- 18010
- 18000
Launch your server and log in to it via SSH as a user that has full sudo privileges. Update your Ubuntu package sources:
sudo apt-get update -y
sudo apt-get upgrade -y
sudo reboot
export OPENEDX_RELEASE=open-release-lilac.master
wget https://raw.githubusercontent.com/edx/configuration/open-release/lilac.master/util/install/ansible-bootstrap.sh -O - | sudo bash
Create a directy for edx-configs
where all the ansible configurations goes, download the configuration variables there, and generate strong passwords for different services like different MySQL users and MongoDB.
mkdir edx-configs && cd edx-configs
sudo wget https://raw.githubusercontent.com/edx/configuration/open-release/lilac.master/playbooks/sample_vars/passwords.yml
sudo wget https://raw.githubusercontent.com/cubiteDevops/do-edx-configs/main/vars.yml
while IFS= read line; do REPLACE=$(LC_ALL=C < /dev/urandom tr -dc 'A-Za-z0-9' | head -c35) && echo "$line" | sed "s/\!\!null/\'$REPLACE\'/"; done < ./passwords.yml | sudo tee ./my-passwords.yml
Be sure to save the generated passwords in a safe place
Create a directory for theming assets and download Lilac theme there.
mkdir /edx-themes && sudo chmod -R 777 /edx-themes && cd /edx-themes
git clone https://github.com/cubitetech/theme -b lilac cubite-theme
This theme is responsive and made with one of the best frontend technologies, TailwindCSS.
These instructions will potentially destroy the server they are run on, you should only do them on a freshly installed virtual machine
This can take some time, perhaps an hour.
cd /edx/app/edx_ansible/edx_ansible/playbooks/ && git checkout open-release/lilac.master
sudo /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook -c local ./openedx_native.yml -i 'localhost,' -e@/root/edx-configs/my-passwords.yml -e@/root/edx-configs/vars.yml
- Ubuntu may alert you that a newer version of Ubuntu is available when you SSH into your server and may suggest that you run
do-release-upgrade
to upgrade to that newer version. Don’t do it. - Pip may alert you that there is a newer version of pip available and may suggest that you run
pip install --upgrade pip
to install it. ** Don’t do it**.
application software files for all Open edx modules
all Ansible playbooks. You’ll learn a lot about how Ansible works simply by learning more about its folder structure
location to store server-vars.yml (further described in downstream repos)
“home” folder for all pip, ansible, and bash admin utilities
configuration files for all edx modules
all data (app, logs, etcetera)
After the installation is successful you need a superuser to be able to access the Django admin portal. To add superuser to your instance, SSH to the server and run the following command
sudo -H -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/edx-platform
python manage.py lms --settings=production createsuperuser
The prompt asks for a username, an email, and a password. After the user creation is complete visit http://public\_ip\_of\_your\_server/admin and login with the username (not the email) and password you picked previously.
This user has full access to your platform, Make sure you save your username and password in a secure place.
Installing an SSL certificate on your OpenX server is the best way to ensure security for both yourself and your students. The installation process only takes a few minutes.
It's highly recommended to install an SSL certification as soon as possible to keep users safe from any potential cyber-attacks.
Open edx runs on Nginx, a fast, bare-bones webserver alternative to Apache, and like Apache, Nginx can host multiple virtual web servers on the same Ubuntu server instance. Each Open edX instance has at least 3 URLs. One for LMS, one for Studio, and One for Preview. Create A record in your DNS for each URL pointing to your server's public IP address. For example
mysite.com #LMS record
studio.mysite.com #Studio record
preview.mysite.com #Preview record
Open edX and edX are registered trademarks. You may not use “openedx.” or “edx.” as subdomains when naming your site. Here are some examples of unacceptable domain names:
- DON’T : openedx.yourdomain.org
- DON’T : edx.yourdomain.org
- DON’T : openedxyourdomain.org
- DON’T : yourdomain-edx.com
open /edx/etc/lms.yml
file with your favorite editor. Change following variables to domain names you just assigned to your instance
PREVIEW_LMS_BASE: preview.mysite.com
LMS_BASE: mysite.com
LMS_ROOT_URL: https://mysite.com
CMS_BASE: studio.mysite.com
CROSS_DOMAIN_CSRF_COOKIE_DOMAIN:
LOGIN_REDIRECT_WHITELIST:
- studio.mysite.com
open/edx/etc/studio.yml
file with your favorite editor. Change following variables to domain names you just assigned to your instance
PREVIEW_LMS_BASE: preview.mysite.com
LMS_BASE: mysite.com
LMS_ROOT_URL: https://mysite.com
CMS_BASE: studio.mysite.com
LMS_INTERNAL_ROOT_URL: https://mysite.com
CROSS_DOMAIN_CSRF_COOKIE_DOMAIN:
LOGIN_REDIRECT_WHITELIST:
- studio.mysite.com
open /edx/app/nginx/sites-available/lms
file with our favorite editor and add the following after server {
section
server_name mysite.com preview.mysite.com
It should look like following
server {
server_name mysite.com preview.mysite.com
.
.
.
.
.
.
open /edx/app/nginx/sites-available/cms
file with our favorite editor and add the following after server {
section
server_name studio.mysite.com
It should look like following
server {
server_name studio.mysite.com
.
.
.
.
.
.
The published installation procedure on the official Certbot site changed in late 2020. The good news is that the new installation procedure is very simple to follow assuming that you are running Ubuntu 20.04 LTS or later:
sudo apt-get update
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx
When the prompt asks you for the Domain names, Make sure it covers LMS, Studio, and Preview addresses. Also, Choose Redirect to redirect all HTTP connections to HTTPS
Now you need to restart Nginx
sudo systemctl restart nginx
To verify that your configuration edits are correct you should check the server status after restarting:
sudo systemctl status nginx
If everything works then your Open edX LMS and CMS should automatically redirect to https.
The Certbot packages on your system come with a cron job that will renew your certificates automatically before they expire. Since Let’s Encrypt certificates expire after only 90 days, it’s highly advisable to take advantage of this feature. You can test automatic renewal for your certificates by running this command:
sudo certbot renew --dry-run
If that appears to be working correctly, you can arrange for automatic renewal by adding a cron job that runs the following command regularly:
certbot renew
Create a new cron job and add renew command there.
crontab -e
and next add following the content of the opened file
0 7 * * * sudo certbot renew
When your Open edX installation is misbehaving and you’re unsure of your next step, You begin with a reboot. It can’t hurt, and occasionally you’re pleasantly surprised to find your instance in good health immediately afterward. The commands are as follows:
/edx/bin/supervisorctl restart lms
/edx/bin/supervisorctl restart cms
If you’re not a Python Django developer and you haven’t previously supported a Django app then you’d have no reason to be aware that Django apps have their back end that’s somewhat similar to the WordPress admin console. From your web browser, open your LMS, login, and then navigate to /admin/
.
It's suggested that you spend some time getting acquainted with the parameters that are available to modify in the console.
In this article, we don't go over the details of how to create a course in your Open edX instance.
However, if you want to get started right away and skip all these complicated steps just head straight on over to your CMS URL, The studio URL you set in step 8. Once there log in with any user who has staff access such as the one created for yourself during Step 7. After logging into Studio successfully it's time to start creating courses.
The theme directory is located at /edx-themes
to customize it please follow Open edX instructions for comprehensive theming and changing theme
Open edX is a good alternative for businesses since it allows you to implement customizations, manage and update training courses. Open edX will enable organizations to deploy their learning platform and develop high-quality content for their learners by providing a strong LMS and Open edX Studio.
It is important to keep in mind that Open edX can be a complex system. However, following the right instructions and best practices will allow you to experience one of the most scalable LMSs available today.
- You can find official documentation at https://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/latest/index.html
- Open edX GitHub repository is located at: https://github.com/edx/edx-platform
If you need any help contact us at [email protected]
52