In this tutorial, we will show you how to install Elefant CMS on an Ubuntu 16.04 VPS with Apache, PHP and MySQL installed on it. Elefant CMS is an open source CMS and web framework written in PHP that allows web developers to create everything from simple websites to complete web applications. This tutorial was tested and written for an Ubuntu VPS, but it should work on any Debian based Linux distribution.
This install guide assumes that Apache, MySQL and PHP are already installed and configured on your virtual server. At the time of writing this tutorial, the latest version of Elefant CMS is 1.3.12 and it requires:
- PHP 5.3.x with the CURL PHP extension enabled;
- Nginx web server or Apache web server >= 2.0 compiled with mod_rewrite module and with the following directives allowed: RewriteEngine, RewriteBase, RewriteCond and RewriteRule.;
- MySQL, SQLite or PostgreSQL installed on your virtual server (MariaDB and Percona are also supported).
Let’s start with the installation. Make sure your server OS packages are fully up-to-date:
apt-get update apt-get upgrade
It is best to install Elefant CMS using Composer, so install Composer if it is not already installed by running the following commands:
apt-get install curl cd /opt curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
Download the latest version of Elefant CMS using the following commands:
cd /var/www composer create-project elefant/cms --stability=dev your-domain.com
Do not forget to replace your-domain.com with your actual domain name.
Alternatively, if you do not want to use Composer, you can always download the latest version at https://github.com/jbroadway/elefant/releases , then extract the Elefant CMS archive to the /var/www/html/your-domain.com/ directory on your server.
Next, create a new MySQL database for Elefant CMS to use and assign a user to it with full permissions:
mysql -u root -p mysql> SET GLOBAL sql_mode=''; mysql> CREATE USER elefant; mysql> CREATE DATABASE elefantdb; mysql> GRANT ALL PRIVILEGES ON elefantdb.* TO 'elefant'@'localhost' IDENTIFIED BY 'your-password' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; mysql> quit
Do not forget to replace ‘your-password’ with a strong password.
Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘elefant.conf’ on your virtual server:
Edit the ‘elefant.conf’ configuration file:
and add the following lines to it:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/your-domain.com/ ServerName your-domain.com ServerAlias www.your-domain.com <Directory /var/www/html/your-domain.com/> Options FollowSymLinks AllowOverride All </Directory> ErrorLog /var/log/apache2/your-domain.com-error_log CustomLog /var/log/apache2/your-domain.com-access_log common </VirtualHost>
Then, run the following command:
ln -s /etc/apache2/sites-available/elefant.conf /etc/apache2/sites-enabled/elefant.conf
Or, use the a2ensite to enable the ‘elefant.conf’ configuration in Apache:
sudo a2ensite elefant.conf
Set the proper file permissions for the Apache web server to write to the Elefant CMS document root (‘/var/www/html/your-domain.com’) directory:
sudo chown -R www-data:www-data /var/www/html/your-domain.com/
Enable the Apache2 rewrite module if it is not already done so:
sudo a2enmod rewrite
Restart the Apache web server for the changes to take effect:
service apache2 restart
Open your favorite web browser, navigate to http://your-domain.com/install/ , start the installation process and follow the easy instructions:
Click ‘Next: License’ , accept the license, check if server requirements are met then click ‘Next:Database’ and enter the following information:
Click ‘Connect & Create Schema’, enter the site name and set the email address and password of the Elefant CMS administrative user.
That is it. The Elefant CMS installation is now complete.
Log in to the administration back-end of the Elefant CMS at http://your-domain.com/admin and start using it, write a blog post, upload files etc.
Of course you don’t have to do any of this if you use one of our Optimized Ubuntu Hosting services, in which case you can simply ask our expert Linux admins to install Elefant CMS 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.