Vai al contenuto

2. Linux Server

We'll host Aulabook using a server based on Ubuntu.

We strongly suggest using LTS based version. As the day we're writing this guide the current stable LTS is 22.04.

Step 1 - updates and software installation

Open a shell and execute the following commands that will update and upgrade the system.

sudo apt-get update && sudo apt-get upgrade

After you completed the update process, install the following packages.

sudo apt-get install -y python3 python3-pip python3-venv unzip

We assume you were running the previous commands as root, please create a new user called 'aulabook' as running Flask web apps as root is not recommended. To do that run the following command and follow the instructions

adduser aulabook

Then add the previously created user to the 'sudo' group,

usermod -aG sudo aulabook

Now log out and proceed with the user aulabook.

We'll use Waitress as web server.

Step 2 - Creating the aulabook environment

First we need to create the directory for Aulabook:

mkdir /home/aulabook/aulabook && cd /home/aulabook/aulabook

Then we download the latest version of it from GitHub (you need to update the URL according to the current version)

wget https://github.com/paghos/aulabook/archive/refs/heads/main.zip

And we unzip it

unzip aulabook-main.zip

Before proceeding, remove the downloaded zip

rm -rf aulabook-main.zip

Check if the files were extracted

ls 

If everything looks like this, you're good to go!

app.py  assets  instance  static  templates

Configure Aulabook app as described in this guide

Create the virtual environment

python3 -m venv venv

And activate it

source venv/bin/activate

Install all the necessaries libraries for aulabook

pip install flask flask_bcrypt flask_sqlalchemy wheel pywinrm flask_mail pytz flask_session waitress

After you've done that, desconnect from the virtual environment by giving the following command.

deactivate

Step 3 - Test the functionality

Before continuing we want to check if what we have done so far works. To do that we'll run Aulabook to check if everything works.

waitress-serve --host 0.0.0.0 app:app

Then, using a web browser open the following IP: machineip:8080.

If you see Aulabook home everything works as expected.

Step 4 - Configure autostart

Download the latest version of the execution script from here and put it in /opt

cd /opt

And download the execution script

sudo wget https://files.aulabook.com/exec.sh

After you've done this, set it to be executed at every boot.

Edit the crontab file by giving the following command:

crontab -e

Select 'nano' as text editor, and add the following line at the bottom of the file:

@reboot bash /opt/exec.sh

Save by giving 'Control + X' and confirm with Y.

Done! Reboot the system and everything should work as expected.

We configured our Ubuntu server in order to work with Aulabook.

It should be available at MACHINE_IP:8080, if not please do some troubleshooting and do these steps again or, send us an email.