Install NOW LMS on Amazon Linux 2023 - bmosoluciones/now-lms GitHub Wiki
Install Now LMS in an Amazon Linux VPS on AWS
Last Update: 05/Jul/2025
You can install NOW Learning Management System following these steps:
Install NOW LMS in a Virtual Environment
sudo dnf update -y
sudo dnf -y install nginx pango postgresql17-server python3.12
sudo mkdir /opt/nowlms
cd /opt/nowlms
sudo python3.12 -m venv venv
sudo /opt/nowlms/venv/bin/python -m pip install now-lms
Setup a Postgresql Server
In this guide, we will use PostgreSQL as the database. You can use MySQL also.
Initialize and enable the PostgreSQL service.
sudo /usr/bin/postgresql-setup --initdb
sudo systemctl enable --now postgresql
Create a database and user
sudo -u postgres psql -c "CREATE USER lmsctl1 WITH PASSWORD 'lmsctl1';"
sudo -u postgres psql -c "CREATE DATABASE lmsctl1;"
sudo -u postgres psql -c "GRANT ALL ON SCHEMA public TO lmsctl1;"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE lmsctl1 TO lmsctl1;"
sudo -u postgres psql -c "ALTER DATABASE lmsctl1 OWNER TO lmsctl1;"
sudo -u postgres psql -c "GRANT USAGE ON SCHEMA public TO lmsctl1;"
sudo -u postgres psql -c "GRANT CREATE ON SCHEMA public TO lmsctl1;"
Important: your connection string will be:
postgresql+pg8000://lmsctl1:[email protected]:5432/lmsctl1
Allow the user to connect to the database via TCP with username and password
sudo vi /var/lib/pgsql/data/pg_hba.conf
Include this directive:
host all lmsctl1 0.0.0.0/0 md5
Restart the database service
sudo systemctl restart postgresql
Setup the NOW - LMS Database
You can initialize your system database with this command:
- Provide the database URI.
- Provide the admin user.
- Provide the admin password.
- Provide the app package to Flask.
export DATABASE_URL=postgresql+pg8000://lmsctl1:[email protected]:5432/lmsctl1
export ADMIN_USER=adminuser
export ADMIN_PSWD=veryverysecurepassword
export FLASK_APP=now_lms
sudo /opt/nowlms/venv/bin/flask db-init
You will get an output like this:
[...]
02:18:24:2424 - INFO - now_lms:378 : NOW - LMS iniciado correctamente.
Create a run scritp:
sudo touch /opt/nowlms/run.py
sudo vi /opt/nowlms/run.py
Use this template:
from os import environ
environ["SQLALCHEMY_DATABASE_URI"] = "postgresql+pg8000://lmsctl1:[email protected]:5432/lmsctl1"
environ["SECRET_KEY"] = "asldakljdklandcksnckjsancvklnvncklasldnkljñndcASDFGHJK451561"
from waitress import serve
from now_lms import lms_app
with lms_app.app_context():
serve(app=lms_app, port=8080)
The Python interpreter in the virtual environment should run this script without errors:
/opt/nowlms/venv/bin/python /opt/nowlms/run.py
In a separate shell, you can check if the app is running with:
curl 127.0.0.1:8080
This will return the HTML of the home page to your terminal.
In the first terminal, you can stop the WSGI server with Ctrl + C
.
Create a systemd service file.
Most of the docs online will recommend using Supervisor or another process manager to auto-start your WSGI server, but with current Linux distributions, it's easy to set up an autostart script with systemd..
sudo touch /etc/systemd/system/nowlearning.service
sudo vi /etc/systemd/system/nowlearning.service
Use this service template:
[Unit]
Description=Now Learning Management System
After=network.target
[Service]
PrivateTmp=true
Type=simple
ExecStart=/opt/nowlms/venv/bin/python /opt/nowlms/run.py
[Install]
WantedBy=multi-user.target
Reload systemd with
systemctl daemon-reload
systemctl enable --now nowlearning
systemctl status nowlearning
● nowlearning.service - Now Learning Management System
Loaded: loaded (/etc/systemd/system/nowlearning.service; enabled; preset: disabled)
Active: active (running) since Mon 2025-06-16 02:49:08 UTC; 8s ago
Main PID: 37730 (python)
Tasks: 5 (limit: 1111)
Memory: 58.9M
CPU: 709ms
CGroup: /system.slice/nowlearning.service
└─37730 /opt/sunshine/venv/bin/python /opt/sunshine/run.py
Jun 16 02:49:08 ip-172-31-7-141.us-east-2.compute.internal systemd[1]: Started nowlearning.service - Now Learning Management System.
[...]
Jun 16 02:49:08 ip-172-31-7-141.us-east-2.compute.internal python[37730]: 02:49:08:0808 - INFO - now_lms.config:213 : Utilizando el motor de base de datos PostgreSQL.
With this, you can check your site is running on port 8080 of your server, but you should not expose your WSGI server to the internet.
curl 127.0.0.1:8080
Setup a reverse proxy
sudo systemctl enable --now nginx
Setup NGINX with this template:
sudo vi /etc/nginx/conf.d/nowlearning.conf
server {
listen 80;
server_name tu-dominio.com; # o usa _ si no tienes dominio
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Restart the nginx service
sudo systemctl restart nginx
Setup a SSL Certificate
sudo dnf install python3 python-devel augeas-devel gcc
sudo python3.12 -m venv /opt/certbot/
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot
sudo certbot --nginx
If everithing is fine you sould access NOW Learning Management System at https://youdomain.tds