FreeBSD Installation

Other languages:
English • ‎français

FreeBSD 11.1
Apache 2.4
MySQL 5.7
PHP 7.1
Joomla! 3.8.x

Pre-requisites

  • Computer running FreeBSD.
  • Up to date ports tree via Portsnap.

Notes

  • For consistency all applications and services will be installed via ports not packages, with the exception of the Joomla! installation package
  • This is just a quickstart guide; it does not deal with security settings, performance tuning, etc.

Preparations

Open a terminal and log on as root.

Installing Apache Server

Execute the following commands to install apache24 as your webserver.
cd /usr/ports/www/apache24
make install clean

Additional dependencies may be installed. Accepting the defaults on all configuration dialogs is fine.

When the installation is done, 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.1 to your system.
cd /usr/ports/lang/php71
make install clean

Also install mod_php71
cd /usr/ports/www/mod_php71
make install clean

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 line: "DirectoryIndex index.html" and change it to
DirectoryIndex index.php index.html

Installing Required PHP Extensions

Execute the following commands to install the required php extensions listed below.
cd /usr/ports/lang/php71-extensions
make config

In the options dialog select to install the following extensions and deselect the other options that are preselected by default.

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

Then install the selected extensions. make install

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 php.ini and adjust the following values:

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

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

Installing MySQL

Execute the following commands to install MySQL 5.7 server.
cd /usr/ports/databases/mysql57-server
make install clean
Additional dependencies may be installed. Accepting the defaults on all configuration dialogs is fine.

When the installation is done, add the following line to /etc/rc.conf
mysql_enable="YES"

Start the MySQL server by issuing the following command
service mysql-server start

View the contents of /root/.mysql_secret to determine what the temporary MySQL root password is.
cat /root/.mysql_secret

Login to the mysql server as root using the temporary root password then change/set it to your desired password.
mysql -u root -p
ALTER USER root@localhost IDENTIFIED BY '<your_password>';
Use exit to close and exit the connection to MySQL server.

For the purpose of this quick start we will be using the MySQL root user to install Joomla.
Running a production web site using the MySQL root user is not recommended! Ideally create a dedicated MySQL user configured with full rights to a new database that is created prior to installing Joomla. It is possible to create this dedicated user and modify permissions on the Joomla database after Joomla is installed and running.

Installation of Joomla!

Download the Joomla installation package ending with .zip
Copy the file to apache's data directory and unzip it.
cp Joomla_*.zip /usr/local/www/apache24/data/
cd /usr/local/www/apache24/data/
unzip Joomla_*.zip

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:www ../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: root
Password: <root_password>
Database name: <anything>

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

Delete the Joomla installation package from the Apache data directory.
Research how to optimally configure and harden the security of your Joomla! FAMP (FreeBSD Apache MySQL PHP) 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/

Advertisement