Install ElefantCMS on Ubuntu 20.04

Updated on November 21, 2023
Install ElefantCMS on Ubuntu 20.04 header image

Introduction

ElefantCMS is an open-source Content Management System (CMS) with a simple interface that allows users to organize their content easily. Some of its notable features are:

  • Integration of WYSIWYG editor to support dynamic object plugins for extra functionality.
  • Multi-lingual support with built-in language management tools.
  • Simple system architecture to enable developers to add system functionality.
  • Multiple mini-applications for fast development.

This article explains how to install ElefantCMS on Ubuntu 20.04 server.

Prerequisites

1. Install Required Packages

Update system package list.

$ sudo apt update

Install PHP 7.4 and more modules.

$ sudo apt install apache2 mysql-server php7.4 libapache2-mod-php7.4 php7.4-json php7.4-common php7.4-gmp php7.4-curl php7.4-mysql php7.4-opcache php7.4-intl php7.4-fpm php7.4-xmlrpc php7.4-bcmath php7.4-zip php7.4-imagick php7.4-mbstring php7.4-gd php7.4-cli php7.4-xml php7.4-zip wget curl -y

Edit the PHP configuration file.

$ sudo nano /etc/php/7.4/apache2/php.ini

Change the following values. To search for a specific line, use Control+W, enter search phrase then press Enter.

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Africa/Nairobi

Start the Apache2 service on system startup.

$ sudo systemctl enable apache2

Restart Apache2 service for all changes made to take effect.

$ sudo systemctl restart apache2

2. Install ElefantCMS

Download the latest stable version of ElefantCMS. To find the versions available, please visit the download page.

$ wget https://github.com/jbroadway/elefant/archive/elefant_2_2_6_stable.tar.gz

Extract the downloaded files.

$ sudo tar -xvzf elefant_2_2_6_stable.tar.gz

Rename the directory with project files.

$ sudo mv elefant-elefant_2_2_6_stable elefantcms

Move the files to the web root directory.

$ sudo mv elefantcms /var/www/html/

Remove the downloaded files.

$ sudo rm elefant_2_2_6_stable.tar.gz

Change ownership of the installation directory.

$ sudo chown -R www-data:www-data /var/www/html/elefantcms

Change access permissions for the directory.

$ sudo chmod -R 755 /var/www/html/elefantcms

3. Create ElefantCMS Database

Start the MySQL service on system startup.

$ sudo systemctl enable mysql

Run mysql_secure installation script to secure MySQL database server form security breaches.

$ sudo mysql_secure_installation

When prompted, answer the questions as shown below:

  • Setup VALIDATE PASSWORD plugin? Press N, then Enter.
  • Remove anonymous users? Press Y, then Enter.
  • Disallow root login remotely? Press Y, then Enter.
  • Remove test database and access to it? Press Y, then Enter.
  • Reload privilege tables now? Press Y, then Enter.

Log in to MySQL shell. At the password prompt, enter your password to continue.

$ sudo mysql -u root -p

Create a database called elefant.

CREATE DATABASE elefant;

Create a database user called elefantuser with a password SecurePassword. Change SecurePassword to your own secure password and for all other appearances.

CREATE USER 'elefantuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'SecurePassword';

Grant the user full access to the database.

GRANT ALL ON elefant.* TO 'elefantuser'@'localhost' WITH GRANT OPTION;

Save the changes made to the database.

FLUSH PRIVILEGES;

Exit MySQL shell.

exit;

4. Configure Apache2

Create a new Apache configuration file named elefantcms.conf.

$ sudo nano /etc/apache2/sites-available/elefantcms.conf

Add the following lines of code to the file. Then, save and close the file.

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html/elefantcms
    ServerName example.com

     <Directory /var/www/html/elefantcms/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable Apache rewrite mode.

$ sudo a2enmod rewrite

Enable the new Apache configuration file.

$ sudo a2ensite elefantcms.conf

Disable Apache default configuration file.

$ sudo a2dissite 000-default.conf

Allow port 80.

$ sudo ufw allow 80

Restart Apache service for changes to take effect.

$ sudo systemctl restart apache2

5. Access ElefantCMS

To access the ElefantCMS Web Interface, go to your browser and visit http://Server_IP/install/. For example:

http://192.0.2.10/install/

After installation is completed, delete the installation folder for security reasons.

$ sudo rm -r /var/www/html/elefantcms/install

Conclusion

You have installed ElefantCMS on your Ubuntu 20.04 server. Continue with the installation by connecting to the database using your credentials and creating an administrator account. After logging in, you can begin creating your content.

More Information

To learn more about how to use ElefantCMS, go to the official documentation page.