Skip to content

Latest commit

 

History

History
87 lines (80 loc) · 3.74 KB

Installation-classic.md

File metadata and controls

87 lines (80 loc) · 3.74 KB

supla-scripts - classic installation

  1. You need to have PHP7.0+ with Apache and MySQL installed.
    1. You already have this if you have successfully run the SUPLA on the server.
  2. Create database for supla-scripts
    1. Enter the MySQL command prompt as root.

      Note: if you are on RaspberryPI based on SUPLA image, the root password is probably raspberry. I strongly encourage to change it to something else after successful installation of supla-scripts.

    2. Create new schema:
      CREATE SCHEMA suplascripts;
      
    3. Generate a strong password for example with http://passwordsgenerator.net
    4. Create a new database user and assign it to the created database:
      CREATE USER 'suplascripts'@'localhost' IDENTIFIED BY 'THE_strong_PASSWORD';
      GRANT ALL ON suplascripts.* TO 'suplascripts'@'localhost';
      FLUSH PRIVILEGES;
      
    5. Exit the MySQL command prompt with \q.
  3. Download and extract the latest supla-scripts release archive to /var/www/supla-scripts.
    mkdir /var/www/supla-scripts
    tar -zxf supla-scripts-2.0.0.tar.gz -C /var/www/supla-scripts
    
  4. Enter this directory and create a configuration file
    cd /var/www/supla-scripts
    cp var/config/config.sample.json var/config/config.json
    
  5. Open the var/config/config.json and
    1. Set the db/host to localhost.
    2. Set the db/password to the password you have generated for MySQL.
    3. Change jwt/key to something strong, different than MySQL password (generate a different value with any generator).
    4. Set the phpPath to where your php executable can be found, e.g. /usr/bin/php. Find it with which php.
  6. Initialize the application
    php /var/www/supla-scripts/supla-scripts init
    
  7. As root (or with sudo privileges), create a virtual host configuration
    1. cp var/config/supla-scripts.vhost.sample.conf /etc/apache2/sites-available/supla-scripts.conf
    2. Adjust the /etc/apache2/sites-available/supla-scripts.conf to match your needs
      1. Change the port the scripts should run on (the *:1234 means that it will run on port 1234).
      2. Uncomment and set the ServerName if the server has a domain name for the app.
      3. Change ServerAdmin to something meaningful.
      4. Fix paths to the SSL certificates (the default configuration uses the same certificates as SUPLA-Cloud).
    3. Enable the virtual host and enable mod_rewrite
      a2ensite supla-scripts
      a2enmod rewrite
      service apache2 restart
      
  8. Change the owner of the /var/www/supla-scripts directory to www-data
    chown -R www-data:www-data /var/www/supla-scripts
    
  9. Check if the application is available on your server address and configured port.
  10. Install necessary crontabs by executing:
    /var/www/supla-scripts/var/config/install-crontab.sh
    

Updating to a new version

  1. Download and extract the latest supla-scripts release archive to the same directory as before.
    tar -zxf supla-scripts-2.0.0.tar.gz -C /var/www/supla-scripts 
    
  2. php /var/www/supla-scripts/supla-scripts init
  3. Change the owner of the /var/www/supla-scripts directory to www-data
    chown -R www-data:www-data /var/www/supla-scripts
    

Or use update script:

./sudo update.sh

Once before using the script, download it to your server:

wget https://github.com/fracz/supla-scripts/classic/update.sh