How to Install PurritoBin on FreeBSD Latest
PurritoBin is a simple and fast pastebin web application that allows users to upload, store and share code snippets. In this tutorial, we will show you how to install PurritoBin on FreeBSD latest version.
Prerequisites
Before we begin, you must ensure that the following prerequisites are met:
- A FreeBSD Latest server, configured with a non-root sudo user or logged in as the root user.
- Apache webserver installed and running on your system.
- PHP 7.2 or above installed on your system.
Step 1: Installing Required Packages
The first step is to install the required packages for PurritoBin. You can do this by running the following command:
sudo pkg install git php72 php72-pdo_sqlite php72-pdo_mysql php72-curl
Once the packages are installed, we can proceed with the next step.
Step 2: Clone PurritoBin
The next step is to clone the PurritoBin repository from Github. You can do this by running the following command:
sudo git clone https://github.com/PurritoBin/PurritoBin /usr/local/www/apache24/data/purritobin
This command will clone the repository to the /usr/local/www/apache24/data/purritobin directory.
Step 3: Configure PurritoBin
The next step is to configure PurritoBin. To do this, navigate to the config directory inside the purritobin directory:
cd /usr/local/www/apache24/data/purritobin/config
Copy config.php.example to config.php:
cp config.php.example config.php
Next, edit config.php and update the following variables:
PURRITO_URL: The URL where you will access PurritoBin.PURRITO_EXPIRE: The number of days before a paste gets expired.DB_TYPE: The database type. In our case, it will be SQLite.DB_FILE: The path to the SQLite database file.
To use SQLite, set DB_TYPE to sqlite and set DB_FILE to the path of your SQLite database file. For example:
define('DB_TYPE', 'sqlite');
define('DB_FILE', '/usr/local/www/apache24/data/purritobin/data/purritobin.sqlite');
Once you have configured the config.php file, you can proceed with the next step.
Step 4: Set Permissions
The next step is to set the correct permissions to the necessary directories. To do this, run the following command:
sudo chown -R www:www /usr/local/www/apache24/data/purritobin/
sudo chmod -R 755 /usr/local/www/apache24/data/purritobin/
Step 5: Create the SQLite Database
The next step is to create an SQLite database for PurritoBin. To do this, navigate to the data directory and run the following command:
cd /usr/local/www/apache24/data/purritobin/data
touch purritobin.sqlite
This command will create an empty SQLite database file.
Step 6: Set Up Apache
The final step is to configure Apache to serve PurritoBin. To do this, navigate to the /usr/local/etc/apache24/Includes/ directory and create a new file called purritobin.conf:
sudo nano /usr/local/etc/apache24/Includes/purritobin.conf
Add the following content to the file:
Alias /purritobin /usr/local/www/apache24/data/purritobin/public
<Directory /usr/local/www/apache24/data/purritobin/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Save the file and exit.
Finally, restart Apache to make the changes take effect:
sudo service apache24 restart
Step 7: Access PurritoBin
PurritoBin is now installed and configured on your FreeBSD Latest server. To access PurritoBin, open a web browser and navigate to the URL you set in the PURRITO_URL variable in the config.php file. For example, if you set PURRITO_URL to http://example.com/purritobin, then you would navigate to http://example.com/purritobin in your web browser.
Conclusion
You have successfully installed PurritoBin on your FreeBSD Latest server! You can now upload, store and share code snippets using PurritoBin.