Building and compiling the Friend Server

One of the first things you will do as a developer, is to obtain your own Friend Server. To do this, you need to build Friend Core and install Friend OS on your system. For now, we will assume you have a Linux environment. And in our particular case, we will focus on Ubuntu 20.

Step 1. - Install build dependencies

sudo apt-get install bash libssh2-1-dev libssh-dev libssl-dev libaio-dev mysql-server php7-cli php7-gd php7-imap php7-mysql php7-curl libmysqlclient-dev build-essential libmatheval-dev libmagic-dev libgd-dev libuv1 rsync valgrind-dbg libxml2-dev php7-readline cmake ssh make libsmbclient-dev libwebsockets-dev libsqlite3-dev

Step 2. - Clone the Friend OS repository

git clone https://github.com/FriendUPCloud/friendup
cd friendup

Step 3. - Build Friend Core - in your friendup folder

echo "USE_SSH_THREADS_LIB=0" >> Config
echo "OPENSSL_INTERNAL=1" >> Config
make clean setup
make compile
make install

Step 4. Create database / access - also in your friendup folder

sudo mysql
create user frienduser@localhost identified by "somepassword";
create database frienddb;
use frienddb;
source db/FriendCoreDatabase.sql;
grant all privileges on frienddb.* to frienduser@localhost;
flush privileges;
exit

Step 5. Configure cfg.ini

Configure config file, located in build/cfg/cfg.ini (Configuring Friend OS) Also, note, if you haven't set up this file there's an example installed in build/cfg/cfg.ini.example - which you can rename to cfg.ini once you've set up your settings.

Step 6. Run FriendCore

cd build/
./FriendCore

Additional and optional configuration

If you're using push notifications, you need to install composer and php Web Push:

sudo apt-get install composer
cd build/php
composer require minishlink/web-push

This will allow you to run web push, and enable in the cfg.ini:

[Security]
push_system = "php-web-push"

More on how to configure cfg.ini is found here.