Step-by-Step Guide: Installing ElefantCMS on Ubuntu 20.04
ElefantCMS is a free and open-source content management platform that features a user-friendly interface for managing website content effortlessly. Key highlights of this CMS include:
- Built-in WYSIWYG editor that supports dynamic plugins to enhance features.
- Native support for multiple languages with integrated language control tools.
- Streamlined architecture, making it simple for developers to extend core functionalities.
- Variety of mini-apps to accelerate project development.
This guide walks you through the installation of ElefantCMS on a Ubuntu 20.04 server.
Prerequisites
- Deploy an Ubuntu 20.04 server and ensure it is fully updated.
- Create a non-root user with sudo privileges.
1. Install Necessary Software Packages
Update the System’s Package Index
$ sudo apt update
Install PHP 7.4 and Additional 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
Modify PHP Configuration Settings
Open the PHP settings file with a text editor:
$ sudo nano /etc/php/7.4/apache2/php.ini
Update the following parameters. To search inside the file, press Control+W, type the keyword, and press Enter:
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Africa/Nairobi
Enable and Restart Apache Web Server
Enable Apache to run at system boot:
$ sudo systemctl enable apache2
Apply changes by restarting the Apache service:
$ sudo systemctl restart apache2
2. Install ElefantCMS on Ubuntu 20.04
Download the Latest ElefantCMS Release
Fetch the current stable build of ElefantCMS. You can always check for the most recent version by visiting the official download page.
$ wget https://github.com/jbroadway/elefant/archive/elefant_2_2_6_stable.tar.gz
Extract the Compressed Archive
Unpack the contents of the downloaded archive file:
$ sudo tar -xvzf elefant_2_2_6_stable.tar.gz
Rename the Project Directory
Change the extracted folder name to something more descriptive:
$ sudo mv elefant-elefant_2_2_6_stable elefantcms
Move ElefantCMS to the Web Server Root
Relocate the renamed directory into Apache’s default web root:
$ sudo mv elefantcms /var/www/html/
Clean Up the Installation Files
Delete the compressed file now that it’s no longer needed:
$ sudo rm elefant_2_2_6_stable.tar.gz
Set File Ownership
Adjust ownership so Apache has proper access to the CMS files:
$ sudo chown -R www-data:www-data /var/www/html/elefantcms
Update Directory Permissions
Grant suitable permissions to the directory and its contents:
$ sudo chmod -R 755 /var/www/html/elefantcms
3. Create the ElefantCMS MySQL Database
Enable MySQL Service on Boot
Make sure the MySQL service is configured to start automatically with the system:
$ sudo systemctl enable mysql
Run MySQL Secure Installation
Execute the built-in security script to harden your MySQL server against potential threats:
$ sudo mysql_secure_installation
Answer the prompts as follows:
- Set up VALIDATE PASSWORD plugin? Type
N
and press Enter. - Remove anonymous users? Type
Y
and press Enter. - Disallow remote root login? Type
Y
and press Enter. - Delete test database and related access? Type
Y
and press Enter. - Reload privilege tables? Type
Y
and press Enter.
Access the MySQL Shell
Log into MySQL using the root user. When prompted, enter the password you configured during the secure installation:
$ sudo mysql -u root -p
Create the ElefantCMS Database
Inside the MySQL shell, create a new database named elefant
:
CREATE DATABASE elefant;
Create a New MySQL User
Set up a new database user called elefantuser
and assign a secure password. Be sure to replace SecurePassword
with a strong, unique password:
CREATE USER 'elefantuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'SecurePassword';
Grant Permissions to the New User
Allow the newly created user full control over the elefant
database:
GRANT ALL ON elefant.* TO 'elefantuser'@'localhost' WITH GRANT OPTION;
Apply Changes and Exit MySQL
Reload the privilege table to apply the new access rules:
FLUSH PRIVILEGES;
Exit the MySQL environment:
exit;
4. Configure Apache2 for ElefantCMS
Create a Virtual Host File
Set up a new Apache site configuration by creating a dedicated file named elefantcms.conf
:
$ sudo nano /etc/apache2/sites-available/elefantcms.conf
Add the following configuration into the file, then save and exit the editor:
<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>
Activate Apache Modules and Configuration
Enable the rewrite
module, which is necessary for friendly URLs:
$ sudo a2enmod rewrite
Enable the newly created ElefantCMS virtual host configuration:
$ sudo a2ensite elefantcms.conf
Disable the default Apache virtual host configuration to prevent conflicts:
$ sudo a2dissite 000-default.conf
Allow Web Traffic Through Port 80
Permit incoming HTTP traffic via UFW:
$ sudo ufw allow 80
Restart Apache to Apply Changes
Reboot the Apache service so all the modifications take effect:
$ sudo systemctl restart apache2
5. Access the ElefantCMS Installer
To begin setting up ElefantCMS, launch your web browser and navigate to:
http://Server_IP/install/
For example:
http://192.0.2.10/install/
Remove the Installation Directory
Once setup is completed through the browser interface, remove the installer directory for security purposes:
$ sudo rm -r /var/www/html/elefantcms/install
Conclusion
You’ve successfully installed ElefantCMS on your Ubuntu 20.04 server. Proceed by accessing the installation wizard to link your database credentials and set up an administrator account. Once logged in, you’re ready to start adding and managing your website content using ElefantCMS’s intuitive interface.