PrivateBin is a free and open-source online tool for sharing sensitive information securely. In this tutorial, we will guide you through the process of installing PrivateBin on Ubuntu Server.
Before installing any new software, it's always recommended to update and upgrade the system to its latest version. To do so, run the following command:
sudo apt update && sudo apt upgrade -y
This command will update the package lists and upgrade any packages that need to be updated.
PrivateBin requires a web server and PHP to work properly. Use the following command to install these dependencies:
sudo apt install apache2 php libapache2-mod-php php-mbstring php-gd php-xml php-json
This command will install Apache web server, the PHP language, and some necessary PHP extensions.
PrivateBin stores its data in a database. We will use MySQL as our database management system. To install MySQL, run the following command:
sudo apt install mysql-server mysql-client
During the installation process, you'll be prompted to set the MySQL root password. Choose a strong password and remember it; you'll need it later.
Next, we need to create a new MySQL database and a user with permissions to access that database. To do so, follow these steps:
Log in to MySQL as the root user by running the following command:
sudo mysql -u root -p
Enter the MySQL root password when prompted.
Create a new database for PrivateBin by running the following command:
CREATE DATABASE privatebin;
Create a new user and grant them permissions to access the database by running the following command:
GRANT ALL PRIVILEGES ON privatebin.* TO 'privatebin'@'localhost' IDENTIFIED BY 'password';
Replace password
with a strong password of your choice.
Exit MySQL by running the following command:
exit
Now we're ready to install PrivateBin. Follow these steps:
Download the latest version of PrivateBin from the official website:
sudo wget https://github.com/PrivateBin/PrivateBin/archive/master.zip -O privatebin.zip
Unzip the downloaded file using the following command:
sudo unzip privatebin.zip -d /var/www/html/
Rename the extracted directory to privatebin:
sudo mv /var/www/html/PrivateBin-master /var/www/html/privatebin
Change the ownership of the privatebin directory to the Apache web server user (www-data):
sudo chown -R www-data:www-data /var/www/html/privatebin
Before we can use PrivateBin, we need to configure it. Follow these steps:
Copy the sample configuration file to the PrivateBin directory:
sudo cp /var/www/html/privatebin/config/cfg.sample.php /var/www/html/privatebin/config/config.php
Open the configuration file for editing:
sudo nano /var/www/html/privatebin/config/config.php
Look for the following lines and modify them as shown:
$config['baseurl'] = ''; // Change to the URL where you'll access PrivateBin
$config['database'] = array(
'adapter' => 'mysql',
'dsn' => 'mysql:dbname=privatebin;host=localhost;charset=utf8mb4', // The name of the database we created earlier
'username' => 'privatebin', // The username we created earlier
'password' => 'password', // The password we specified earlier
'table_prefix' => '',
);
Replace password
with the password you specified earlier.
Save and exit the configuration file (Ctrl+O, Ctrl+X).
To secure PrivateBin, we recommend configuring it to use HTTPS. Follow these steps:
Install certbot
to obtain a free SSL certificate from Let's Encrypt:
sudo apt install certbot python3-certbot-apache
Obtain a certificate for your server's domain name by running the following command:
sudo certbot --apache
Follow the prompts to obtain and install the certificate.
Restart Apache to apply the certificate:
sudo systemctl restart apache2
Congratulations, you've successfully installed PrivateBin on your Ubuntu Server! You can now access it by visiting the URL you specified in the configuration file.
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!