This section covers the steps to setting up a webserver using Joomla! with a backend of apache/php/mysql. This webserver will be able to effectively serve LAN clients and give you a development environment. Using a service such as no-ip, you can also service other clients outside of the LAN. If you do so, you will also need to be sure to forward port 80 from your router to the machine which will be hosting your webserver.
MySQL
MySQL will provide the database backend for our server. This is essential as Joomla! stores nearly all of its relevant information in a MySQL database. Nevertheless, once installed MySQL can be used for many purposes other than just the Joomla! database.
cd /usr/ports/databases/mysql50-server
make install clean
In order to start the server at boot time at the following line to /etc/rc.conf
mysql_enable="YES"
Henceforth MySQL will start at boot time, but in order to start it now we do so manually
/usr/local/etc/rc.d/mysql-server start
I'm not going to get into usage, as that is a very long topic I'm not suited to teach. However let's set up a root user.
mysqladmin -u root password your_password_here
Now you have created your user with the password you specified. To bring up mysql in the console, issue:
mysql -u root -p
Enter your password at the prompt, and you are gold. Right now let us setup the Joomla! database. At the mysql prompt enter
CREATE DATABASE joomla_main;
ApacheApache is a very popular and very nice webserver. You will probably be using a different version of Apache as well.
cd /usr/ports/www/apache22
make install clean
We want to start Apache at boot time, so in /etc/rc.conf:
apache22_enable="YES"
To get things started this time around we'll have to issue
/usr/local/etc/rc.d/apache22 start
Just a minor amount of configuring here. We'll be editing /usr/local/etc/apache22/httpd.conf. The first line corresponds to setting up the server on the localhost.
ServerName 127.0.0.1
If you are using noip this is the place where you would enter your hostname, such as xaenn.no-ip.info.
We also need to do some configuration for using php5 with Apache. Make sure you have the following lines in your configuration (you may need to modify the appropriate existing lines)
LoadModule php5_module libexec/apache/libphp5.so
AddHandler application/x-httpd-php .php
<IfModule dir_module>
DirectoryIndex index.php index.html index.htm
</IfModule>
By default the server's files are stored at /usr/local/www/apache22/data/. If you would like to change this to another location, modify the line
DocumentRoot "/usr/local/www/"
in the configuration to the appropriate directory. If you enter localhost into your browser window it will bring up the index.html or index.php file stored at /usr/local/www/.
PHPPHP provides us with the scripting support necessary for Joomla!. Before installing we need to make sure that we are building the Apache module for PHP - otherwise this installation will not be particularly useful.
cd /usr/ports/lang/php5
make config
You will see a nice blue screen pop up. Make sure that the box to "Build Apache module" is checked. After doing so you can save the options and continue to install
make install clean
In order to use PHP we need to setup the configuration file. There are two options - one for production and the other for development. I was unable to get Joomla! working using the production configuration, so I opted for the development configuration.
cd /usr/local/etc
cp php.ini-dist php.ini
We need to make one more installation in order to use PHP with MySQL.
cd /usr/ports/lang/php5-extensions
Once again we need to configure our options
make config
Make sure that you have mysql, xml, xmlreader, and xmlwriter enabled.
make install clean
Joomla!The first thing you need to do is download the zip file for Joomla. Having done that, as root:
cd /usr/local/www/apache22/data
mkdir joomla
chown www:www joomla
mv Joomla_1.5.7-Stable-Full_Package.zip joomla
unzip Joomla_1.5.7-Stable-Full_Package.zip
With the first two of these commands we create a new directory inside of our webserver called joomla. This is where our Joomla! installation will reside. Next we change the ownership of this directory so that Apache will have write access to the files (otherwise Joomla! will not install properly). Finally we unzip the Joomla! installation package (you will need to change the version number as appropriate to the file you have downloaded).
The next step is to load localhost/joomla as the address in your web browser, and go through the Joomla! installation. When you are setting up the mysql database the hostname is localhost, and the database that you will use is the one we created earlier, namely joomla_main. The mysql username is root and the password is the password you setup earlier.