Coppermine is a multi-purpose, fully-featured and integrated web picture gallery script written in PHP using GD or ImageMagick as image library with a MySQL back-end. Coppermine Photo Gallery (CPG) is an open source project released under the GNU/GPL terms. It is fairly easy to install Coppermine on a CentOS 7 VPS. The installation process should take about 5-10 minutes if you follow the very easy steps described below.
At the time of writing this tutorial, Coppermine 1.5.44 is the latest stable version available and it requires:
– Apache web server;
– PHP (version 4.3.0 or higher) along with the mbstring, curl, zip, gd and mcrypt extensions. They are most generally active by default on a standard php installation.
– MySQL (version 4.1 or higher) installed on your Linux VPS;
Log in to your CentOS 7 server via SSH as user root
ssh root@IP
First of all make sure that all packages installed on your server are updated to the latest version, by running the following command:
yum -y update
and install some packages needed for installing Coppermine
yum -y install unzip wget nano
Next, run the following command to install Apache web server
yum -y install httpd
Once the Apache web server is successfully installed, start it and enable it to start automatically on boot time.
systemctl start httpd systemctl enable httpd
Install PHP and several PHP modules required by Coppermine
yum -y install php php-gd php-mcrypt php-common
Run the following command on your terminal to install MariaDB server on your CentOS 7 server
yum -y install mariadb mariadb-server
Once the installation is completed start the MariaDB server and set it to start on system boot
systemctl start mariadb systemctl enable mariadb
Then, run the mysql_secure_installation script
. This script will help you to improve the security of your MariaDB installation and set your MariaDB root password.
Coppermine requires an empty database, so login to the MariaDB server with the root user and create a new user and database that will be used by Coppermine to store information
mysql -u root -p MariaDB [(none)]> CREATE DATABASE coppermine; MariaDB [(none)]> GRANT ALL PRIVILEGES ON coppermine.* TO 'coppermineuser'@'localhost' IDENTIFIED BY 'your-password'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> \q</pre> exit
Don’t forget to replace ‘your-password’ with an actual strong password.
Go to Coppermine’s official website and download the latest available version of the application to your server.
wget http://downloads.sourceforge.net/project/coppermine/Coppermine/1.5.x/cpg1.5.44.zip
Once it is downloaded, unpack the zip archive to the document root directory on your server.
unzip cpg1.5.44.zip -d /var/www/html
All Coppermine files will be unpacked in a new ‘cpg15x’ directory. We will rename the directory to something more simple
mv /var/www/html/cpg15x /var/www/html/coppermine
Change the owner and group of all files and directories
chown -R apache:apache /var/www/html/coppermine
On the next step, we will create Apache virtual host for your Coppermine Photo Gallery. First, create ‘/etc/httpd/conf.d/vhosts.conf’ file with the following content:
IncludeOptional vhosts.d/*.conf
create a new directory
mkdir /etc/httpd/vhosts.d/
and create a virtual host with the following content
nano /etc/httpd/vhosts.d/yourdomain.com.conf <VirtualHost YOUR_SERVER_IP:80> ServerAdmin [email protected] DocumentRoot "/var/www/html/coppermine/" ServerName yourdomain.com ServerAlias www.yourdomain.com ErrorLog "/var/log/httpd/yourdomain.com-error_log" CustomLog "/var/log/httpd/yourdomain.com-access_log" combined <Directory "/var/www/html/coppermine/"> DirectoryIndex index.html index.php Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
Close the nano text editor, save the file and restart the web server for the changes to take effect
systemctl restart httpd
Now, open your favorite web browser, navigate to http://your-domain.com/install and if you configured everything correctly the Coppermine installer should be starting. You should follow the easy instructions on the install screen inserting the necessary information as requested.
Of course you don’t have to do any of this if you use one of our Linux Cloud Hosting services, in which case you can simply ask our expert Linux admins to install Coppermine for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.