FreeBSD Installation

From Joomla! Documentation

This article is a guide detailing how to install Joomla! Content Management System on a FreeBSD based system.
This guide details installation of the following application versions of the FAMP stack:

FreeBSD 12.0
Apache 2.4
MySQL 8.0
PHP 7.3
Joomla! 3.9.x

NOTE: Intended as a quick-start installation guide, this article does not address optimal security settings, performance tuning, etc.

Preparations

Open a terminal and log on to the FreeBSD system as root.

Ensure the file /etc/make.conf exists and contains DEFAULT_VERSIONS that reflect the versions you intend to install on the system.

DEFAULT_VERSIONS+= php=7.3 python=3.7 python3=3.7 perl5=5.28 mysql=8.0


Installing Apache Web Server

Execute the following command to install apache24 as your webserver.
pkg install apache24

Add the following lines to /etc/rc.conf:

apache24_enable="YES"
apache24_http_accept_enable="YES"

Start the apache server.
service apache24 start

Installing PHP

The following commands will install PHP 7.3 to your system.
pkg install php73

Also install Apache PHP module mod_php73.
pkg install mod_php73

As instructed by the post-install message, add the following lines to /usr/local/etc/apache24/httpd.conf:

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

Also modify the following line:

DirectoryIndex index.html

changing it to:

DirectoryIndex index.php index.html


Installing Required PHP Extensions

Joomla requires the following PHP extensions:

  • JSON
  • MYSQLI
  • SESSION
  • SIMPLEXML
  • XML
  • XMLREADER
  • ZLIB

To install the required extensions:
pkg install php73-json php73-mysqli php73-session php73-simplexml php73-xml php73-xmlreader php73-zlib

Configuring PHP

Create a new php.ini file by copying one of the sample files.
cd /usr/local/etc/
cp php.ini-production php.ini

Open and edit /usr/local/etc/php.ini and adjust the following values:

  • memory_limit:  Minimum: 64M   Recommended: 128M or more
  • upload_max_filesize:  Minimum: 20M
  • post_max_size:  Minimum: 20M
  • max_execution_time:  At Least 120   Recommended: 300 or higher


After installing and configuring PHP restart the Apache service.
service apache24 restart

Installing MySQL Database Server

Execute the following commands to install MySQL 8.0 server.
pkg install mysql80-server

Add the following line to /etc/rc.conf:

mysql_enable="YES"

Edit /usr/local/etc/mysql/my.cnf and add the following line to the [mysqld] section:

default_authentication_plugin   = mysql_native_password

Start the MySQL server.
service mysql-server start

Upon initial installation, the MySQL 8.0 server's root user has no password.

Login to the mysql server on the command line as root and set your desired password.
mysql -u root
root@localhost [(none)]>ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';

Create a database for the Joomla web site with your preferred database name.
root@localhost [(none)]>create database joomla;

Create a dedicated MySQL user with your preferred username and password.
root@localhost [(none)]>create user 'joomlauser'@'localhost' identified by 'password';

Grant the user all privileges to the Joomla database.
root@localhost [(none)]>grant all privileges on joomla.* to 'joomlauser'@'localhost';

exit to close the connection to MySQL server.

Installing Joomla! CMS

Download the Joomla installation package ending with .zip
Unzip the file to apache's data directory.
unzip Joomla_*.zip -d /usr/local/www/apache24/data/

Change ownership of the data directory and everything in it to 'www' thus allowing the Joomla! configuration script to write into this directory.
chown -R www /usr/local/www/apache24/data/

At this point you should be able to begin installing and configuring Joomla!

Open and direct your web browser to one of the following...
If browsing directly on the server: http://localhost
If browsing from a remote system: http://<ip_address> or http://<fully.qualified.domain.name> (if configured)

You will see the Joomla Web Installer page.


In step 1 Configuration:
fill in the fields as required.


In step 2 Database:
Username: <joomlauser>
Password: <joomlauser password>
Database name: <joomladb>


Leave the other settings unchanged:
Database Type: MySQLi
Hostname: localhost
Table Prefix: unchanged


The final step of the web installer will be to delete the installation folder.
Once that is done you can browse to your newly installed Joomla! web site!

Post Installation

Research how to optimally configure and harden the security of your Joomla! FAMP web server!

Troubleshooting

Configuration changes made to either apache's httpd.conf or PHP's php.ini will require that the apache service be restarted for the changes to take effect.
service apache24 restart


Apache's error log is located at /var/log/httpd-error.log
MySQL log files are located in /var/db/mysql/ and are named <hostname>.err and <hostname>-slow.log by default.
MySQL databases are also located in /var/db/mysql/