Actions

Difference between revisions of "FreeBSD Installation"

From Joomla! Documentation

(Post Joomla! Installation PHP Configuration)
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
 
[[Category:Installation]]
 
[[Category:Installation]]
 +
Tested and found to work on FreeBSD 9.0 and Joomla! 2.5.8
 
==Pre-requisites==
 
==Pre-requisites==
The following ports need to be installed before continuing
+
:*Computer running FreeBSD.
:*Server running FreeBSD
+
 
:*Ports directory downloaded from CVSUP or Portsnap.
 
:*Ports directory downloaded from CVSUP or Portsnap.
 
:*Knowledge on installing ports.
 
:*Knowledge on installing ports.
 +
:*Desktop Environment installed.
 +
:*Logged on to your DE as regular user.
 +
 +
==Notes==
 +
:*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==
 +
Open a terminal and log on as root.
  
 
==Installing Apache Server==
 
==Installing Apache Server==
 
:Execute the following commands to install your webserver.
 
:Execute the following commands to install your webserver.
 
:<code>cd /usr/ports/www/apache22<code>
 
:<code>cd /usr/ports/www/apache22<code>
:If you intalled your ports directory somewhere else make the change in the command
 
 
:<code>make config</code>
 
:<code>make config</code>
:Make any configuration changes you need to here, in most cases default will work fine
+
:Make any configuration changes you need to here. You need to enable MYSQL.
 
:<code>make install clean</code>
 
:<code>make install clean</code>
:This will install your web server
+
: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
 +
:<code>apache22_enable="YES"</code>
 +
And add the next line to /boot/loader.conf (if the file doesn't exist, create it)
 +
:<code>accf_http_load="YES"</code>
 +
 
 +
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 <code>hostname</code>.
 +
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
 +
:<code>::1              joomla-server1.free.bsd localhost</code>
 +
:<code>127.0.0.1        joomla-server1.free.bsd localhost</code>
 +
 
 +
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
 +
:<code>kldload accf_http</code>
 +
:<code>/usr/local/sbin/apachectl start</code>
  
 
==Installing PHP==
 
==Installing PHP==
:Execute the following commands to install PHP5
+
:The following commands will install PHP5 to your computer.
 
:<code>cd /usr/ports/lang/php5</code>
 
:<code>cd /usr/ports/lang/php5</code>
:If you installed your ports directory somehwre else make the change in the command
 
 
:<code>make config</code>
 
:<code>make config</code>
 
:Make any configuration changes you need here, You must enable APACHE
 
:Make any configuration changes you need here, You must enable APACHE
 
:<code>make install clean</code>
 
:<code>make install clean</code>
:This will install PHP5 onto your server
+
 
 +
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>)
 +
:<code>AddType application/x-httpd-php .php</code>
 +
:<code>AddType application/x-httpd-php-source .phps</code>
 +
 
 +
Locate a line called "DirectoryIndex index.html" and change it so that it becomes
 +
:<code>DirectoryIndex index.php index.html</code>
  
 
==Installing Required PHP Extensions==
 
==Installing Required PHP Extensions==
:Execute the following commands to install the required php extensions listed below
+
:Execute the following commands to install the required php extensions listed below.
 +
:<code>cd /usr/ports/lang/php5-extensions</code>
 +
:<code>make config</code>
 +
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
 
:*XML
:*Simple XML
+
:*ZLIB
:<code>cd /usr/ports/textproc/php5-xml</code>
+
:Then install the extensions.
:If you installed your ports directory somewhere lese make the change in the command
+
:<code>make install clean</code>
:<code>make install</code>
+
:This will install the XML module to PHP5
+
:<code>cd /usr/ports/textproc/php5-simplexml</code>
+
:If you installed your ports direcotry somewhere else make the change in the command
+
  
 
==Installing MYSQL==
 
==Installing MYSQL==
:Execute the following commabds to install your MYSQL server
+
:Execute the following commands to install your MYSQL server.
:<code>cd /usr/ports/databases/mysql55</code>
+
:<code>cd /usr/ports/databases/mysql55-server</code>
:If you installed your ports directory somewhere else make the chage in the command
+
:<code>make config</code>
+
:Make any configuration changes you need here, in most cases default will work fine
+
 
:<code>make install clean</code>
 
:<code>make install clean</code>
:This will install your MYSQL server
+
:<code>cd /usr/ports/databases/mysql55-client</code>
 
+
:<code>make install clean</code>
 +
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).
 +
:<code>make deinstall</code>
 +
:<code>make reinstall clean</code>
  
==Creating your MYSQL Database==
+
:Add the following line to /etc/rc.conf
:Execute the following commands to create your MYSQL database
+
:<code>mysql_enable="YES"</code>
:Note: In this example I am using jdatabase as the database name, juser as the username, and jpassword as the password to the user
+
:Start the server now by issuing this command
:you should change these to whatever you wish as you run the commands
+
:<code>/usr/local/etc/rc.d/mysql-server onestart</code>
:<code>mysql</code>
+
:This will open the MYSQL interface
+
:<code>CREATE DATABASE jdatabase;</code>
+
:DO NOT forget  the semicolon this is very VERY important
+
:<code>CREATE USER 'juser'@'localhost' identified by 'jpassword';</code>
+
:DO NOT forget the single quotes or semicolon they are very important
+
:<code>GRANT ALL ON jdatabase* TO juser;</code>
+
:This creates your databse, creates your user, and grants the user permission to control the database
+
:Do not forget your databse name, username, or password you will need them later
+
  
 
==Configuring PHP==
 
==Configuring PHP==
Line 66: Line 92:
 
:<code>cd /usr/local/etc/</code>
 
:<code>cd /usr/local/etc/</code>
 
:During the install we will use the development example
 
:During the install we will use the development example
:<code>cp php.ini-Development php.ini</code>
+
:<code>cp php.ini-development php.ini</code>
 
:This creates a stock php.ini file, open it in your favorite text editor and modify it to your needs
 
: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
 
:Once you are done with this you can go to your website and install joomla
  
==Post Joomla Installation PHP Configuration==
+
==Installation of Joomla!==
 +
:Copy the install file the the root directory of apache and unzip
 +
:<code>cp Joomla_*.zip /usr/local/www/apache22/data</code>
 +
:<code>cd /usr/local/www/apache22/data</code>
 +
:<code>unzip Joomla_*.zip</code>
 +
:<code>chown -R www ../data</code>
 +
 
 +
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
 +
:<code>rm Joomla_*.zip</code>
 +
:<code>chown -R root ../data</code>
 +
 
 +
==Post Joomla! Installation PHP Configuration==
 
:Now you will want to change your php.ini to the production one so run the following commands
 
:Now you will want to change your php.ini to the production one so run the following commands
 +
:<code>cd /usr/local/etc/</code>
 
:<code>mv php.ini php.ini-Dev-Configured</code>
 
:<code>mv php.ini php.ini-Dev-Configured</code>
 
:We name it php.ini-Dev-Configured you can use it again later without re-configuring it
 
:We name it php.ini-Dev-Configured you can use it again later without re-configuring it
:<code>cp php.ini-Production php.ini</code>
+
:<code>cp php.ini-production php.ini</code>
 
:Now the poduction php.ini is installed so you need to configure it with your favorite text editor and you are done!
 
: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==
 +
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
 +
:<code>/usr/local/sbin/apachectl restart</code>
 +
:restart the mysql server
 +
:<code>/usr/local/etc/rc.d/mysql-server restart</code>

Revision as of 12:27, 29 November 2012

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

Contents

Pre-requisites

  • 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

  • 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

Open a terminal and log on as root.

Installing Apache Server

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

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

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

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

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!

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

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

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