How to Install Microweber on CentOS 7

Published on: Fri, Aug 3, 2018 at 11:17 am EST
This article is a port of "Installing Microweber on Ubuntu 16.04" for CentOS 7.

Microweber is an open source drag and drop CMS and online shop. Microweber source code is hosted on GitHub. This guide will show you how to install Microweber on a fresh CentOS 7 Vultr instance.

Requirements

Server Requirements:

  • PHP version 5.6 or higher
  • PHP extensions: gd, mcrypt, lib-xml must be enabled (with DOM support)
  • Nginx
  • MariaDB
  • Composer

Before you begin

Check the CentOS version.

cat /etc/centos-release
# CentOS Linux release 7.4.1708 (Core)

Create a new non-root user account with sudo access and switch to it.

useradd -c "John Doe" johndoe && passwd johndoe
usermod -aG wheel johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'

Ensure that your system is up to date.

sudo yum update -y

Install some necessary packages.

sudo yum install -y curl git wget vim unzip bash-completion mcrypt

Disable SELinux.

sudo setenforce 0

Enable the EPEL repository.

sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install PHP

Setup the Webtatic YUM repo.

sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Install PHP and the required PHP extensions.

sudo yum install -y php72w php72w-cli php72w-fpm php72w-common php72w-gd php72w-mbstring php72w-xml php72w-mysql php72w-pgsql php72w-sqlite3 php72w-zip php72w-soap php72w-xmlrpc php72w-json

Check the version.

php --version

Start and enable php-fpm.

sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service

Install MariaDB

Install MariaDB.

sudo vim /etc/yum.repos.d/MariaDB.repo

# Copy/paste this to the /etc/yum.repos.d/MariaDB.repo file

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

sudo yum install -y MariaDB-server MariaDB-client

Check the version.

mysql --version

Start and enable MariaDB.

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Run the mysql_secure_installation script to improve the security of your MariaDB installation.

sudo mysql_secure_installation

Log in to MariaDB as the root user.

mysql -u root -p
# Enter password:

Create a new MariaDB database and user, and remember the credentials.

CREATE DATABASE dbname;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON `dbname`.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Install Nginx

Install Nginx.

sudo yum install -y nginx

Check the version.

sudo nginx -v

Start and enable Nginx.

sudo systemctl start nginx.service
sudo systemctl enable nginx.service

Configure Nginx. Run sudo vim /etc/nginx/conf.d/microweber.conf and populate the file with the following text:

server {

  listen 80;
  server_name example.com;

  root /var/www/microweber;
  index index.php;

  client_max_body_size 100M;

  location / {
    try_files $uri $uri/ /index.php$is_args$args;
  }

  location ~ \.php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
}

Test the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install Microweber

Create a document root directory.

sudo mkdir -p /var/www/microweber

Change ownership of the /var/www/microweber directory to johndoe.

sudo chown -R johndoe:johndoe /var/www/microweber

Download the latest release of Microweber CMS and unzip it.

cd /var/www/microweber
wget https://download.microweberapi.com/ready/core/microweber-latest.zip
unzip microweber-latest.zip
rm microweber-latest.zip

Change ownership of the /var/www/microweber directory to nginx.

sudo chown -R nginx:nginx /var/www/microweber

Run sudo vim /etc/php-fpm.d/www.conf and set the user and group to nginx. Initially, it will be set to apache.

sudo vim /etc/php-fpm.d/www.conf
# user = nginx
# group = nginx

Restart php-fpm.

sudo systemctl restart php-fpm.service

Open your domain name (http://example.com/) in your web browser and follow the instructions. After the installation, your admin panel URL will be at http://example.com/admin.