Controller

Detailed Instructions for CentOS/RHEL 8.x

Detailed Controller Instructions for CentOS/RHEL 8.x

We need minimal installation of CentOS 8.x

In our example we will setup a Zonecloud controller under a Centos 8 server with FQDN (hostname) controller.nixpal.com.

Installing Remi, Epel, Apache httpd, PHP 7.3, Ioncube and Let’s Encrypt certbot

dnf update
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf install yum-utils wget curl epel-release
dnf update
dnf module reset php
dnf module install php:remi-7.3
dnf install php73-php-ioncube-loader.x86_64
dnf install php-fpm php-mysqlnd php-zip php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
dnf install httpd-tools.x86_64 httpd.x86_64
dnf install php-ioncube-loader 

Enable it, start it and test it

systemctl enable php-fpm
systemctl enable httpd
systemctl start php-fpm
systemctl start httpd
echo '<?php phpinfo();' | sudo tee /var/www/html/info.php 

At this point you should have a fully working Apache httpd with PHP and Ioncube. Test with php -v

php -v
PHP 7.3.16 (cli) (built: Mar 17 2020 10:18:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright (c) 2002-2019, by ionCube Ltd. 

Create Controller’s VirtualHost

touch /etc/httpd/conf.d/controller.conf 

Edit it with nano or vi to match your folder/hostname like this

cat controller.conf

<VirtualHost *:80>
DocumentRoot "/var/www/controller/public/"
DirectoryIndex index.php
ServerName controller.nixpal.com

<Directory "/var/www/controller/public/">
Options -Indexes
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>

</VirtualHost> 

Create the folder if it doesn’t already exists and restart httpd

mkdir /var/www/controller
mkdir /var/www/controller/public
systemctl restart httpd 

Installing certbot / Configuring Let’s Encrypt

Steps taken from certbot page.

dnf install mod_ssl openssl
dnf install epel-release
dnf upgrade
dnf install snapd
systemctl enable --now snapd.socket
ln -s /var/lib/snapd/snap /snap
reboot -h now
snap install core
snap refresh core
ln -s /var/lib/snapd/snap /snap
reboot -h now
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
certbot --apache 

Install Composer

wget https://getcomposer.org/installer -O composer-installer.php
php composer-installer.php --filename=composer --install-dir=/usr/local/bin 

MariaDB Installation

Install MariaDB server and client

dnf install mariadb mariadb-server
systemctl enable --now mariadb
mysql_secure_installation 
mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.17-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> CREATE USER ‘controller’@’localhost’ IDENTIFIED BY ‘SuperStrongPassword!’;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> CREATE DATABASE controller CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Query OK, 1 row affected (0.002 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON controller.* TO ‘controller’@’localhost’;
Query OK, 0 rows affected (0.001 sec) 

MariaDB all set. Let’s proceed to Controller now

Zonecloud Controller Package installation

cd /var/www/controller
wget https://repo.nixpal.com/controller/zcloud-controller-latest.zip
unzip zcloud-controller-latest.zip 

Zonecloud Controller Package installation

mysql -p controller < db.sql 

Edit .env file, complete DB credentials, URL and License Information Like this

nano .env 
APP_NAME=zCloud
APP_ENV=local
APP_KEY=ThisIsAStrongKeyButChangeItAnyWay
APP_DEBUG=false
APP_URL=https://controller.nixpal.com

ZCLOUD_LICENSE="ZCWeb-XXXXXXXXXXXX"

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=controller
DB_USERNAME=controller
DB_PASSWORD=SuperStrongPassword!

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MAIL_DRIVER=smtp
MAIL_HOST=mail.nixpal.com
MAIL_PORT=25
MAIL_USERNAME="zcloud@nixpal.com"
MAIL_PASSWORD="SuperStrongPassword"
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=zcloud@nixpal.com
MAIL_FROM_NAME="zCloud" 

Finishing Installation

php artisan key:generate
Application key set successfully
composer install --no-dev
chown -R apache:apache /var/www/controller/ 

E-mail Cron Job

Insert
* * * * * cd /var/www/controller/ && php artisan schedule:run 
In
crontab -e 

Configure SELinux

setsebool -P httpd_read_user_content 1
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db on
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/controller(/.*)?"
restorecon -RFv /var/www/controller  

Now go to https://<server's hostname>/. In our example it’s https://controller.nixpal.com

Default username is admin@example.com and password admin_!@

You can start creating a Cluster. For example “Nixpal” and then Adding servers to this Cluster. Have fun!

Questions? Issues?

Scroll to Top