PyroCMS is an open source CMS written in PHP. The PyroCMS source code is hosted on GitHub. In this guide, we’ll walk through the entire PyroCMS installation process on a CentOS 7 AKLWEB HOST instance.
Before you can install PyroCMS on a server, there are a few requirements that need to be met.
1GB of RAM
LEMP/LAMP stack
PHP >= 7.0
PDO PHP Extension
cURL PHP Extension
SQLite PHP Extension
OpenSSL PHP Extension
Mbstring PHP Extension
Fileinfo PHP Extension
Tokenizer PHP Extension
GD Library (>=2.0) OR Imagick PHP extension (>=6.5.7)
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 - johndoeNOTE: 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 -yInstall required and useful packages.
sudo yum install -y wget vim unzip bash-completionDisable SELinux.
sudo setenforce 0CentOS does not provide the latest PHP version in its default software repositories. We’ll need to add a Webtatic YUM repo.
Download and install PHP 7.2 and the required PHP extensions.
sudo yum install -y php72w php72w-cli php72w-fpm php72w-mysql php72w-curl php72w-sqlite3 php72w-mbstring php72w-gd php72w-domCheck the PHP version.
php --version
PHP 7.2.2 (cli) (built: Feb 4 2018 10:14:07) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend TechnologiesDownload and 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-clientCheck the MariaDB version.
mysql --version
# mysql Ver 15.1 Distrib 10.2.13-MariaDB, for Linux (x86_64) using readline 5.1Start and enable MariaDB.
sudo systemctl enable mariadb.service
sudo systemctl start mariadb.serviceRun the mysql_secure_installation script to improve the security of your MariaDB installation.
sudo mysql_secure_installationLog 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;
grant all on dbname.* to 'username' identified by 'password';Exit MySQL.
exitInstall NGINX.
sudo vim /etc/yum.repos.d/nginx_mainline.repo
# Copy/paste this to the /etc/yum.repos.d/nginx_mainline.repo file
[nginx]
name=nginx
repo baseurl=https://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=1
enabled=1
wget https://nginx.org/keys/nginx_signing.key
sudo rpm –import nginx_signing.key
rm nginx_signing.key
sudo yum install -y nginxCheck the NGINX version.
nginx -vStart and enable NGINX.
sudo systemctl enable nginx.service
sudo systemctl start nginx.serviceConfigure NGINX as a FastCGI proxy. Run sudo vim /etc/nginx/conf.d/pyro.conf and populate it with the following text.
server {
listen 80;
server_name example.com; # Check this
root /var/www/pyro/public; # Check this
index index.php index.html;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000; # Check this
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}NOTE: Make sure to point the web root to Pyro’s public directory.
Test the NGINX configuration.
sudo nginx -tReload NGINX.
sudo systemctl reload nginx.serviceDownload the Composer dependencies.
sudo yum install -y curl git unzipDownload and install Composer, the dependency manager for PHP.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composerCheck the Composer version.
composer --version
# Composer version 1.6.3 2018-01-31 16:28:17Create a document root directory.
sudo mkdir -p /var/www/pyroChange the ownership of the /var/www/pyro directory to johndoe.
sudo chown -R johndoe:johndoe /var/www/pyroDownload the latest stable release of PyroCMS from the command line.
cd /var/www/pyro
composer create-project pyrocms/pyrocmsNOTE: You may run out of memory when installing Pyro via Composer. It may be wise to stop Nginx, PHP-FPM, and MySQL servers with sudo systemctl stop nginx.service php-fpm.service mysql.service to save on memory usage and start them again after this step.
Change the ownership of the /var/www/pyro directory to nginx.
sudo chown -R nginx:nginx /var/www/pyroRun sudo vim /etc/php-fpm.d/www.conf and set the user and group to nginx.
sudo vim /etc/php-fpm.d/www.conf
# user = nginx
# group = nginxRestart the php-fpm.service.
sudo systemctl restart php-fpm.serviceUsing your preferred web browser, open your site and follow the PyroCMS installer. After following the installer, you will have PyroCMS up and running. To access the PyroCMS admin area, append /admin to your site URL.