How to Install PictShare on Ubuntu Server Latest

Introduction

PictShare is a free and open-source image hosting web application that allows you to upload, share, view, and resize images. It is built in PHP and uses MySQL as a backend database. In this tutorial, we will learn how to install PictShare on Ubuntu Server Latest.

Prerequisites

Before you start with the installation of PictShare, make sure you have the following prerequisites:

Step 1: Download and Extract PictShare

  1. Log in to your Ubuntu server using the terminal or SSH.
  2. Create a new directory to store PictShare files:
$ sudo mkdir /var/www/pictshare
  1. Navigate to the new directory:
$ cd /var/www/pictshare
  1. Download the latest PictShare version from its official website using wget:
$ sudo wget https://github.com/chrisiaut/pictshare/archive/v2.4.0.tar.gz
  1. Extract the downloaded archive:
$ sudo tar -zxvf v2.4.0.tar.gz --strip 1
  1. You should now have all the PictShare files in the /var/www/pictshare directory.

Step 2: Set File Permissions

  1. Change the ownership of the /var/www/pictshare directory to the www-data user and group:
$ sudo chown -R www-data:www-data /var/www/pictshare
  1. Set the proper permissions for the /var/www/pictshare directory:
$ sudo chmod -R 775 /var/www/pictshare

Step 3: Configure MySQL Database

  1. Log in to your MySQL server using the terminal:
$ mysql -u root -p
  1. Create a new MySQL database for PictShare:
mysql> CREATE DATABASE pictshare;
  1. Create a new MySQL user for PictShare:
mysql> CREATE USER 'pictshare'@'localhost' IDENTIFIED BY 'password';
  1. Grant all permissions on the pictshare database to the pictshare user:
mysql> GRANT ALL PRIVILEGES ON pictshare.* TO 'pictshare'@'localhost';
  1. Flush the MySQL privileges and exit:
mysql> FLUSH PRIVILEGES;
mysql> EXIT;

Step 4: Configuring PictShare

  1. Copy the config.php.example file to config.php:
$ sudo cp config.php.example config.php
  1. Open the config.php file sudo nano config.php:
// Enter the database details
define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost');
define('DB_NAME', 'pictshare');
define('DB_USER', 'pictshare');
define('DB_PASS', 'password');

//Enter your site url here
define('URL', 'http://example.com/pictshare');

// Set the email address for admin notifications
define('ADMIN_EMAIL', 'youremail@example.com');

// Uncomment and fill out the SMTP details if you want to use SMTP for sending emails
/*
define('SMTP_HOST', '');
define('SMTP_PORT', '');
define('SMTP_AUTH', true);
define('SMTP_SECURE', 'tls');
define('SMTP_USERNAME', '');
define('SMTP_PASSWORD', '');
*/

// Set the maximum upload file size in bytes
define('MAX_UPLOAD_SIZE', 50 * 1024 * 1024);

// Set the allowed file types
define('ALLOWED_EXTENSIONS', 'jpg,jpeg,gif,png,bmp');
  1. Edit the necessary values to match your environment. Make sure to update the database details that you have set up in Step 3.

  2. Save and exit the file.

Step 5: Configure Apache

  1. Create a new Apache virtual host configuration file for PictShare:
$ sudo nano /etc/apache2/sites-available/pictshare.conf
  1. Add the following lines to the file:
<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com
  DocumentRoot /var/www/pictshare

  <Directory /var/www/pictshare>
    Options -Indexes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
  </Directory>

  ErrorLog /var/log/apache2/pictshare_error.log
  CustomLog /var/log/apache2/pictshare_access.log combined

</VirtualHost>
  1. Enable the PictShare virtual host configuration and restart Apache:
$ sudo a2ensite pictshare.conf
$ sudo systemctl restart apache2
  1. Open your web browser and navigate to your PictShare site using the URL that you set in the URL constant in config.php.

Conclusion

Congratulations! You have successfully installed PictShare on Ubuntu Server Latest. You can now start uploading, sharing, and resizing your images.

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!