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.2
Apache 2.4
MySQL 8.0
PHP 7.4
Joomla! 3.9.x
NOTE: Intended as a quick-start installation guide, this article does not address optimal security settings, performance tuning, etc.
Contents
Preparations
Open a terminal and log on to the FreeBSD system as root.
If you will be installing the required ports using pkg
then skip to the next section to begin the installation.
If you intend to compile the ports from sources then 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.4 python=3.9 python3=3.9 perl5=5.32 mysql=8.0
Installing Apache Web Server
Execute the following command to install apache24 as your webserver.
pkg install apache24
or
make -C /usr/ports/www/apache24/ install clean -DBATCH
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.4 to your system.
pkg install php74
or
make -C /usr/ports/lang/php74 install clean -DBATCH
Also install Apache PHP module mod_php74.
pkg install mod_php74
or
make -C /usr/ports/lang/php74 install clean -DBATCH
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:
- CURL
- JSON
- MYSQLI
- SESSION
- SIMPLEXML
- XML
- XMLREADER
- ZLIB
To install the required extensions via pkg:
pkg install php74-curl php74-json php74-mysqli php74-session php74-simplexml php74-xml php74-xmlreader php74-zlib
To simplify installation from sources, the php74-extensions meta-port can be used:
make -C /usr/ports/lang/php74-extensions/ config
select the required extensions and deselect all others then:
make -C /usr/ports/lang/php74-extensions/ install clean -DBATCH
Optionally to configure the php74-mysqli extension to connect to the MySQL database using <caching_sha2_password> authentication instead of the default <mysql_native_password> authentication:
make -C /usr/ports/databases/php74-mysqli/ config
deselect 'Use MySQL Native Driver'
make -C /usr/ports/databases/php74-mysqli/ install clean -DBATCH
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:
- upload_max_filesize: 20M
- post_max_size: 20M
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
or
make -C /usr/ports/databases/mysql80-server/ install clean -DBATCH
Add the following line to /etc/rc.conf
:
mysql_enable="YES"
NOTE: MySQL 8 server initially defaults to creating users using <caching_sha2_password> authentication. Joomla will connect to it's database using a user with a <caching_sha2_password> if the php74-mysqli extension is configured and compiled from source. More details provided in previous section: Installing Required PHP Extensions.
If you prefer to use <mysql_native_password> authentication,
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'@'%' 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 'joomla'@'%' identified by 'password';
Grant the user all privileges to the Joomla database.
root@localhost [(none)]>grant all privileges on joomla.* to 'joomla'@'%';
root@localhost [(none)]>flush privileges;
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/