FreeBSD: First things first

Here is a sample of what I do after I first install a FreeBSD box:  After installing packages, etc., you might, as root, run rehash so that the commands in each package are available.

1.  Install PortInstall- pkg_add -r portupgrade

2.  Install BASH- pkg_add -r bash

3.  Install the ports collection:  portsnap fetch, portsnap extract, portsnap update

3.5.  Install Apache:  pkg_add -r apache22

4.  Add ‘ServerName testingforecho:80’ under the ServerName section in your /usr/local/etc/apache22/httpd.conf

5.  Add ‘kldload accf_http’ to your /boot/loader.conf, then run ‘kldload accf_http’ as root.

6.  Add your hostname to /etc/hosts, like:

::1                     localhost               localhost

7.  Start apache, like this /usr/local/sbin/apachectl start

(It should be noted that at this point, /usr/local/www/apache22 is owned by root.  You should chown -R www:www apache22)


1.  cd /usr/ports/databases/mysql55-server/
2.  make install clean

3.  Add mysql_enable=”YES” to your /etc/rc.conf

3.  /usr/local/etc/rc.d/mysql-server start
4.  mysqladmin -u root password newpassword

PERL (might already be installed)

1.  cd /usr/ports/language/perl5.10
2.  make install clean


1.  cd /usr/ports/lang/php5
2.  make config (select apache module and zlib, or you’ll have to recompile, later.)
3.  make install clean
4.  cd /usr/ports/databases/php5-mysql and “make install clean”
5.  cd /usr/ports/www/php5-session
6.  cd /usr/ports/graphics/php5-gd and “make install clean”
7.  Make sure that your httpd.conf has LoadModule php5_module libexec/apache/ added to it.
8.  cd /usr/ports/lang/php5-extensions and “make install clean” (select the mysql extension option)
8.5  cd /usr/ports/archivers/php5-zlib and then make install clean
9.  cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

10.  To the end of your httpd.conf, add:

AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps 11.  Find the line that has "DirectoryIndex index.html" and change it to "DirectoryIndex index.php index.html"
12.  Remove the comment in front of "Include etc/apache22/extra/httpd-languages.conf"
13.  Edit /usr/local/etc/apache22/extra/httpd-languages.conf and add AddDefaultCharset On" at the end of its file.

1.  In /etc/rc.conf, add something like:  ifconfig_bge0=”inet netmask″
2.  In /etc/resolv.conf, add something like:  nameserver xx.xx.xx.xx
3.  Add default route, like this:  route add default

Thanks to,,, and

This entry was posted in Geek and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *