FreeBSD Installation

From Joomla! Documentation

Revision as of 22:20, 20 March 2013 by Tom Hutchison (talk | contribs) (→‎Installing Apache Server: fixing code tag)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Tested and found to work on FreeBSD 9.0 and Joomla! 2.5.8

Pre-requisites[edit]

  • Computer running FreeBSD.
  • Ports directory downloaded from CVSUP or Portsnap.
  • Knowledge on installing ports.
  • Desktop Environment installed.
  • Logged on to your DE as regular user.

Notes[edit]

  • This is just a quickstart guide; it does not deal with security settings, performance tuning, etc and therefore should not be used to set up a production server.
  • This will be a local install.
  • You MUST install via the ports because several packages lack vital settings.

Preperations[edit]

Open a terminal and log on as root.

Installing Apache Server[edit]

Execute the following commands to install your webserver.
cd /usr/ports/www/apache22
make config
Make any configuration changes you need to here. You need to enable MYSQL.
make install clean
Other options dialogs may pop up, make changes as you need. In most cases the defaults are just fine.

When done, add the following line to /etc/rc.conf

apache22_enable="YES"

And add the next line to /boot/loader.conf (if the file doesn't exist, create it)

accf_http_load="YES"

Next you need to modify your hosts file to reflect the hostname for your box. To find out the current hostname you can either read /etc/rc.conf and look for a line called hostname, or you can issue the command hostname. NOTE: the hostname MUST be a fully qualified name, e.g.

joomla-server1 is NOT OK <----- change it
joomla-server1.free.bsd is OK <---- leave it

Open /etc/hosts with the editor and change the lines starting with ::1 and 127.0.0.1 so that they become

::1 joomla-server1.free.bsd localhost
127.0.0.1 joomla-server1.free.bsd localhost

If you had to modify the hostname in /etc/rc.conf, you MUST reboot now. Otherwise you may start the apache server by issuing the following commands

kldload accf_http
/usr/local/sbin/apachectl start

Installing PHP[edit]

The following commands will install PHP5 to your computer.
cd /usr/ports/lang/php5
make config
Make any configuration changes you need here, You must enable APACHE
make install clean

When done, open /usr/local/etc/apache22/httpd.conf in a text editor and locate a line called <IfModule mime_module>. Then add the following lines (anywhere you like, yet above the first </IfModule>)

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Locate a line called "DirectoryIndex index.html" and change it so that it becomes

DirectoryIndex index.php index.html

Installing Required PHP Extensions[edit]

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

In the options dialog make sure at least the following options are selected (as for the other options that are preselected, either leave them or turn them off, as desired).

  • JSON
  • MYSQL
  • SESSION
  • SIMPLEXML
  • XML
  • ZLIB
Then install the extensions.
make install clean

Installing MYSQL[edit]

Execute the following commands to install your MYSQL server.
cd /usr/ports/databases/mysql55-server
make install clean
cd /usr/ports/databases/mysql55-client
make install clean

The installation will fail if MYSQL is already installed (perhaps as a dependency). In this case uninstall and then reinstall MYSQL (both server and client).

make deinstall
make reinstall clean
Add the following line to /etc/rc.conf
mysql_enable="YES"
Start the server now by issuing this command
/usr/local/etc/rc.d/mysql-server onestart

Configuring PHP[edit]

By default php does not create your php.ini for you, but it does give you examples
We will use these examples to create your php.ini
Execute the following commands to create your php.ini
cd /usr/local/etc/
During the install we will use the development example
cp php.ini-development php.ini
This creates a stock php.ini file, open it in your favorite text editor and modify it to your needs
Once you are done with this you can go to your website and install joomla

Installation of Joomla![edit]

Copy the install file the the root directory of apache and unzip
cp Joomla_*.zip /usr/local/www/apache22/data
cd /usr/local/www/apache22/data
unzip Joomla_*.zip
chown -R www ../data

The final step changes ownership of the data directory and everything in it to 'www' (i.e. apache) thus allowing the Joomla! configuration script to write into this directory.

At this point you should be able to configure Joomla! by pointing your browser of choice to http://localhost

Read the Joomla! installation screens carefully!! (And refer to the following)

At the step Database, enter this

Username = root
Password = <leave empty>
Database name = <can be anything you like, but not empty>

As for the other settings, the defaults are acceptable.

At step Configuration don't forget to hit the button 'Install Sample Data'

When you have removed the installation folder close the browser.

Finally you should delete the zip-file and take back ownership of the data directory
rm Joomla_*.zip
chown -R root ../data

Post Joomla! Installation PHP Configuration[edit]

Now you will want to change your php.ini to the production one so run the following commands
cd /usr/local/etc/
mv php.ini php.ini-Dev-Configured
We name it php.ini-Dev-Configured you can use it again later without re-configuring it
cp php.ini-production php.ini
Now the poduction php.ini is installed so you need to configure it with your favorite text editor and you are done!

Again open your browser and point it to http://localhost. You should now see the default Joomla! development site.

Troubleshooting[edit]

Most of the time problems arise from stale cookies and cached content. So delete your cookies and clean your cache. Otherwise,

restart the apache server
/usr/local/sbin/apachectl restart
restart the mysql server
/usr/local/etc/rc.d/mysql-server restart