How to install 0bin on Manjaro

0bin is a minimalist, open-source, client-side encrypted pastebin that allows anyone to host anonymous plaintext files. In this tutorial, we will guide you on how to install 0bin on Manjaro.

Prerequisites

  • A computer running Manjaro with a terminal window.
  • A web browser to access the 0bin application.

Steps for Installing 0bin on Manjaro

Follow the below steps to install 0bin on your Manjaro machine:

  1. Open your terminal window by pressing Ctrl + Alt + T on your keyboard.

  2. Install some necessary packages required for the 0bin installation. Type the command below to do so:

    sudo pacman -S git nginx php-fpm mariadb
    
  3. Next, we need to install a few dependencies. We can do this by running the command below:

    sudo pacman -S base-devel php-gd php-intl php-mcrypt php-sqlite php-tidy php-xml
    
  4. Clone the 0bin source code repository from Github to your system using the command below:

    git clone https://github.com/Tygs/0bin.git
    
  5. Move into the 0bin project directory:

    cd 0bin
    
  6. Copy the conf.sample.php file to a new conf.php file:

    cp includes/conf.sample.php includes/conf.php
    
  7. Open the conf.php file in a text editor to make some necessary modifications:

    nano includes/conf.php
    

    In the file, scroll down to the mariadb settings section and change it to fit the following:

    $cfg['db']['type'] = 'mariadb';
    $cfg['db']['server'] = 'localhost';
    $cfg['db']['port'] = 3306;
    $cfg['db']['db'] = '0bin';
    $cfg['db']['user'] = '0bin';
    $cfg['db']['password'] = 'mysql_password';
    

    Save the file and exit the text editor.

  8. Create a database in MariaDB:

    Log in to MariaDB using the command below:

    sudo mysql -u root -p
    

    Enter your root password when prompted. After logging in, create a new database called 0bin:

    CREATE DATABASE 0bin;
    

    Create a new user called 0bin with a password of your choice:

    CREATE USER '0bin'@'localhost' IDENTIFIED BY 'mysql_password';
    

    Finally, give the new user full permissions to the 0bin database:

    GRANT ALL ON 0bin.* TO '0bin'@'localhost';
    

    Exit the MariaDB console by typing exit.

  9. Set up your web server (NGINX) to serve the 0bin application files. Create a new file in the /etc/nginx/sites-available/ directory called 0bin:

    sudo nano /etc/nginx/sites-available/0bin
    

    Paste the configuration below into the file:

    server {
         listen 80 default_server;
         listen [::]:80 default_server;
         root /path/to/0bin;
         index index.php;
         location / {
             try_files $uri $uri/ /index.php?$args;
         }
         location ~ \.php$ {
             include fastcgi.conf;
             fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
         }
    }
    

    Replace /path/to/0bin with the full path to your 0bin directory. Save and exit the file.

  10. Create a symbolic link to the newly created file:

    sudo ln -s /etc/nginx/sites-available/0bin /etc/nginx/sites-enabled/0bin
    
  11. Restart the NGINX web server to apply changes:

    sudo systemctl restart nginx
    
  12. Finally, start the php-fpm service:

    sudo systemctl start php-fpm
    

Congratulations! You have successfully installed 0bin on your Manjaro machine. You can access your 0bin instance via a web browser by navigating to http://localhost in your browser.