Linux SSH Installation

This is the Linux SSH based installation guide for the recommended dependencies Freya uses. All commands were executed on an Ubuntu 18.04 Server. We highly recommend you use this method of installation as it'll install the better dependencies to have Freya be lightning fast (such as Redis).

VPS prices are also generally cheaper than a web host, although the work is manual but not difficult.

The VPS this was written with was a Vultr $5/mo, 1 vCore, 1024MB RAM, & 25GB SSD VPS.

It is recommended you follow our hardware recommendations for running Freya. The specs listed above are just for clarification.

Also note:

This guide only installs and configures the dependencies, there is an internal guide inside the Freya installation file to continue the installation.

If you're using a shared web host this is the wrong guide.


Installing PHP 7.4

We're going to walkthrough installing PHP 7.4 onto your machine, PHP is what Freya runs off of and is 100% required along with all its modules. Please take note if you're using Ubuntu 20.04+ not to include the PPA repositories!

Install PPA Repository

Also curl while we're at it.

sudo apt update

sudo apt -y install software-properties-common curl
sudo add-apt-repository ppa:ondrej/php
# Use this if you're going to use Redis, it's highly recommended.
# And yes the guide goes through installing Redis.
sudo add-apt-repository ppa:chris-lea/redis-server

Install PHP 7.4 & Extensions

Most of these extensions are installed by default but just in-case we include them anyways.

sudo apt update

sudo apt install -y php7.4 php7.4-{bcmath,mbstring,xml,gmp,fpm,zip,pdo,pdo_mysql,tokenizer,ctype,fileinfo}

# Check if php installed correctly, should output the php version
php -v

Note for Ubuntu 20.04+

If you're running a Ubuntu 20.04+ you can exclude the PPA repositories and just install with the basic apt install.


Installing MariaDB

sudo apt update

sudo apt install -y mariadb-server

sudo mysql_secure_installation

mysql_secure_installation

Please type the sudo mysql_secure_installation command if you haven't already. If it asks you to log in (Enter current password for root (enter for none)) press enter because we have not set up MariaDB yet.

Follow the steps below to install MariaDB

  1. Set root password? [Y/n] - y
  2. Set your root password
  3. Remove anonymous users? [Y/n] - y
  4. Disallow root login remotely? [Y/n] - y - There is no reason for external logins.
  5. Remove test database and access to it? [Y/n] - y
  6. Reload privilege tables now? [Y/n] - y
  7. Done

You've just setup MariaDB now we can set up a database for Freya to be used on.

Setup your database

Now we're going to setup your MySQL database along with a user to access that database because using root outside of your machine SSH is a bad idea! It's really simple and doesn't take much work to not use root.

All of these values (apart from the password obviously) are default in the installation file so all you have to do is enter in your password if you copied everything blow word for word (which is recommended).

sudo mysql -u root -p
# Enter your root password

USE mysql;

# We'll create our user now.
# The user can only be accessed locally with the @'127.0.0.1' argument, it should not be remotely available!
# Please make sure to change the 'YourPassword' to the actual password for the account!

CREATE USER 'freya'@'127.0.0.1' IDENTIFIED BY 'YourPassword';

# Now lets create the database
CREATE DATABASE freya_ban_suite;

# Now we grant the user privilage to the database
GRANT ALL PRIVILEGES ON freya_ban_suite.* TO 'freya'@'127.0.0.1';

# Finally we flush the privilege cache to make our changes take effect.
FLUSH PRIVILEGES;

# Now we quit the MySQL terminal
\q

If everything went correctly you would've got no errors, if some parts said 0 rows affected don't worry about that. As long as it didn't error everything worked properly.


Installing Redis

Now we're going to install Redis. Redis is used mostly as a cache driver, it's insanely fast compared to database/file. If you've read about anything on Redis you might be scared your system requirements are too low, and they are, IF you're using clustered databases and what not! But we're only using it for cache, so a small VPS will work just fine.

sudo apt update

sudo apt install -y redis-server

sudo systemctl enable redis-server.service

# Now lets test redis to see if it's working properly.

redis-cli

# You should be in the redis command line now.
ping

# You should get a response back with PONG.
# Press CTRL+C to exit.

That's basically it, painless as ever. You don't really need a password for Redis as it's only usable locally by default. However if you want one then you can google how to do that, it's super simple. But it's unnecessary unless you're enabling remote access.


Web Server Configuration

Below you can click on a link to take you to the appropriate web server configuration page.


OPTIONAL Install Composer

The next step will have you install the Freya web application you've downloaded from gmodstore. This will take a while to upload if you include the vendor folder, however you can easily install composer and exclude the vendor folder when you upload it to your VPS, making your upload 10 times faster, and the machine can do all the heavy lifting.

(Please note you WILL need over 500MB of RAM to use composer)

To install composer simply execute the following command below:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

# Now run the composer command, if a bunch of commands in green text come up you did it right
composer

We recommend you use this because if a dependency is outdated this will update it.


Install Freya

Now we're going to install Freya onto your system. It's pretty simple, all we need to do is basically drag and drop the freya_web contents into the folder we're going to create.

sudo mkdir /var/www/freya
cd /var/www

# Add the contents of Freya into this folder

# If you installed composer and EXCLUDED the vendor then run the command sbelow
# If you did NOT exclude the vendor skip these commands
cd freya
composer install
cd ..

# After you've added the files for Freya let's setup the permissions.
sudo chown -R www-data:www-data freya

# If you're using your own user and not root then enter the following below
# to add your user to the www-data group. This can help solve SFTP permission issues.
sudo usermod -a -G ww-data your_username

Now we're going to let the storage and cache folders be usable by the webserver.

cd freya
chmod -R 755 storage/* bootstrap/cache/

After you've installed Freya confirm everything is inside that folder, if everything is present you can go ahead and head to your configured url you set in your web server config.

If you go straight to the URL you'll get hit with an Error: 500 - this is normal. You'll want to go to the installation file which is structured like such: http://freya.test/install.php (freya.test being your URL).

Now all you need to do is follow the rest of those installation instructions and Freya is ready to go.