This guide will take you through the steps of installing the Student Reward platform. Please make sure you have read all the system requirements before you continue.
To start, make sure you have a domain name and it is pointed correctly at your server.
There should be 2 DNS records, here is an example:
Note: Make sure to replace 1.2.3.4 with your server IP address.
Student Rewards can run on most major web servers, this guide will cover the 2 most popular; Nginx & Apache. Nginx is recommended.
Install certbot.
apt -y install certbot
Create the certificate
certbot certonly --webroot -w /var/www/html -d yourdomain.com
Make sure to replace yoursite.com with your domain address.
Now, follow the steps in the terminal.
Upgrade & update your packages.
sudo apt upgrade -y
Install Nginx
sudo apt install curl gnupg2 ca-certificates lsb-release
sudo apt update -y
sudo apt install nginx -y
Install PHP
sudo apt install php php-fpm php-gd php-zip
Now, do the following command to create the Nginx config
cd /etc/nginx/sites-enabled
curl https://docs.studentrewards.co.nz/_assets/configs/nginx_rewards.conf > nginx_rewards.conf
Make sure to replace yoursite.com with your site domain.
Now, restart Nginx to apply the changes.
sudo systemctl restart nginx
Upgrade & update your packages.
sudo apt update -y
sudo apt upgrade -y
Install Apache
sudo apt install apache2
sudo apt install php libapache2-mod-php
Now, do the following command to create the Apache config
cd /etc/apache2/sites-enabled
curl https://docs.studentrewards.co.nz/_assets/configs/apache_rewards.conf > apache_rewards.conf
Make sure to replace yoursite.com with your site domain.
Now, restart Apache to apply the changes.
sudo systemctl restart apache2
Only install this if you need it. Student Rewards requires a MySQL database, this section will take you through the steps to install MariaDB (database server) and how to configure it.
First, install the required dependencies using the following command:
apt-get install curl software-properties-common dirmngr gnupg2 -y
Once all the dependencies are installed, download and add the GPG key with the following command:
curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
bash mariadb_repo_setup --os-type=debian --os-version=buster --mariadb-server-version=10.6
Next, download and install the MariaDB repository installation package using the command below:
wget http://ftp.us.debian.org/debian/pool/main/r/readline5/libreadline5_5.2+dfsg-3+b13_amd64.deb
dpkg -i libreadline5_5.2+dfsg-3+b13_amd64.deb
Once the repository is added, you can update the package cache with the following command:
apt-get update -y
Now, run the following command to install MariaDB 10.6.
apt-get install mariadb-server mariadb-client -y
Once the installation is completed, start and enable the MariaDB service using the following command:
systemctl start mariadb
systemctl enable mariadb
By default, the MariaDB installation is not secured and its root password is not set. You can do both by running the following script:
mysql_secure_installation
You will be asked several questions to secure the MariaDB installation and set the root password, as shown below:
Enter current password for root (enter for none):
Switch to unix_socket authentication [Y/n] Y
Change the root password? [Y/n] Y
New password: newpassword
Re-enter new password: newpassword
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
Once you are done, log in to the MariaDB shell with the following command:
mysql -u root -p
Now, create a new user called studentrewards, run the following command:
CREATE USER 'studentrewards'@'%' IDENTIFIED BY 'enter_a_password_here';
Grant all privileges to the user by running the following command:
GRANT ALL PRIVILEGES ON *.* TO 'studentrewards'@'%' IDENTIFIED BY 'same_password_as_above';
Next, reload the privileges using the following command:
FLUSH privileges;
Now, you can use these credentials later in the setup process.
Once that is completed, choose a destination on your server to install Student Rewards. Here, we are installing it into /var/studentrewards
sudo mkdir /var/studentrewards
cd /var/studentrewards
Download the StudentRewards-v****.zip from your account page at https://studentrewards.co.nz/account/downloads then, extract those files into the folder of choice.
sudo unzip StudentRewards-v****.zip
Make sure to replace **** with the correct file name.
Now, update file permissions.
sudo chown <user>:www-data /var/studentrewards/ -R
sudo chmod 775 /var/studentrewards/ -R
Finally, you are ready to install the system. Make sure you have your database credentials and school info ready.
Head to https://yoursite.com/ to complete the setup.