How to Setup a FreeBSD 6 Webserver - FAMP Server

Posted on February 2nd, 2008 in Computers, Servers/Hosting, Unix/Linux, Web | 6 Comments »

Here it is, the meat and potatoes of setting up a FAMP server (FreeBSD 6.3, Apache, MySQL, PHP/Perl). Keep in mind these instructions are exactly what I do step by step to setup a FreeBSD webserver. Originally when I started with FreeBSD I couldn’t find a solid source of reliable information on how to set all this up. Every time I would ask someone for some good instruction I was always directed to www.freebsd.org. I have to tell you it is extremely overwhelming for me at that time to even understand anything off of that site’s directions - as well written as it is.
Over the last few years I have come across some decent walkthroughs and tutorials but 90% of them were still either out dated or lacking 1 or 2 steps that can really jack things up. I have really tried to make this tutorial as straight forward as possible, no BS and no info that’s going to waste your time.

Before I install anything I always make sure I have the latest release of FreeBSD installed with the Developer distribution. Many tutorials out there tell you to install the bare minimum of FreeBSD with the “Minimum” distro, I recommend Developer. If you need a good step by step on how to install FreeBSD (6.2 & 6.3) then click here. Remember, instead of selecting the minimal option on the Distributions screen, choose Developer.

Once you have FreeBSD installed the steps below will show you how to setup and configure a full FAMP server. Good luck!

# cd /usr/ports/lang/php5
# make config
select: Apache
# make install

# cd /usr/ports/lang/php5-extensions
# make config
select: bcmath, bz2, ctype, curl, dom, ftp, gd, gettext, mbstring, mysql, pcre, posix, pdo, session, simplexml, sqlite, xml, zlib (also by default there are many options pre-selected including some of the ones listed here, make sure to leave those checked).
# make install

Usually after everything is done you will notice a few mysql errors appear, run this command:

# pkg_add -r mysql50-server

Now before editing any file on my system I always make a backup of it:
# cp /usr/local/etc/apache/httpd.conf /usr/local/etc/apache/httpd.conf.orig

Now let’s edit your Apache config file to get everything configured properly:
# edit /usr/local/etc/apache/httpd.conf

Change the default listen address to the IP address of your webserver.

#Listen 12.34.56.78:80
To:
#Listen 192.168.1.10:80 (example, use your machines IP Address)

Change the email address of the ServerAdmin to your email address or the address of the person in charge on this server:

#ServerAdmin you@your.address (use your email address)

Change the ServerName option, if you don’t have a fully qualified domain name please change this to the servers IP address:

#ServerName www.example.com
To:
#ServerName 192.168.1.10 (example, use your machines IP Address - for internal, intranet implementations)
Or:
#ServerName www.peter-v.com (example, use your domain name if you have one and your going to point DNS to that machine)

# Add a DirectoryIndex option:
DirectoryIndex index.php index.html index.htm index.php3 index.php4

# In the AddType section add the following for PHP:
AddType application/x-httpd-php .php .htm .html
AddType application/x-httpd-php-source .phps

Now exit and save, your all done with Apache.

# echo ‘/usr/local/sbin/apachectl start’ >> /etc/rc.local

Now let’s configure MySQL:

# cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
# echo ‘mysql_enable=”YES”‘ >> /etc/rc.conf

# /usr/local/bin/mysql_install_db
# chown -R mysql:mysql /var/db/mysql
# /usr/local/share/mysql/mysql.server start

If the command: # /usr/local/share/mysql/mysql.server start doesn’t work or fails, try this command:
# /usr/local/etc/rc.d/mysql-server.sh start

# /usr/local/bin/mysqladmin -u root -h Hostname.domainname.tld password ‘YourPassword’
# /usr/local/bin/mysqladmin -u root password ‘YourPassword’

Example:

# /usr/local/bin/mysqladmin -u root -h webserver.peter-v.com password ’secret’
# /usr/local/bin/mysqladmin -u root password ’secret’

Now let’s install Perl DBI and DBD Support (which many apps need that run using Apache and MySQL):

# cd /usr/ports/databases/p5-DBI && make install && make clean
# cd /usr/ports/databases/p5-DBD-mysql50 && make install && make clean

Reboot.

That’s it, your all done and now you’ve got yourself a FAMP Webserver.

Tips:

If at anytime in this tutorial a command doesn’t work, try rebooting first. Sometimes after installing certain applications or components it is required to reboot before being able to utilize it. After a quick reboot it always works.

I would love to hear your comments and if you have any suggestions or issues with this tutorial please leave a comment, thanks!

FreeBSD

How to Install GD Support for PHP in Ubuntu - Drupal

Posted on January 2nd, 2008 in Unix/Linux, Web | 1 Comment »

I am in the process of building a social site using Drupal and realized I didn’t have GD support for PHP5 installed on my server. I’m sure this is a common roadblock for people new to installing Drupal or even just PHP so here is what you need to do:

Open terminal and type in the following command:

$ sudo apt-get install php5-gd

Now restart Apache

# sudo /etc/init.d/apache2 restart

There you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!

The Best SEO Extensions for Firefox 2

Posted on December 8th, 2007 in Analytics, Computers, SEM/SEO, Web | 1 Comment »

Being that I am an SEO I need to see live stats and information all the time; fortunately for me Firefox has a lot of great tools for free and extremely easy to use.

SEO tools for Firefox:

1. Search Status: This toolbar provides extensive search-related information about a site, all conveniently displayed in one discreet and compact toolbar. I use everything this tool has to offer but my favorite feature is the display of site’s Google PR, Alexa, and Compete at the base of my browser.

2. SEO for Firefox: Aaron Wall from SEOBook had this neat little tool developed and I love it. Tons of stats show for every listing in Google’s SERP whenever you search anything. This tool has to be one of the best SEO tools out there and without it a lot of my time would be wasted.

3. Social Media for Firefox: I already posted about this but this tool is worth the time to write about again. You can see my original post here but for those of you SEO/SEM Social Network guys like myself this tool just rocks and is definitely a major time saver.

Here is a list of other extensions I use including a few other SEO/SEM plug ins:

- SEOpen: This tool packs a ton of SEO tools, most I use daily.

- SEOLinks: Neat little tool that shows link stats with mouse over.

- Link Checker: Don’t get caught with broken links again.

- ShowIP: Love this tool for when I swing DNS records.

- ServerSpy: Great extension to show what type of server & version the site is hosted on (i.e. Apache 2, IIS 7.0, etc).

Install Apache, MySQL, PHP and Perl the fast and easy way!

Posted on December 2nd, 2007 in Apple, Computers, Microsoft, Tools, Unix/Linux, Web | No Comments »

Installing Apache + MySQL + PHP + Perl can be a pain in the ass on any system, until now. XAMPP is a free - fast & easy way to install Apache distro containing MySQL, PHP and Perl. Download, extract and run -that’s it!!

Currently there are 4 XAMPP distros:

* XAMPP for Linux
The distribution for Linux systems (tested for SuSE, RedHat, Mandrake and Debian) contains: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, gdbm, zlib, expat, Sablotron, libxml, Ming, Webalizer, pdf class, ncurses, mod_perl, FreeTDS, gettext, mcrypt, mhash, eAccelerator, SQLite and IMAP C-Client.

* XAMPP for Windows
The distribution for Windows 98, NT, 2000, 2003, XP and Vista. This version contains: Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, Ming, JpGraph, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, and WEB-DAV + mod_auth_mysql.

* XAMPP for Mac OS X
The distribution for Mac OS X contains: Apache, MySQL, PHP & PEAR, SQLite, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, zlib, Ming, Webalizer, mod_perl, eAccelerator, phpSQLiteAdmin.

WARNING: This version of XAMPP is still in the first steps of development. Use at you own risk!

* XAMPP for Solaris
The distribution for Solaris (developed and tested with Solaris 8, tested with Solaris 9) contains: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, Freetype2, libjpeg, libpng, zlib, expat, Ming, Webalizer, pdf class.

WARNING: This version of XAMPP is still in the first steps of development. Use at you own risk!

xamppjpg.gif

Click here to read more about XAMPP & download