Installing Krayin on NixOS

Krayin is a customer relationship management (CRM) software that helps businesses manage customer interactions, leads, and sales. In this tutorial, we will show you how to install Krayin on the latest version of NixOS.

Prerequisites

Before we get started with the installation, ensure that you have the following prerequisites:

Step 1: Enable HTTPS

Krayin must be installed on a server running HTTPS because it requires a secure connection. To enable HTTPS on the server, execute the following command as the root user:

$ sudo nixos-generate-config

This command will generate a configuration file at /etc/nixos/configuration.nix. Now open the configuration file with any text editor and add the following lines to enable HTTPS:

services.nginx = {
  enable = true;
  recommendedTlsSettings = true;
};

Save and close the configuration file.

Step 2: Install PHP and MySQL

Krayin requires PHP and MySQL to function appropriately. To install them, execute the following command as the root user:

$ sudo nix-env -iA nixos.php nixos.mysql

That command will install PHP and MySQL on your system.

Step 3: Install and configure Krayin

To install Krayin, execute the following steps:

  1. Download the installation package from the official Krayin website at https://krayincrm.com/download.
  2. Copy the downloaded package to your server's download directory.

Now execute the following command to extract the Krayin package:

$ sudo tar -xvf krayin.tar.gz -C /var/www/html/

This command will extract the Krayin files to the server's web root directory. You can now navigate to the web root directory and create the Krayin configuration file:

$ cd /var/www/html/krayin
$ sudo cp config.example.php config.php

Now edit the Krayin configuration file with your preferred text editor:

$ sudo nano config.php

Update the MySQL database details in the configuration file with the following information:

define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASSWORD', 'password');
define('DB_NAME', 'krayin');

Save and close the configuration file.

Step 4: Configure the web server

To access Krayin, you need to configure the web server. In this tutorial, we will use Nginx as the web server.

Execute the following command to create the Nginx server block for Krayin:

$ sudo nano /etc/nixos/nginx.conf

Now add the following content to the file:

server {
  listen       80;
  server_name  krayin.example.com;

  root /var/www/html/krayin;
  access_log  /var/log/nginx/krayin.access.log;
  error_log   /var/log/nginx/krayin.error.log;

  location / {
    index  index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
  }

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

Save and close the file.

Finally, execute the following command to apply the configuration changes:

$ sudo systemctl reload nginx

Step 5: Access Krayin

You have now completed the installation of Krayin CRM on NixOS. To access the software, navigate to http://krayin.example.com using your favorite web browser.

Conclusion

In this tutorial, you have learned how to install Krayin on the latest version of NixOS. You can now use Krayin to manage customer interactions, leads, and sales.

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!