Complete installation and setup guide for xAPI LRS on Ubuntu Server.
- Ubuntu Server 20.04 LTS or newer
- Root access or sudo privileges
sudo apt update
sudo apt upgrade -y
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
sudo apt install -y mongodb
sudo systemctl start mongodb
sudo systemctl enable mongodb
sudo npm install -g pm2
sudo apt install apache2
sudo a2enmod proxy
sudo a2enmod proxy_http
Create Virtual Host Configuration:
sudo nano /etc/apache2/sites-available/xapi-lrs.conf
Add this configuration:
<VirtualHost *:80>
ServerName lrs.yourdomain.com
ServerAdmin [email protected]
ProxyPreserveHost On
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ErrorLog ${APACHE_LOG_DIR}/xapi-lrs-error.log
CustomLog ${APACHE_LOG_DIR}/xapi-lrs-access.log combined
</VirtualHost>
Enable Site and Restart Apache:
sudo a2ensite xapi-lrs.conf
sudo systemctl restart apache2
sudo mkdir -p /opt/xapi-lrs
sudo chown -R $USER:$USER /opt/xapi-lrs
cd /opt/xapi-lrs
nano app.js
Copy the complete app.js content from the repository.
mkdir public
nano public/index.html
Copy the complete index.html content from the repository.
npm init -y
npm install express mongoose body-parser cors basic-auth dotenv
nano .env
Add these lines:
LRS_USERNAME=admin
LRS_PASSWORD=secure_password
pm2 start app.js --name xapi-lrs
pm2 startup
pm2 save
Check MongoDB status:
sudo systemctl status mongodb
Check application logs:
pm2 logs xapi-lrs
Test the application:
curl http://localhost:3000
- Dashboard: http://your-server:3000
- Report Page: http://your-server:3000/report.html
- API Endpoint: http://your-server:3000/TCAPI/
In Articulate Storyline, configure the following:
- LRS URL:
http://your-server:3000/TCAPI/
- Username:
admin
(or as set in.env
) - Password:
secure_password
(or as set in.env
)
Use pm2
for process management:
-
Check status:
pm2 status
-
View logs:
pm2 logs xapi-lrs
-
Monitor processes:
pm2 monit
Manage your MongoDB database with the following commands:
-
Access the Mongo shell:
mongosh use xapi-lrs
-
View statements:
db.statements.find()
-
Clear all statements:
db.statements.deleteMany({})
- Change default credentials in the
.env
file. - Configure a firewall:
sudo ufw allow 3000 sudo ufw enable
-
Check MongoDB connection:
sudo systemctl status mongodb
-
View application logs:
pm2 logs xapi-lrs
-
Restart services:
sudo systemctl restart mongodb pm2 restart xapi-lrs
The directory structure of the project is as follows:
/opt/xapi-lrs/
├── app.js
├── package.json
├── .env
└── public/
├── index.html
└── report.html
-
System updates:
sudo apt update sudo apt upgrade npm update pm2 update
-
Backup database:
mongodump --db xapi-lrs
- Ensure that all sensitive data in
.env
is secured. - Regularly monitor logs and process statuses for optimal operation.
Feel free to contribute by submitting issues or pull requests.