How to Install PurritoBin on EndeavourOS Latest

PurritoBin is a self-hosted pastebin web application that allows you to store, share, and manage text snippets online. It is an open-source alternative to popular pastebin services like Pastebin, Hastebin, and Gist. In this tutorial, we will show you how to install PurritoBin on your EndeavourOS Linux system.

Prerequisites

Before we start the installation process, make sure that you have the following requirements:

Step 1: Install Required Packages

First, you need to install some required packages on your EndeavourOS system. Open the terminal and run the following command to update the package repository:

sudo pacman -Syu

After updating the package repository, install the required packages using the following command:

sudo pacman -S curl mysql php-fpm php-mysqli php-gd

Step 2: Install Composer

PurritoBin requires Composer to manage its dependencies. Run the following command to install Composer on your system:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

After installing Composer, check it's installed by typing the following command:

composer -V

Step 3: Install PurritoBin

Create a document root for PurritoBin by issuing the following command:

sudo mkdir /var/www/purritobin

Switch to the /var/www/purritobin directory and use git to clone the latest PurritoBin release:

cd /var/www/purritobin
sudo git clone https://github.com/PurritoBin/PurritoBin.git .

Now, use Composer to install PurritoBin and its dependencies:

sudo composer install

Step 4: Configure Apache or Nginx web server

Configure your Apache or Nginx web server to serve the PurritoBin web application. You must set up the following environment variables in your Apache or Nginx virtual host configuration file:

SetEnv DB_NAME <database_name>
SetEnv DB_USER <database_user>
SetEnv DB_PASSWORD <database_password>

Replace <database_name>, <database_user>, and <database_password> with your actual database name, user, and password that you want to use to store PurritoBin data.

Here is an example of an Apache VirtualHost configuration file for PurritoBin:

<VirtualHost *:80>
    ServerName purritobin.example.com
    DocumentRoot /var/www/purritobin/public

    <Directory /var/www/purritobin/public>
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    SetEnv DB_NAME purritobin
    SetEnv DB_USER purritobin
    SetEnv DB_PASSWORD secret

    ErrorLog /var/log/httpd/purritobin.example.com-error.log
    CustomLog /var/log/httpd/purritobin.example.com-access.log combined
</VirtualHost>

Apache will need to be restarted in order to use the new VirtualHost:

sudo systemctl restart httpd

Here is an example of an Nginx server block for PurritoBin:

server {
    listen       80;
    server_name  purritobin.example.com;
    root /var/www/purritobin/public;
    index index.html index.htm index.php;

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

    location ~ \.php$ {
        include fastcgi.conf;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
    }

    set_env DB_NAME purritobin;
    set_env DB_USER purritobin;
    set_env DB_PASSWORD secret;

    error_log /var/log/nginx/purritobin.example.com-error.log;
    access_log /var/log/nginx/purritobin.example.com-access.log;

}

Nginx will need to be restarted in order to use the new server block:

sudo systemctl restart nginx

Step 5: Create a Database

The next step is to create a database for the PurritoBin application. Login to your MySQL or MariaDB server and create a new database:

sudo mysql -u root -p
CREATE DATABASE purritobin;
GRANT ALL ON purritobin.* TO 'purritobin'@'localhost' IDENTIFIED BY 'secret';
FLUSH PRIVILEGES;
exit

Replace secret with a strong password for the PurritoBin database user.

Step 6: Run Migration and Ensure Folders Permissions

In the PurritoBin installation directory, run migration to set up the database tables:

sudo php artisan migrate 

Ensure that the folders public/static, app/Views/cache, and app/Logs have writable permissions:

sudo chmod 0755 public/static
sudo chmod a+rwx app/Views/cache
sudo chmod -R a+rwx app/Logs

Step 7: Access PurritoBin

PurritoBin is now ready to use. Open your web browser and navigate to your PurritoBin server's domain name or IP address.

That's it. You have successfully installed PurritoBin on your EndeavourOS system. You can now use it to store, share, or manage text snippets online.

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!