How to Install Paste on Manjaro
Paste is a web application that allows you to store and share code snippets on any server. It's an open-source project that can be downloaded from https://phpaste.sourceforge.io/.
In this tutorial, we will guide you through the process of installing Paste on your Manjaro system.
Prerequisites
Before proceeding with the installation, ensure that you have the following prerequisites:
- A Manjaro system with sudo access
- Apache HTTP server
- PHP
- MySQL or MariaDB
Installation Steps
Follow the below steps to install Paste on your Manjaro system:
Step 1: Install the Required Packages
Paste requires Apache, PHP, and MySQL or MariaDB to function. We can install these packages using the following command:
sudo pacman -S apache php mariadb
Step 2: Install Git
We need to install Git to clone Paste's source code from GitHub. Run the below command to install Git:
sudo pacman -S git
Step 3: Clone Paste's Source Code
Now, let's clone the Paste source code from GitHub using Git. Run the following command:
git clone https://github.com/phpaste/phpaste.git
This command will clone the source code into the "phpaste" directory.
Step 4: Move the Paste Source Code to Apache's Document Root Directory
The Document Root is the directory where Apache serves the web files from. Paste's source code needs to be moved to this directory.
The default Document Root directory for Apache on Manjaro is "/srv/http/". You can move Paste's source code to this directory using the following command:
sudo mv phpaste /srv/http/
Step 5: Create a New MySQL Database for Paste
Paste requires a MySQL database to run. Let's create a new MySQL database for Paste using the following command:
sudo mysql -u root -p
This command will prompt you to enter the root password for MySQL.
Once you are in the MySQL shell, run the following command to create the new database:
CREATE DATABASE phpaste;
Exit the MySQL shell by typing "exit;".
Step 6: Set the MySQL Database Credentials
Paste's source code needs to be updated with the MySQL database's credentials. Open the "config.inc.php" file located in the "phpaste" directory using your preferred text editor.
sudo nano /srv/http/phpaste/config.inc.php
Update the following variables with your MySQL database's credentials:
$sqlopts = [
'dsn' => 'mysql:host=localhost;dbname=phpaste',
'user' => 'root',
'password' => '',
];
Step 7: Change the Ownership and Permissions of Paste's Directory
We need to change the ownership and permissions of the "phpaste" directory so that Apache can access it.
Run the following command to change the ownership to the Apache user:
sudo chown -R http:http /srv/http/phpaste/
Run the following command to change the permissions to 755:
sudo chmod -R 755 /srv/http/phpaste/
Step 8: Restart Apache
Finally, restart the Apache HTTP server using the following command:
sudo systemctl restart httpd
Conclusion
You have successfully installed Paste on your Manjaro system. You can access Paste by opening your web browser and navigating to http://localhost/phpaste/.