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 13.1
Apache 2.4
MySQL 8.0
PHP 8.1
Joomla! 3.9.x
NOTE: Intended as a quick-start installation guide, this article does not address optimal security settings, performance tuning, etc.
Preparations[edit]
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=8.1 python=3.9 python3=3.9 perl5=5.32 mysql=8.0
Installing Apache Web Server[edit]
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[edit]
The following commands will install PHP 8.0 to your system.
pkg install php81
or
make -C /usr/ports/lang/php81 install clean -DBATCH
Also install Apache PHP module mod_php81.
pkg install mod_php81
or
make -C /usr/ports/lang/php81 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[edit]
Joomla requires the following PHP extensions:
- CURL
- FILTER
- MYSQLI
- SESSION
- SIMPLEXML
- XML
- XMLREADER
- ZIP
- ZLIB
To install the required extensions via pkg:
pkg install php81-curl php81-filter php81-mysqli php81-session php81-simplexml php81-xml php81-xmlreader php81-zip php81-zlib
To simplify installation from sources, the php81-extensions meta-port can be used:
make -C /usr/ports/lang/php81-extensions/ config
select the required extensions and deselect all others then:
make -C /usr/ports/lang/php81-extensions/ install clean -DBATCH
Optimally to configure the php81-mysqli extension to use MySQL 8.0 server's default authentication mechanism <caching_sha2_password> instead of the php81-mysqli package default <mysql_native_password> authentication:
make -C /usr/ports/databases/php81-mysqli/ config
deselect 'Use MySQL Native Driver'
NOTE: When configured this way, the php81-mysqli port will depend on mysql80-client, which will also be installed. Significant compilation time can optionally be saved by first installing mysql80-client via pkg prior to compiling php81-mysqli:pkg install mysql80-client
Compile and reinstall php81-mysqli:
make -C /usr/ports/databases/php81-mysqli/ reinstall clean -DBATCH
Configuring PHP[edit]
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:
output_buffering = Off
post_max_size = 20M
upload_tmp_dir = /usr/local/www/apache24/data/tmp/
upload_max_filesize = 20M
After installing and configuring PHP restart the Apache service.
service apache24 restart
Installing MySQL Database Server[edit]
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 php81-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[edit]
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[edit]
Research how to optimally configure and harden the security of your Joomla! FAMP web server!
Troubleshooting[edit]
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/