Installing AVAA Server on AL2023
Before starting, a domain name is required and should already point to the server we are about to configure in this guide.
Security Group
Make sure the security group allows the following inbound TCP ports:
- 80 (HTTP)
- 443 (HTTPS)
- 41744 (AVAA WebSocket)
Upgrade system and install httpd
We will use Apache httpd to serve the editor and AVAA generated files
sudo dnf upgrade -y
sudo dnf install -y screen wget nano httpd
sudo dnf install -y php-fpm php-json php php-devel
sudo usermod -a -G apache ec2-user
Install AVAA
cd ~/
wget https://avaa-toolkit.org/release/latest
unzip ./latest
rm ./latest
sudo mv ./avaa-toolkit /opt/avaa-toolkit
cd /opt/avaa-toolkit
# make avaa executable
chmod +x ./avaa-toolkit.sh
# prepare the editor for apache
chmod 770 ./editor
# create folders
mkdir ./tickets
mkdir ./logs
mkdir ./upload
sudo chown ec2-user:apache ./upload
# install java
sudo dnf install -y java-21-amazon-corretto
# https://cloudkatha.com/how-to-install-java-8-11-17-on-amazon-linux-2023-instance/#42_Install_Java_11_on_Amazon_Linux_2023
Now logout and login again to take into account latest usermod
sudo chown -R ec2-user:apache /opt/avaa-toolkit/editor
#sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;
#find /var/www -type f -exec sudo chmod 0664 {} \;
Apache setup
sudo nano /etc/httpd/conf.d/avaa.conf
Basic configuration file (adapt with your domain name)
<VirtualHost *:80>
ServerName psyphi.avaa-toolkit.org
ServerAlias psyphi.avaa-toolkit.org
DocumentRoot /opt/avaa-toolkit/editor
ErrorLog /opt/avaa-toolkit/logs/httpd_error.log
CustomLog /opt/avaa-toolkit/logs/httpd_access.log combined
</VirtualHost>
<Directory "/opt/avaa-toolkit/editor">
Require all granted
Options Indexes
Order allow,deny
Allow from all
</Directory>
Start apache and setup auto restart on reboot
sudo systemctl start httpd && sudo systemctl enable httpd
Install certbot for SSL certificate
HTTPS is required for WebSocket connections so we need to set it up. LetsEncrypt provides free certificates and can be automated with certbot.
sudo dnf install -y gcc augeas-libs augeas-devel python-devel
sudo python3 -m venv /opt/certbot/
sudo /opt/certbot/bin/pip install --upgrade pip
sudo /opt/certbot/bin/pip install certbot certbot-apache
Now let's obtain a certificate
sudo /opt/certbot/bin/certbot certonly --webroot --webroot-path "/opt/avaa-toolkit/editor/" -d demo.avaa-toolkit.org
SSL setup
Let's change now our httpd configuration file
sudo nano /etc/httpd/conf.d/avaa.conf
Now adapt the following sample configuration:
<VirtualHost *:80>
ServerName demo.avaa-toolkit.org
ServerAlias demo.avaa-toolkit.org
DocumentRoot /opt/avaa-toolkit/editor
ErrorLog /opt/avaa-toolkit/logs/httpd_error.log
CustomLog /opt/avaa-toolkit/logs/httpd_access.log combined
Redirect permanent / https://demo.avaa-toolkit.org/
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLProtocol all -SSLv2 -SSLv3
SSLCertificateFile /etc/letsencrypt/live/demo.avaa-toolkit.org/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/demo.avaa-toolkit.org/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/demo.avaa-toolkit.org/chain.pem
ServerAdmin dev@avaa-toolkit.org
ServerName demo.avaa-toolkit.org
ServerAlias *.demo.avaa-toolkit.org
DocumentRoot /opt/avaa-toolkit/editor
ErrorLog /opt/avaa-toolkit/logs/httpd_error.log
CustomLog /opt/avaa-toolkit/logs/httpd_access.log combined
Alias /tickets /opt/avaa-toolkit/tickets
Alias /assets /opt/avaa-toolkit/assets
Alias /include /opt/avaa-toolkit/include
Alias /upload /opt/avaa-toolkit/upload
</VirtualHost>
<Directory "/opt/avaa-toolkit/editor">
Require all granted
Options Indexes
Order allow,deny
Allow from all
</Directory>
<Directory "/opt/avaa-toolkit/tickets">
Require all granted
Options Indexes
Order allow,deny
Allow from all
</Directory>
<Directory "/opt/avaa-toolkit/assets">
Require all granted
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
</Directory>
<Directory "/opt/avaa-toolkit/include">
Require all granted
Order allow,deny
Allow from all
</Directory>
<Directory "/opt/avaa-toolkit/upload">
Require all granted
Options Indexes
Order allow,deny
Allow from all
</Directory>
We must also install httpd ssl dependencies
sudo dnf install -y openssl mod_ssl
sudo systemctl restart httpd
Make a Java compatible certificate for the WebSocket server
# create a valid full CAfile
sudo cat /etc/letsencrypt/live/demo.avaa-toolkit.org/fullchain.pem /etc/letsencrypt/live/demo.avaa-toolkit.org/chain.pem > allchain.pem
Build JKS
# use password "avaapass"
sudo openssl pkcs12 -export -in /etc/letsencrypt/live/demo.avaa-toolkit.org/cert.pem -inkey /etc/letsencrypt/live/demo.avaa-toolkit.org/privkey.pem -out cert.p12 -name avaacert -CAfile allchain.pem -caname root
sudo keytool -importkeystore -deststorepass avaapass -destkeypass avaapass -destkeystore avaacert.jks -srckeystore cert.p12 -srcstoretype PKCS12 -srcstorepass avaapass -alias avaacert
Make sure avaacert.jks is in avaa-toolkit directory (currently the certificate path/name/password are hardcoded)
Configure AVAA launcher to use SSL
File avaa-toolkit.sh
java -Xmx8g -jar ./avaa-toolkit.jar --server --server-ssl --server-allowed-origin "https://demo.avaa-toolkit.org"
Adapt with your server's RAM and domain origin
Install FFmpeg
# https://www.johnvansickle.com/ffmpeg/
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
tar xvf ffmpeg-release-amd64-static.tar.xz
sudo mv ffmpeg-*-amd64-static/ff* /usr/local/bin/
Install Chromium (for PDF)
sudo dnf -y install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
Edit avaa-config.xml and set the exe attribute
<PDF exe="/usr/bin/google-chrome-stable">
Install deface
sudo yum install libglvnd-glx
Install Python torch (obsolete)
sudo dnf -y install pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
Install R
https://github.com/rstudio/r-builds/issues/197
Install and start MongDB
https://www.mongodb.com/docs/v8.0/tutorial/install-mongodb-on-amazon/
Start AVAA in a screen
screen -S avaa
cd ~/avaa-toolkit/
./avaa-toolkit.sh