How to install Blesta on Centos

Billing Area

Grab BlestaCMS Owned for only £78.24 or $100 with coupon: VOU-CMSsales

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 https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && rpm -Uvh epel-release-latest-7.noarch.rpm
REMI: wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm && 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

Find:
[remi-php71]
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 https://blesta.store/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 to install that we first need to prepare the repo:
nano -w /etc/yum.repos.d/MariaDB.repo

Paste in the following:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

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 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/108/blesta-4.2.2.zip

Unzip the zip:
unzip blesta-4.2.2.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 ./blesta-4.0.0.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 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.

1 0