How to install Blesta on Centos

Ensure you have Centos 7 and upgrade the system with the following:
yum upgrade -y

We need to install the basic PHP features for the server:

yum install mysql-server httpd php php-gd php-cli php-mysql gcc make wget tar gzip which nano screen pdo php-pdo_mysql curl openssl amp php-imap son ldap libxml php-mailparse php-mbstring php-mcrypt simplexml zlib unzip zip -y

We then need to install the two repositories we need to get PHP 7.1, first let's get to the repos folder:
cd /etc/yum.repos.d/

EPEL: yum install epel-release -y
REMI: rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

We then need to install to PHP 7.4, simple run:
yum --enablerepo=remi-php74 install php

Now for Blesta we need some extra PHP functions, to get them we just run:
yum install php-gd php-imap php-gmp php-libxml php-pecl-mailparse php-mbstring php-mcrypt php-simplexml php-zlib -y

We now need to install Ioncube as Blesta requires this for the 3 encrypted files, to do so we've got an easy to use script:
wget -N -4 https://cdn.atlanical.uk/downloads/ioncube.sh;chmod 700 ./ioncube.sh;./ioncube.sh auto

Next we need to disable SELinux (Security-Enhanced Linux):
nano /etc/selinux/config and if that fails use: cd /etc/selinux/ && nano config and then ensure it is disabled by SELINUX=disabled

We now need to set-up Mod_Rewrite this allows us to get friendly links on Blesta and not index.php/plugins/ or index.php/admin/

nano -w /etc/httpd/conf/httpd.conf

Find (Ctrl + W): <Directory "/var/www/html">
Find AllowOverride None and set it to: AllowOverride All

Now we need to reboot Apache to load our changes:
service httpd restart

Now for the MySQL we recommend MariaDB so let's install that:
sudo yum install mariadb-server mariadb -y

After we need to start MariaDB:
systemctl start mariadb;systemctl enable mariadb;

If you get an error like the following:

Downloading packages:
warning: /var/cache/yum/x86_64/7/mariadb/packages/MariaDB-10.1.18-centos7-x86_64-shared.rpm: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY
Retrieving key from https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

GPG key retrieval failed: [Errno 14] curl#60 - "Peer's Certificate has expired."

Please run: rpm --import http://yum.mariadb.org/RPM-GPG-KEY-MariaDB

Now we need to get Blesta installed so to do that we need to make a database.

Log into MySQL:
mysql -u root

Create a database:
CREATE DATABASE blesta;

Create a user:
CREATE USER 'username'@'localhost' IDENTIFIED BY 'Your_password_here';

Connect the user to the database so the user can log in:
GRANT ALL PRIVILEGES ON blesta.* TO 'username'@'localhost' IDENTIFIED BY 'Your_password_here';

Now we need to flush the privileges and exit MySQL:
FLUSH PRIVILEGES; and exit

Now grab the latest Blesta files: https://account.blesta.com/client/plugin/download_manager/client_main/

Go into the html folder:
cd /var/www/html/

Download the version (currently 4.2.2):
wget -N https://account.blesta.com/client/plugin/download_manager/client_main/download/177/blesta-5.0.3.zip

Unzip the zip:
unzip blesta-5.0.3.zip

Now we need to sort the files out, firstly let's move the files to the folder for Blesta:
\cp -rf ./blesta/* ./

Skip this if there's no hotfix...

Now we need to apply the PHP 7.1 hot-fix:
\cp -rf ./hotfix-php71/blesta/app/* ./app/

Now set the permissions for the files:
\chown -R apache: ./*

Now it's time to delete the empty & Un-needed files / folders:

rm -rf ./blesta
rm -rf ./blesta-5.0.3.zip
rm -rf ./README.md
rm -rf ./LICENSE

Next we need to set-up the cron job for Blesta.

We need to get the cron job editor using Nano and not Vim (Professional and pain in the... editor):
export VISUAL=nano;

Now we need to log into the cron job as the root user:
crontab -e -u apache

Then add the cron task:
*/5 * * * * /usr/bin/php /var/www/html/index.php cron

Finally we need to allow the port to be accessed and reboot the server.
systemctl start firewalld.service && firewall-cmd --zone=public --add-port=80/tcp --permanent && firewall-cmd --reload && systemctl enable httpd && systemctl start httpd.service

Please rate this article to help us improve our Knowledge Base.

3 0