How to Install Concrete5 CMS with Apache and free Let's Encrypt SSL on Ubuntu 20.04
Concrete5 is an open-source content management system used to publish content on the internet. It is written in PHP and uses MariaDB as a database backend. It provides an easy-to-use builder that helps you to create pages and content through the web browser. It is flexible, secure, mobile-ready, and based on Model-View-Controller architecture. It offers a rich set of features including, WYSIWYG content editor, Media Manager, Drag and Drop Content, In-context editing, and many more.
In this post, we will show you how to install Concrete5 CMS with Apache and Let's Encrypt SSL on Ubuntu 20.04 server.
Requirements
- A server running Ubuntu 20.04.
- A valid domain name pointed to the server IP.
- A root password is configured on your server.
Getting Started
First, you will need to update the APT package index to the latest version. You can update it with the following command:
apt-get update -y
Once the APT index is updated, you can proceed to the next step.
Install Apache, MariaDB and PHP
Next, you will need to install the Apache web server, MariaDB database server, PHP, and other PHP extensions to your server. You can install all of them using the following command:
apt-get install apache2 mariadb-server php libapache2-mod-php libapache2-mod-php php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-ldap php-zip php-curl -y
Once all the packages are installed, edit the php.ini file and set the desired values:
nano /etc/php/7.4/apache2/php.ini
Change the following lines:
file_uploads = On allow_url_fopen = On memory_limit = 256M upload_max_filesize = 64M date.timezone = Asia/Kolkata
Save and close the file when you are finished then restart the Apache service to apply the changes:
systemctl restart apache2
Once you are finished, you can proceed to the next step.
Create a Concrete5 Database
Next, you will need to create a database and user for Concrete5. First, login to the MariaDB with the following command:
mysql
Once login, create a database and user with the following command:
MariaDB [(none)]> CREATE DATABASE concrete5;
MariaDB [(none)]> CREATE USER 'concrete5user'@'localhost' IDENTIFIED BY 'password';
Next, grant all the privileged to the Concrete5 database with the following command:
MariaDB [(none)]> GRANT ALL ON concrete5.* TO 'concrete5user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Next, flush the privileges and exit from the MariaDB console with the following command:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
Once you are finished, you can proceed to the next step.
Download Concrete5 CMS
First, go to the Concrete5 CMS website copy the URL of the latest version of Concrete5, and download it with the following command:
wget --trust-server-names https://www.concrete5.org/download_file/-/view/115589/ -O concrete5.zip
Once the download is completed, extract the downloaded file with the following command:
unzip concrete5.zip
Next, move the extracted directory to the Apache web root directory using the following command:
mv concrete5-* /var/www/html/concrete5
Next, set proper permission and ownership to the concrete5 directory with the following command:
chown -R www-data:www-data /var/www/html/concrete5/
chmod -R 755 /var/www/html/concrete5/
Once you are finished you can proceed to the next step.
Configure Apache for Concrete5 CMS
Next, you will need to create an Apache virtual host configuration file for Concrete5 CMS. You can create it with the following command:
nano /etc/apache2/sites-available/concrete5.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/concrete5/ ServerName concrete5.example.com <Directory /var/www/html/concrete5/> Options +FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Save and close the file then enable the Apache virtual host and rewrite module with the following command:
a2ensite concrete5.conf
a2enmod rewrite
Next, restart the Apache service to apply the changes:
systemctl restart apache2
You can also check the status of the Apache service using the following command:
systemctl status apache2
You should get the following output:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2021-05-15 15:00:03 UTC; 4s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 15566 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 15585 (apache2) Tasks: 6 (limit: 2353) Memory: 13.5M CGroup: /system.slice/apache2.service ??15585 /usr/sbin/apache2 -k start ??15586 /usr/sbin/apache2 -k start ??15587 /usr/sbin/apache2 -k start ??15588 /usr/sbin/apache2 -k start ??15589 /usr/sbin/apache2 -k start ??15590 /usr/sbin/apache2 -k start May 15 15:00:03 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...
At this point, the Apache web server is configured to host Concrete5 CMS. You can now proceed to the next step.
Access Concrete5 CMS Web Interface
Now, open your web browser and access the Concrete5 CMS web interface using the URL http://concrete5.example.com. You will be redirected to the following page:
Select your language and click on the Arrow button. You should see the following page:
Make sure all the required libraries are installed, then click on the Continue to Installation button, You should see the following page:
Here, provide Admin username, password, database username, password, and database name, then click on the Install Concrete5 button to start the installation. Once the installation is completed, you should see the following page:
Now, click on the Edit Your Site button, you should see the Concrete5 dashboard on the following page:
Secure Concrete5 with Let's Encrypt SSL
Next, it is recommended to secure your website with Let's Encrypt SSL. First, install the Certbot client using the following command:
apt-get install python3-certbot-apache -y
Once installed, run the following command to secure your website with Let's Encrypt SSL:
certbot --apache -d concrete5.example.com
You will be asked to provide your email and accept the term of service as shown below:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer None Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Plugins selected: Authenticator apache, Installer apache Obtaining a new certificate Performing the following challenges: http-01 challenge for concrete5.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/concrete5-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/concrete5-le-ssl.conf Enabling available site: /etc/apache2/sites-available/concrete5-le-ssl.conf
Next, select whether or not to redirect HTTP traffic to HTTPS as shown below:
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Type 2 and hit Enter to install the Let's Encrypt SSL for your website:
Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-enabled/concrete5.conf to ssl vhost in /etc/apache2/sites-available/concrete5-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://concrete5.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=concrete5.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/concrete5.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/concrete5.example.com/privkey.pem Your cert will expire on 2020-10-23. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Now, you can access Concrete 5 securely using the URL https://concrete5.example.com.
Conclusion
In the above guide, you learned how to install Concrete5 CMS with Apache and Let's Encrypt SSL on Ubuntu 20.04. You can now publish your content on the internet easily using the Concrete5 CMS. Feel free to ask me if you have any questions.