How to install Blesta on Centos

Billing Area

Sorry for the inconvience we're currently re-doing our website. Why not check out our community forums?

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 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: wget && rpm -Uvh epel-release-latest-7.noarch.rpm
REMI: wget && rpm -Uvh remi-release-7*.rpm

After we've got the repositories we need, we need to upgrade PHP so firstly we need to change the Remi configuration:
nano -w /etc/yum.repos.d/remi-php70.repo

Then change enabled= to 1.

We then need to upgrade to PHP 7.1, simple run:
yum --enablerepo=remi upgrade php-* -y

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;chmod 700 ./;./ 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 to install that we first need to prepare the repo:
nano -w /etc/yum.repos.d/MariaDB.repo

Paste in the following:

name = MariaDB
baseurl =

After you've saved that we need to run:
yum install MariaDB-server MariaDB-client -y && systemctl start 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

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

Please run: rpm --import

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 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:

Now grab the latest Blesta files:

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

Download the version (currently 4.2.2):
wget -N

Unzip the zip:

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

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 ./hotfix-php7
rm -rf ./
rm -rf ./
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 root

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.

0 0

You are not logged in