Come hang with us on Discord and chat directly with the team!Discordtop-bar-close-icon

2024-09-04

How to Install Pastefy on Debian Latest

tutorials
img

Pastefy is an open-source web-based platform for sharing text and code snippets online. This guide will walk you through the installation process on Debian Latest.

Prerequisites:

  • A VPS or Dedicated Server running Debian Latest.
  • A non-root user with sudo privileges.
  • A domain name pointing to your server's IP address.

Step 1: Updating the System

sudo apt update && sudo apt upgrade

Update your system and upgrade all packages to their latest versions.

Step 2: Installing Required Packages

sudo apt install -y curl git unzip nginx php7.3-fpm php7.3-mbstring php7.3-mysql php7.3-xml php7.3-zip php7.3-gd

Install necessary packages for running Pastefy.

Step 3: Installing Composer

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Install Composer, a dependency manager for PHP.

Step 4: Cloning Pastefy Repository from GitHub

sudo git clone https://github.com/pastefy/pastefy.git /var/www/html/pastefy

Clone the Pastefy repository to the /var/www/html directory.

Step 5: Installing Pastefy Dependencies

cd /var/www/html/pastefy
sudo composer install

Install necessary dependencies for Pastefy.

Step 6: Configuring Nginx

sudo nano /etc/nginx/sites-available/pastefy

Create a new Nginx configuration file with the following content:

server {
listen 80;
listen [::]:80;
root /var/www/html/pastefy/public;
index index.php index.html index.htm;
server_name your-domain-name.tld;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
expires max;
log_not_found off;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
}

Replace your-domain-name.tld with your actual domain.

Step 7: Configuring Database

sudo mysql -u root -p
CREATE DATABASE `pastefy-db` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER `pastefy-user`@`localhost` IDENTIFIED BY 'password';
GRANT ALL ON `pastefy-db`.* TO `pastefy-user`@`localhost`;
FLUSH PRIVILEGES;
exit

Set up a MySQL/MariaDB database for Pastefy.

Step 8: Configuring Environment Variables

sudo cp .env.example .env
sudo nano .env

Edit the .env file with your database details and domain information.

Step 9: Setting Up Cache and Storage

sudo mkdir /var/www/html/pastefy/storage
sudo chown -R www-data:www-data /var/www/html/pastefy/storage
sudo ln -s /var/www/html/pastefy/storage/ /var/www/html/pastefy/public/storage

Configure storage and cache directories.

Step 10: Migrating Database

sudo php artisan migrate

Migrate the Pastefy database.

Step 11: Configuring Queue Worker

sudo php artisan queue:work --queue=pastefy

Set up a queue worker to improve performance.

Step 12: Running Pastefy

You can now access Pastefy via http://your-domain-name.tld in your browser.

Conclusion:

Congratulations, you have successfully installed Pastefy on Debian Latest. This platform allows you to efficiently share text content online.