Knowledgebase

How to Install PyroCMS on FreeBSD 13 Print

  • 0

Introduction

PyroCMS is an open-source Content Management System (CMS) based on the PHP framework, Laravel. It's used to build and manage websites. It comes with a fully responsive user interface, usable in all types of devices. This article explains how to install PyroCMS on FreeBSD 13.

Prerequisites

Perform the following steps first:

Step 1. Install Required Packages

Update the system package list.

$ pkg update

Install required packages.

$ pkg install -y sudo nano unzip wget bash

Install PHP 7.4, Apache, MySQL, and more modules.

 $ sudo pkg install -y apache24 mysql80-server mod_php74 php74 php74-session php74-curl php74-xml php74-zip php74-mbstring php74-ctype php74-imap php74-simplexml php74-tokenizer php74-xmlreader php74-xmlwriter php74-pear php74-fileinfo php74-json php74-phar php74-exif php74-iconv php74-mysqli php74-pdo_mysql php74-dom php74-filter php74-intl php74-openssl php74-intl php74-opcache php74-gd

Enable PHP-FPM service.

$ sudo sysrc php_fpm_enable=yes

Start PHP-FPM service.

$ sudo service php-fpm start

Copy the sample PHP configuration file.

$ sudo cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

Step 2. Create PyroCMS Database

Enable MySQL service to start on system boot.

$ sudo sysrc mysql_enable="yes"

Start MySQL service.

$ sudo service mysql-server start

Log in to MySQL shell. Then, press Enter to continue at the password prompt.

$ sudo mysql -u root -p

Secure the MySQL root user by changing the password. Change the value of StrongPassword with your own secure password.

ALTER USER 'root'@'localhost' IDENTIFIED BY 'StrongPassword';

Create a database named pyro.

CREATE DATABASE pyro;

Create a database user pyrouser with a password MySecurePassword. Change the value of MySecurePassword to your own secure password.

CREATE USER 'pyrouser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'MySecurePassword';

Grant the database user full access to the database.

GRANT ALL ON pyro.* TO 'pyrouser'@'localhost' WITH GRANT OPTION;

Save all the changes to take effect.

FLUSH PRIVILEGES;

Exit MySQL shell.

exit;

Step 3. Install Composer

Install required dependencies.

$ sudo pkg install -y curl git

Download Composer installer.

$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Verify the installer.

$ php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Run the installer.

$ php composer-setup.php

Remove the installer.

$ php -r "unlink('composer-setup.php');"

Make Composer global by moving composer.phar to the system path.

$ sudo mv composer.phar /usr/local/bin/composer

Verify the Composer version.

$ composer -V

Step 4. Install PyroCMS

Change to document root.

$ cd /usr/local/www/apache24/data/

Set up the project using composer.

$ sudo composer create-project pyrocms/pyrocms

Set the ownership of the directory to the web-root user and group.

$ sudo chown -R www:www /usr/local/www/apache24/data/pyrocms/

Change the access permissions.

$ sudo chmod -R 755 /usr/local/www/apache24/data/pyrocms/

Step 5. Configure Apache2

Enable Apache service to start on system boot.

$ sudo sysrc apache24_enable=yes

Start Apache service.

$ sudo service apache24 start

Create a configuration file to allow Apache to work with PHP.

$ sudo nano /usr/local/etc/apache24/modules.d/001_mod-php.conf

Add the following lines of code to the file. Then, save and close the file.

<IfModule dir_module>
    DirectoryIndex index.php index.html
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
</IfModule>

Create Apache configuration file pyrocms.conf for PyroCMS.

$ sudo nano /usr/local/etc/apache24/Includes/pyrocms.conf

Add the below code to the file. Save and close the file.

<VirtualHost *:80>

    ServerAdmin admin@example.com
    DocumentRoot /usr/local/www/apache24/data/pyrocms/public
    ServerName example.com

    <Directory /usr/local/www/apache24/data/pyrocms/public/>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

Test the configuration.

$ sudo apachectl configtest

Enable mod_rewrite by editing the apache configuration file.

$ sudo nano /usr/local/etc/apache24/httpd.conf

Comment out the following line. Then, save and close the file:

LoadModule rewrite_module libexec/apache24/mod_rewrite.so

Restart Apache service.

$ sudo service apache24 restart

Step 6. Access PyroCMS

To access the PyroCMS Web Interface, go to your browser and visit http://Server_IP/. For example:

http://192.0.2.11/

Conclusion

You have installed PyroCMS on your FreeBSD 13.0 server. You can now check the official documentation to learn more about using PyroCMS.

Introduction PyroCMS is an open-source Content Management System (CMS) based on the PHP framework, Laravel. It's used to build and manage websites. It comes with a fully responsive user interface, usable in all types of devices. This article explains how to install PyroCMS on FreeBSD 13. Prerequisites Perform the following steps first: Deploy a Rcs FreeBSD 13.0 Server. SSH into the server you deployed. Create a non-root user with sudo access. Step 1. Install Required Packages Update the system package list. $ pkg update Install required packages. $ pkg install -y sudo nano unzip wget bash Install PHP 7.4, Apache, MySQL, and more modules. $ sudo pkg install -y apache24 mysql80-server mod_php74 php74 php74-session php74-curl php74-xml php74-zip php74-mbstring php74-ctype php74-imap php74-simplexml php74-tokenizer php74-xmlreader php74-xmlwriter php74-pear php74-fileinfo php74-json php74-phar php74-exif php74-iconv php74-mysqli php74-pdo_mysql php74-dom php74-filter php74-intl php74-openssl php74-intl php74-opcache php74-gd Enable PHP-FPM service. $ sudo sysrc php_fpm_enable=yes Start PHP-FPM service. $ sudo service php-fpm start Copy the sample PHP configuration file. $ sudo cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini Step 2. Create PyroCMS Database Enable MySQL service to start on system boot. $ sudo sysrc mysql_enable="yes" Start MySQL service. $ sudo service mysql-server start Log in to MySQL shell. Then, press ENTER to continue at the password prompt. $ sudo mysql -u root -p Secure the MySQL root user by changing the password. Change the value of StrongPassword with your own secure password. ALTER USER 'root'@'localhost' IDENTIFIED BY 'StrongPassword'; Create a database named pyro. CREATE DATABASE pyro; Create a database user pyrouser with a password MySecurePassword. Change the value of MySecurePassword to your own secure password. CREATE USER 'pyrouser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'MySecurePassword'; Grant the database user full access to the database. GRANT ALL ON pyro.* TO 'pyrouser'@'localhost' WITH GRANT OPTION; Save all the changes to take effect. FLUSH PRIVILEGES; Exit MySQL shell. exit; Step 3. Install Composer Install required dependencies. $ sudo pkg install -y curl git Download Composer installer. $ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" Verify the installer. $ php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" Run the installer. $ php composer-setup.php Remove the installer. $ php -r "unlink('composer-setup.php');" Make Composer global by moving composer.phar to the system path. $ sudo mv composer.phar /usr/local/bin/composer Verify the Composer version. $ composer -V Step 4. Install PyroCMS Change to document root. $ cd /usr/local/www/apache24/data/ Set up the project using composer. $ sudo composer create-project pyrocms/pyrocms Set the ownership of the directory to the web-root user and group. $ sudo chown -R www:www /usr/local/www/apache24/data/pyrocms/ Change the access permissions. $ sudo chmod -R 755 /usr/local/www/apache24/data/pyrocms/ Step 5. Configure Apache2 Enable Apache service to start on system boot. $ sudo sysrc apache24_enable=yes Start Apache service. $ sudo service apache24 start Create a configuration file to allow Apache to work with PHP. $ sudo nano /usr/local/etc/apache24/modules.d/001_mod-php.conf Add the following lines of code to the file. Then, save and close the file. DirectoryIndex index.php index.html SetHandler application/x-httpd-php SetHandler application/x-httpd-php-source Create Apache configuration file pyrocms.conf for PyroCMS. $ sudo nano /usr/local/etc/apache24/Includes/pyrocms.conf Add the below code to the file. Save and close the file. ServerAdmin admin@example.com DocumentRoot /usr/local/www/apache24/data/pyrocms/public ServerName example.com Options -Indexes +FollowSymLinks AllowOverride All Require all granted Test the configuration. $ sudo apachectl configtest Enable mod_rewrite by editing the apache configuration file. $ sudo nano /usr/local/etc/apache24/httpd.conf Comment out the following line. Then, save and close the file: LoadModule rewrite_module libexec/apache24/mod_rewrite.so Restart Apache service. $ sudo service apache24 restart Step 6. Access PyroCMS To access the PyroCMS Web Interface, go to your browser and visit http://Server_IP/. For example: http://192.0.2.11/ Conclusion You have installed PyroCMS on your FreeBSD 13.0 server. You can now check the official documentation to learn more about using PyroCMS.

Was this answer helpful?
Back

Powered by WHMCompleteSolution