(as documented in our ICS 200 project)
Pre-installation:
Operating System: FreeBSD 7.1 download @ http://www.freebsd.org/where.html
Apache: 2.2.8 Installed from Ports Collection through portsnap fetch extract
MySQL Server: 5.0.51a Installed from Ports Collection through portsnap fetch extract
PHP & Extensions: 5.2.5 Installed from Ports Collection through portsnap fetch extract
Be sure to have internet connection and assuming you properly configured FreeBSD network server name and domain.
Installation:
MySQL Installation:
• Go to the mysql50-server port directory by typing the command:
cd /usr/ports/databases/mysql50-server
• Build the port by typing:
make BUILD_OPTIMIZED=yes BUILD_STATIC=yes
• Install by typing:
make install clean
• Open /etc/rc.conf with your favorite text editor and add the line shown below. This will ensure mysql is enabled and starts on boot. This step, I have used nano editor by typing cd /etc nano rc.conf
mysql_enable=”YES”
• Start mysql manually to avoid having to reboot now by typing:
/usr/local/etc/rc.d/mysql-server start
• Set a password for the MySQL root user by executing the command, subtituting your own password in place of new-password:
/usr/local/bin/mysqladmin -uroot password ‘new-password’
Run MySQL by typing /usr/local/etc/rc.d/mysql-server start
And you’re done! MySQL is installed
Apache Installation
• Go to the apache22 port directory by typing the command:
cd /usr/ports/www/apache22
• Build and install the port by typing:
Note: You may want to disable the two DAV options if you don’t need them when prompted
make install clean
• Open /etc/rc.conf with your favorite text editor and add the line shown below. This will ensure apache is enabled and starts on boot.
apache22_enable=”YES”
Run Apache by typing /usr/local/etc/rc.d/apache22 start
Note: If error occurs saying that ‘could not reliably determine the server’s fully qualified domain’ try this:
• Type cd /etc/
• Then nano (if editor is available) httpd.conf
• Find the Servername and change www.example.com to your IP address.
• Control X and type Y and then return. Run Apache again
Installing PHP
• Go to the php5 port directory by typing the command:
cd /usr/ports/lang/php5
• Build and install the port by typing:
make install clean
• Make sure the APACHE (Build Apache module) option is ticked when configuring the build, leaving all other options as default, before selecting OK.
• Go to the php5-extentions meta port directory by typing the command:
cd /usr/ports/lang/php5-extentions
• Build and install the port by typing: (Just accept the defaults here, phpMyAdmin will install any other extensions required itself)
make install clean
• Install the php.ini file:
cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
• Edit your Apache configuration file (/usr/local/etc/apache22/httpd.conf) and add the following lines to the end of the file:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
• Note: You can add additional extenions other than .php (eg .phtml) seperated by spaces.
Note: The second line is optional, it will show colour highlighted PHP source for .phps files.
• You should also search for the line that reads:
DirectoryIndex index.html
• and change it to read:
DirectoryIndex index.php index.html
• Note: You may also add index.phtml or any other default page if you added additional extentions in the previous step.
• Enable language settings by searching for the line:
#Include etc/apache22/extra/httpd-languages.conf
• and removing the # comment mark so it reads:
Include etc/apache22/extra/httpd-languages.conf
• Edit the language settings file (/usr/local/etc/apache22/extra/httpd-languages.conf) and add the following line at the end of the file:
AddDefaultCharset On
• Start Apache using the startup script:
/usr/local/etc/rc.d/apache22 start
Congrats, you’re done! Apache with PHP is installed.
Read more on this article...
Installing MySQL Apache and PHP on FreeBSD 7.1
Posted by
jo
, Monday, June 29, 2009 at 4:28 AM, in
Subscribe to:
Posts (Atom)