How to install Blesta on CentOS (without a panel)? Print

  • 2

Setting up the server:

Firstly set-up a CentOS 7 VPS, this is the best and stable version of the CentOS family, then we can begin.

Let's upgrade our server: yum update -y

Now we need the packages we will need on 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

Now we need the repo's we will be using:
cd /etc/yum.repos.d/ && wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm && rpm -Uvh epel-release-latest-7.noarch.rpm remi-release-7*.rpm

Next we need to upgrade PHP, if you type in php -v you will see that the default version shipped with CentOS 7 is 5.4 which is EOL and not recommended, we're going to use the latest: nano -w /etc/yum.repos.d/remi-php70.repo find: "[remi-php70]" and change enabled=0 to enabled=1.

Now we need to upgrade PHP: yum --enablerepo=remi upgrade php-mysql php-devel php-gd php-pecl-memcache php-pspell php-snmp php-xmlrpc php-xml php-mcrypt php-imap php-mailparse -y

Install extras for Blesta: yum install php-gd php-imap php-gmp php-libxml php-pecl-mailparse php-mbstring php-mcrypt php-simplexml php-zlib -y

Now we need to use ioncube: wget -N -4 https://licensecart.com/iworx/improved-ioncube.sh;chmod 777 ./improved-ioncube.sh;./improved-ioncube.sh auto

Time to prepare MySQL: nano -w /etc/yum.repos.d/MariaDB.repo and paste in the following:

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

Then we need to install MariaDB: yum install MariaDB-server MariaDB-client -y && systemctl start mariadb


ERROR?
If you get this error:

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."

Do the following and try again: `rpm --import http://yum.mariadb.org/RPM-GPG-KEY-MariaDB

Now running: mysql -V you should see something like this: mysql Ver 15.1 Distrib 10.1.16-MariaDB, for Linux (x86_64) using readline 5.1.

Setting up Blesta:

Firstly we need a database for Blesta to work on so let's do that first so log into MySQL: mysql -u root

Time to create a database: CREATE DATABASE stable; you can use any name you like, we are going to use stable.

Next we need to create the user: CREATE USER 'bill_lang'@'localhost' IDENTIFIED BY 'Password123!'; Do not use this password for the life of us.

Now we need to connect the username to the database and grant all the permissions: GRANT ALL PRIVILEGES ON stable.* TO 'bill_lang'@'localhost' IDENTIFIED BY 'Password123!';

Finally for the databases we need to flush the privileges and quit MySQL: FLUSH PRIVILEGES; then exit.

Now we need to install Blesta. Change the url if the version is old right click on the download manager on the Blesta website: https://account.blesta.com/client/plugin/download_manager/client_main/.

cd /var/www/html/
wget -N https://account.blesta.com/client/plugin/download_manager/client_main/download/83/blesta-3.6.2.zip
unzip blesta-3.6.2.zip

Now we need to move the files and sort the permissions out.

\cp -rf ./blesta/* ./
\cp -rf ./hotfix-php7/blesta/app/* ./app/
\chown -R apache: ./*

Delete the non needed files:

rm -rf ./blesta
rm -rf ./hotfix-php7
rm -rf ./blesta-4.0.0.zip
rm -rf ./README.md
rm -rf ./LICENSE

To disable SElinux you need to do: nano /etc/selinux/config if it doesn't exist do the following: cd /etc/selinux/ && nano config put in the following: SELINUX=disabled

Now we need to set-up Mod_Rewrite: nano -w /etc/httpd/conf/httpd.conf find: <Directory "/var/www/html">(Ctrl + W) find: AllowOverride None change to AllowOverride All. Now let's restart Apache: service httpd restart

And now we need to add the .htaccess for friendly urls: nano -w .htaccess and paste in the following:

########################################################
# package:    minPHP
# filename:   .htaccess
########################################################

<Files ~ "\.(pdt)$">
   order deny,allow
   deny from all
</Files>

# Protect against Clickjacking
#Header append X-Frame-Options "SAMEORIGIN"

RewriteEngine on

# Force HTTPS
#RewriteCond %{HTTPS} !=on
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=307,NE,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php

RewriteCond %{REQUEST_URI} ^(.*)/install.php$
RewriteRule install.php %1/install/ [R=301,L]

Finally we need to allow port 80 to the public in the firewall and force Apache to start on boot:
systemctl start firewalld.service && firewall-cmd --zone=public --add-port=80/tcp --permanent && firewall-cmd --reload && systemctl enable httpd && systemctl start httpd.service and finally reboot the server.

Extras:

Composer:
cd /tmp && curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer

OpenSSL:
cd /usr/local/src && wget https://www.openssl.org/source/openssl-1.1.0b.tar.gz && tar -zxf openssl-1.1.0b.tar.gz && cd openssl-1.1.0b && ./config && make && make install && mv /usr/bin/openssl /root/ && ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl

Imagick:

/usr/bin/pecl install imagick
echo "extension=imagick.so" > /etc/php.d/imagick.ini

Set-up the Cron Job:
export VISUAL=nano; this allows us to use the nano editor when we wish to edit files on the server.
crontab -e -u root and then paste in the command from Blesta. e.g: */5 * * * * /usr/bin/php /var/www/html/index.php cron

To remove the "You have new mail in /var/spool/mail/root" after each command:
nano /etc/crontab change MAILTO=root to MAILTO="".


Was this answer helpful?

« Back