How to Install Jirafeau on NetBSD

Jirafeau is a web-based file sharing tool that allows you to securely share files with others. In this tutorial, we will go through the steps to install Jirafeau on NetBSD.

Prerequisites

Before we get started, make sure you have the following:

Step 1: Install Required Packages

First, we need to install some packages required to run Jirafeau:

# pkgin update
# pkgin install mariadb-server php74-fpm php74-mysqli php74-gd php74-curl

Step 2: Create a Database

We need to create a MariaDB database to store the data for Jirafeau. Log in to your MariaDB server and create a new database:

# mysql -u root -p
MariaDB> CREATE DATABASE jirafeau;
MariaDB> GRANT ALL PRIVILEGES ON jirafeau.* TO 'jirafeau'@'localhost' IDENTIFIED BY 'your_password';
MariaDB> FLUSH PRIVILEGES;
MariaDB> exit

Make sure to replace your_password with a secure password for the Jirafeau user.

Step 3: Download Jirafeau

Download the latest version of Jirafeau from the GitLab repository:

# cd /var/www
# git clone https://gitlab.com/mojo42/Jirafeau.git jirafeau

Step 4: Configure PHP

Edit the PHP configuration to match the following:

# vi /usr/pkg/etc/php-7.4-fpm/php.ini
memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 600
max_input_time = 600
max_input_vars = 10000

Save and exit the file.

Step 5: Configure Jirafeau

Copy the settings.inc.php-dist file to settings.inc.php and edit the file to match your server configuration:

# cd jirafeau
# cp settings.inc.php-dist settings.inc.php
# vi settings.inc.php
define('DB_TYPE', 'mysqli');
define('DB_HOST', 'localhost');
define('DB_USER', 'jirafeau');
define('DB_PASS', 'your_password');
define('DB_NAME', 'jirafeau');
define('MAIN_URL', 'http://your_ip_or_domain/jirafeau/');
define('THUMB_DIR', 'thumb/');
define('THUMB_PREFIX', 'thumb-');
define('TMP_DIR', 'temp/');
define('CHECK_MIMETYPE', true);
define('SECRET_KEY', 'your_secret_key');
define('LDAP_ENABLE', false);

Save and exit the file.

Step 6: Configure NGINX

Create an NGINX configuration file for Jirafeau:

# vi /usr/pkg/etc/nginx/sites-available/jirafeau
server {
        listen 80;
        server_name your_ip_or_domain;
        root /var/www/jirafeau;

        index index.php;

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }

        location ~* \.(jpg|jpeg|gif|png|css|js|ico)$ {
                expires 30d;
                access_log off;
        }

        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

Save and exit the file.

Step 7: Enable NGINX Config

Enable the NGINX configuration file and restart the service:

# cd /usr/pkg/etc/nginx/sites-enabled/
# ln -s ../sites-available/jirafeau jirafeau
# nginx -s reload

Step 8: Configure Firewall

Finally, allow HTTP traffic on the NetBSD firewall:

# echo 'pass in proto tcp from any to any port 80' >> /etc/pf.conf
# pfctl -f /etc/pf.conf

Step 9: Finish Installation

Visit the Jirafeau website in your web browser to finish the installation:

http://your_ip_or_domain/jirafeau/

Follow the prompts to set up your administrator account and you're ready to go!

Conclusion

In this tutorial, we have shown you how to install Jirafeau on NetBSD. You can now securely share files with others using the Jirafeau file sharing tool.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!