FreeBSD Server Installers

From XOMBO Documentation

Jump to: navigation, search

The following steps will install and configure Apache 2.2, MySQL 5.1, and PHP 5 on your FreeBSD Installation. This page assumes that you are running as the super-user by first issuing the su command and using the root password you specified at install time.

Contents

Apache 2.2

From screen:

cd /usr/ports/www/apache22
make install distclean

Leave the defaults in the menu.

After it's completed compiling, execute the following commands to start the server with SSL support at boot:

echo 'apache22_enable="YES"' >> /etc/rc.conf
echo 'apache22_flags="-DSSL"' >> /etc/rc.conf

Use the following commands to setup the initial SSL key folders:

mkdir /usr/local/etc/apache22/ssl.key
mkdir /usr/local/etc/apache22/ssl.crt
chmod 0700 /usr/local/etc/apache22/ssl.key
chmod 0700 /usr/local/etc/apache22/ssl.crt

MySQL 5.1

cd /usr/ports/databases/mysql51-server
make install WITH_OPENSSL=yes distclean
echo 'mysql_enable="YES"' >> /etc/rc.conf

This compile will take approximately an hour, so make sure you use screen so as not to lose the compilation in the event of connection failure or accidentally closing the window.

PHP 5

cd /usr/ports/lang/php5
make config

You will be prompted to add module support. Ensure Apache support has been checked off. The other unchecked patches are optional--just be sure to research what they do before selecting them. Depending on your scenario, having additional patches may make debugging easier or add support for multi-byte characters (i.e. UTF-8, Cyrillic/symbol languages).

make install distclean

PHP 5 Extensions

cd /usr/ports/lang/php5-extensions
make config

Ensure the following extensions are selected (they may currently, or in the future, be required by Platform):

  • BZ2
  • GD
  • CALENDAR
  • CURL
  • EXIF
  • FILEINFO
  • FTP
  • GETTEXT
  • IMAP
  • MCRYPT
  • MBSTRING
  • MYSQLI (not MYSQL)
  • NCURSES
  • OPENSSL
  • PDF
  • PGSQL
  • PSPELL
  • TIDY
  • XSL
  • ZIP
  • ZLIB

The other unchecked extensions are optional. Leave extensions that are already selected by default enabled.

make install distclean

During the compile, some extensions may require additional configuration. Leave them as-is and confirm the selection to continue compiling.

Installing Memcache Extension via PECL

cd /usr/ports/databases/pecl-memcache
make install distclean

Configure Apache and PHP

Open the Apache configuration file with nano

nano -w /usr/local/etc/apache22/httpd.conf

Use CTRL+W to locate the "LoadModules" section. Scroll to the bottom of that list of modules and locate the PHP entry. Add the following lines after that entry:

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

This is an appropriate time to reboot the operating system so that it starts up all the contingent services at the next reboot. Then, you can begin testing to ensure that all your steps were completed successfully.

Test Installation

Configure SSL Certificates (Optional)