How to Install Cerb Collaboration and Email Automation on CentOS 8
Cerb is a free, open-souce and web-based collaboration and automation tool used for sending high volumes of emails. It is written in PHP and uses MySQL or MariaDB as a database backend. It comes with a simple and easy to use web interface that can be used for real-time monitoring, task management, and goal tracking.
In this tutorial, we will learn how to install and configure Cerb on CentOS 8 server.
Prerequisites
- A server running CentOS 8.
- A valid domain pointed with your server IP. In this tutorial, we will use cerb.example.com domain.
- A root password is configured the server.
Getting Started
Before starting, you will need to install EPEL and Remi PHP repository in your system. You can install them with the following command:
dnf install epel-release -y
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
dnf module enable php:remi-7.4
Once both repository are installed, you can proceed to the next step.
Install LAMP Stack
Next, you will need to install Apache, MariaDB, PHP and other required PHP extensions in your server. You can install all of them with the following command:
dnf install httpd mariadb-server php php-cli php-zip php-curl php-dom php-gd php-imap php-json php-mbstring php-mysqli php-openssl php-pcre php-session php-simplexml php-xml php-spl php-mailparse git unzip wget -y
Once all the packages are installed, edit the php.ini file and change some settings:
nano /etc/php.ini
Change the following lines with your desired values:
memory_limit = 256M upload_max_filesize = 32M post_max_size = 32M date.timezone = Asia/Kolkata
Save and close the file when you are finished. Then, start the Apache and MariaDB service and enable them to start at system reboot with the following command:
systemctl start httpd
systemctl start mariadb
systemctl enable httpd
systemctl enable mariadb
Once you are finished, you can proceed to the next step.
Configure MariaDB Server
First, you will need to secure the MariaDB and set the MariaDB root password. You can do it by running the following command:
mysql_secure_installation
Answer all the questions as shown below:
Enter current password for root (enter for none): Enter Set root password? [Y/n]: Y New password: Re-enter new password: Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Once your MariaDB installation is secured, log in to the MariaDB shell with the following command:
mysql -u root -p
Provide your MariaDB root password when prompt then create a database and user for Cerb with the following command:
MariaDB [(none)]>CREATE DATABASE cerb;
MariaDB [(none)]>GRANT ALL PRIVILEGES ON cerb.* TO 'cerb'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Next, flush the privileges and exit from the MariaDB shell with the following command:
MariaDB [(none)]>FLUSH PRIVILEGES;
MariaDB [(none)]>EXIT;
Once you are finished, you can proceed to the next step.
Install Postfix
Next, you will need to install the Postfix mail server package in your server. You can install it by running the following command:
dnf install postfix -y
Once the Postfix is installed, start the Postfix service and enable it to start at system reboot with the following command:
systemctl start postfix
systemctl enable postfix
Once you are finished, you can proceed to the next step.
Install Composer
The Composer is a dependency manager for PHP used for installing required dependencies for your project. You can download the Composer installation script with the following command:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
Next, download the signature of the latest Composer installer from the Composer's Github repository w and store it in the variable ith the following command:
HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
Next, verify the installer script with the following command:
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
If everything will be fine, you should see the following output:
Installer verified
Finally, install the Composer with the following command:
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
You should get the following output:
All settings correct for using Composer Downloading... Composer (version 2.0.7) successfully installed to: /usr/local/bin/composer Use it: php /usr/local/bin/composer
You can verify the Composer version with the following command:
composer --version
You should get the following output:
Composer version 2.0.7 2020-11-13 17:31:06
Once you are finished, you can proceed to the next step.
Download Cerb
Next, download the latest version of the Cerb from the Git repository to the Apache root directory using the following command:
cd /var/www/html
git clone git://github.com/wgm/cerb.git cerb
Once the download is completed, change the directory to the cerb and install the required dependencies with the following command:
cd cerb
composer install
Next, set the ownership and permission of the cerb directory using the following command:
chown -R apache:apache /var/www/html/cerb
chmod -R 755 /var/www/html/cerb
Once you are finished, you can proceed to the next step.
Configure Apache for Cerb
Next, you will need to create an Apache virtual host configuration file for Cerb. You can create it with the following command:
nano /etc/httpd/conf.d/cerb.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/var/www/html/cerb" ServerName cerb.example.com ErrorLog "/var/log/httpd/cerb-error_log" CustomLog "/var/log/httpd/cerb-access_log" combined </VirtualHost>
Save and close the file when you are finished. Then, restart the Apache service with the following command:
systemctl restart httpd
You can now verify the status of the Apache using the following command:
systemctl status httpd
You should get the following output:
? httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/httpd.service.d ??php-fpm.conf Active: active (running) since Tue 2020-11-17 03:35:53 EST; 7s ago Docs: man:httpd.service(8) Main PID: 5545 (httpd) Status: "Started, listening on: port 80" Tasks: 213 (limit: 25014) Memory: 28.9M CGroup: /system.slice/httpd.service ??5545 /usr/sbin/httpd -DFOREGROUND ??5547 /usr/sbin/httpd -DFOREGROUND ??5548 /usr/sbin/httpd -DFOREGROUND ??5549 /usr/sbin/httpd -DFOREGROUND ??5550 /usr/sbin/httpd -DFOREGROUND Nov 17 03:35:52 centos8 systemd[1]: Stopped The Apache HTTP Server. Nov 17 03:35:52 centos8 systemd[1]: Starting The Apache HTTP Server...
Once you are finished, you can proceed to the next step.
Configure SELinux and Firewall
By default, SELinux is enable in CentOS 8. So you will need to configure SELinux for Cerb. You can configure it with the following command:
setsebool -P httpd_can_network_connect 1
Next, you will need to allow port 80 and 443 through firewalld. You can do it with the following command:
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-service=https
Reload the firewalld to apply all the changes with the following command:
firewall-cmd --reload
Once you are finished, you can proceed to the next step.
Access Cerb Web UI
Now, open your web browser and access Cerb using the URL http://cerb.example.com. You should see the following page:
Check all the dependencies and click on the Continue button. You should see the following page:
Click on the I Accept button to accept the License agreement. You should see the following page:
Provide your database information and click on Verify database connection. You should see the following page:
Provide your SMTP details and click on the Verify mail settings. You should see the following page:
Provide your account information and click on the Continue button. You should see the following page:
Choose your package and click on the Continue button. You should see the following page:
Click on the Continue button. You should see the following page:
Next, remove the install directory with the following command:
rm -rf /var/www/html/cerb/install/
Click on the Log in and get started button. You should see the following page:
Provide your email address and click on the Continue button. You should see the following page:
Provide your password and click on the Sign On button. You should see the Cerb default dashboard in the following page:
Conclusion
Congratulations! you have successfully installed and configured Cerb with Apache on CentOS 8. You can now send high volumes of emails using the Cerb dashboard. Feel free to ask me if you have any questions.