How to install Zenphoto Gallery CMS on a CentOS 7 VPS

Zenphoto is free and open-source standalone content management system (CMS) for creating gallery focused websites. Zenphoto is feature rich PHP based application and it has everything you need to manage your own photo galleries. In this blog tutorial we will install Zenphoto on CentOS 7 VPS with Apache, MariaDB and PHP

To be eligible to run Zenphoto, you need to have the following requirements installed on your server:
– A web server – Apache or Nginx
– PHP version 5.2 or newer with GD and imagick extensions.
– MySQL/MariaDB database version 5 or newer.

Log in to your CentOS VPS via SSH as user root

ssh root@IP

and make sure that all packages are up to date by executing the following command

yum -y update

Run the following command to install MariaDB database server

yum install mariadb mariadb-server

Start the MariaDB database server and enable it to start at the boot time

systemctl start mariadb
systemctl enable mariadb

Run the ‘mysql_secure_installation’ script to secure the database server and set your MariaDB root password

Log in to the MariaDB server using the ‘root’ user and create new database end user.

mysql -u root -p

CREATE USER 'zenphotouser'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON `zenphoot`.* TO 'zenphotouser'@'localhost';

Don’t forget to replace ‘PASSWORD’ with a strong password.

Next, we will install Apache web server

yum install httpd

Start the Apache web server and add it to automatically start on the system start-up

systemctl start httpd
systemctl enable httpd

Now we need to install PHP among with few PHP modules

yum install php php-gd php-common

Install ImageMagic package and ImageMagic PHP extension

yum install ImageMagick
pecl install imagick
echo "extension=imagick.so" > /etc/php.d/imagick.ini

Once all requirements are installed. download the latest stable release of Zenphoto from their official website.

wget https://github.com/zenphoto/zenphoto/archive/zenphoto-1.4.9.zip

Unpack the downloaded zip archive to the document root directory on your server

unzip enphoto-1.4.9.zip -d /var/www/html/

If you are not sure where is your document root directory you can use the following command to find out

grep -i '^documentroot' /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html"

Change the current working directory and rename the unpacked Zenphoto directory

cd /var/www/html/
mv zenphoto-zenphoto-1.4.9/ zenphoto

Change the ownership of the directory

chown -R apache:apache zenphoto

Next, create Apache virtual host for your domain. Create ‘/etc/httpd/conf.d/vhosts.conf’ directory with the following content

vim /etc/httpd/conf.d/vhosts.conf

IncludeOptional vhosts.d/*.conf

and create the virtual host

vim /etc/httpd/vhosts.d/yourdomain.com.conf

<VirtualHost YOUR_SERVER_IP:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot "/var/www/html/zenphoto/"
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/zenphoto/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted

Restart the Apache web server for the changes to take effect.

systemctl restart httpd

Open your favorite web browser and navigate to your Zenphoto gallery at http://yourdomain.com . It will automatically run the installation script and will prompt you to enter the MySQL information of the database we created in this tutorial.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Zenphoto 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.

Categories: Tutorials

View Comments

Leave a Comment