A quick FreeBSD tutorial, mostly commands, on how to install Apache, PHP, MySQL and Webmin on FreeBSE 7.2

FREEBSD TUTORIAL

  1. MISC
    To update ports: # portsnap update
  2. MYSQL - MySQL 5.0 installation
    # cd /usr/ports/databases/mysql50-server
    # make install clean
    # mysql_install_db –user=mysql
    # chown -R mysql /var/db/mysql/
    # chgrp -R mysql /var/db/mysql/
    # /usr/local/bin/mysqld_safe -user=mysql &
    # echo ‘mysql_enable=”YES”‘ >> /etc/ rc.conf
    # mysqladmin -u root password s0MenastyPASSWORD
  3. APACHE – Install Apache HTTP Server 2.20:
    # cd /usr/ports/www/apache22
    # make install clean
    # echo ‘apache22_enable =”YES”‘ >> /etc/ rc.conf
    # /usr/local/sbin/apachectl startApache installation finished.
    /usr/local/www/apache22/data/ is the DocumentRoot
  4. PHP – Instal PHP Hypertext 5
    # cd /usr/ports/lang/php5
    # make config (choose apache)
    # make install clean

    Install PHP5 extensions and modules to enable the support of the modules in Apache:
    # cd /usr/ports/lang/php5-extensions
    # make config
    # make install clean

    Edit the Apache configuration file in order to enable Apache web server to load the PHP modules when initialization:
    Go to Apache configuration file location by cd /usr/local/etc/apache22/
    # vi httpd.conf

    (a) LoadModule php5_module libexec/apache/libphp5.so
    (b) Search for LoadModule lines, after the last LoadModule line, but within the same section, add the following 2 lines:
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    (c) DirectoryIndex index.php index.html index.htm (append)
    (d) Check:
    <IfModule mod_dir.c>

    <IfModule mod_php3.c>
    <IfModule mod_php5.c>DirectoryIndex index.php index.php3 index.html</IfModule>
    <IfModule !mod_php4.c>DirectoryIndex index.php3 index.html</IfModule>
    </IfModule>

    <IfModule !mod_php3.c>
    <IfModule mod_php5.c>DirectoryIndex index.php index.html index.htm</IfModule>
    <IfModule !mod_php4.c>DirectoryIndex index.html</IfModule></IfModule>
    </IfModule>

  5. WEBMIN — Install webmin
    # cd /usr/ports/sysutils/webmin
    # make install clean
    # echo ‘webmin_enable =”YES”‘ >> /etc/ rc.conf (append command. To start on reboot)
    You need to run /usr/local/lib/webmin/setup.sh script in order to setup the various config files, enter:
    # /usr/local/lib/webmin/setup.sh
    Server restart is recommended

    http://your-server-ip:10000

Hope this helps you. Cheers