How to Setup a FreeBSD 6 Webserver - FAMP Server

Posted on February 2nd, 2008 in Computers, Servers/Hosting, Unix/Linux, Web | 7 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

Does Facebook beat Myspace in Traffic? Nope!

Posted on November 26th, 2007 in General | No Comments »

I always saw this coming but of coarse there isn’t an exact measurement for who has more traffic, I can only rely on Alexa.com, Compete.com, and a couple other analytical tools. There is a lot of buzz right now about how Facebook has more traffic than Myspace using Alexa.com & Compete.com - that buzz is wrong.

compete.pngalexa.png

What I think? FaceBook dominates MySpace up and down - for the time being that is. A lot of people claim that the 1 dimensional page like FaceBook and MySpace will soon be a thing of the past and 3D worlds will become an everyday thing. I completely disagree - 3D worlds take too long to load and waste a lot of time (finding people, communicating, etc); white pages like Facebook get to the point and do a great job at it. Cars have 4 wheels and work great, do you think future cars will have more wheels? Probably not but I bet the features and efficiency of cars in the future will be much greater. Catch my drift?

The future of social networks will be more efficient, right to the point, and even faster. Do you think I am wrong? Fill me in on what I’ve missed and where you think social networks will go.

facebook1.pngmyspace.png

BTW I think MySpace blows. ;)

Apple iPhone 8GB Review & Jailbreak

Posted on November 11th, 2007 in Apple, Computers, wireless | No Comments »

A few weeks back I went to the Apple retail store and picked up a 8GB iPhone for $399. I didn’t immediately post about the iPhone because like most things I buy I always think it is the best thing in the world for the first few days.

So it’s been close to a month using the Apple iPhone and I think this is just the best phone ever. It is very easy to use, fast response, and does everything I need and want in a phone. The only real thing that took some time getting used to is typing but after a good week or so it feels normal.

I have noticed 3 problems with the iPhone that are either from manufacturing defects or from lack of innovation. First being the camera. Taking pictures during the day with a lot of light works great but with little light its crap. Even with light it can still be a pain in the butt because you have to remain very still for a few seconds, even the slightest movement will completely blur your pictures. A flash would have been a smart idea for this phone to prevent this issue and allow people to use the camera in darker settings. Probably a battery killer though…

 My next problem with the phone is the battery, or lack there of. Right off the bat I noticed that my phone was losing its charge pretty quick and from a full day of calls, emails, internet browsing, and pictures I’ll have a dead battery by the end of the night. I find myself now making decisions on whether I want to do certain tasks on my phone or not because of the battery which sucks but I make it work; I’ve never had the battery completely die so I am doing something right.

The third issue I have is more of a nuisance, the black cover on the back side of the iPhone at the bottom… It squeaks. When I hold my phone it squeaks, when I let go it squeaks. Thats all I have to say about that, LOL. 

 Aside from the three issues I wrote about above I totally love this phone and within the last two weeks I downloaded and ran Jailbreak. Now I have tons of applications and games and everything works great!


I would love to see what you guys think about Apple’s new iPhone and if you have run jailbreak yet.

Apple Safari 3 for Windows XP & Vista

Posted on October 20th, 2007 in Computers | No Comments »

I am very excited to see Apple has made their popular internet browser “Safari” available to us Windows users. I always have had to keep a little Mac around for testing purposes with Safari and with the release of Safari 3 beta for Windows I can finally kick this Mini Mac down to my son for his games and etc…

Click here to go to the Apple Safari 3 download page

StuffSafe.com - Online Home Inventory Software

Posted on October 12th, 2007 in Computers | 2 Comments »

Chris Pirillo recently blogged about his choice on home inventory software solutions. As much as I agree with Chris that StuffSafe is a good alternative to installed software on your computer (redundancy, ability to use anywhere), I do have some concerns with security (or lack there of) and who is behind StuffSafe.com.

As a registered user of StuffSafe I am asked (not required) to enter personal information including my home address and insurance information. Now let’s say you load your online home inventory database with all your furniture, jewelry, electronics, and other personal effects. You provide StuffSafe with your home address and even your insurance information; would you give this information to a complete stranger? Well that’s what your doing.

StuffSafe is not secured by any security risk assessment companies like HackerSafe and from what I can see they have no privacy policy verified or approved by company like Information Shield or Trust-e. What stops them (StuffSafe) or hackers from accessing and using this information against you? Who’s to say that StuffSafe is not a couple of thieves that came up with an Oceans 14 type grand scheme (which is such a freaking good idea, LOL)?

I know your probably thinking that I am totally overreacting but I think I do have a valid point. I wouldn’t use their services for the lack of security and also because I wouldn’t give this information out to anyone outside of my attorney. I would take the time to read a little bit deeper into online services like StuffSafe before signing up and giving them all of your information, you never know how your information will be stored and who will see it.

StuffSafe’s Privacy Policy regarding security (10/12/2007 @ 12:50am):

SECURITY
StuffSafe operates secure data networks protected by industry standard firewall and password protection systems. Our security and privacy policies are periodically reviewed and enhanced as necessary and only authorized individuals have access to the information provided by our customers
.”

That doesn’t leave a warm and fuzzy feeling in my stomach… ” yes but there is no guarantee on the box!

Computers and Me

Posted on October 8th, 2007 in Computers, Personal | 2 Comments »

I have been into computers for over 14 years and professionally for over 8 years. Back when I was 8 years old I got my first computer which was an Intel 286 running Microsoft DOS and came with a few games. This computer weighed like 30 lbs. and was the bad ass of computers when it came out, probably costing upwards of $2k. Ever since that early Christmas morning I was glued to that computer, playing games, navigating through MS DOS, and secretly opening the case to see what was inside.

It wasn’t to long after that when I screwed something up and my parents had to call out a computer guy to fix it. Every time I broke the computer (which was quite often) the tech would come out to fix it and I would watch him like a hawk to see what he did to troubleshoot the problem and how he ended up resolving the issues. As time passed and it was time to upgrade I would watch the computer guy open the box, pull out old drives and throw in new ones. I was so fascinated by this that I started doing it by myself. I actually remember one night I completely disassembled the computer and timed myself to see how long it would take me to put it all together and install DOS on the freshly formatted drives.

My next computer was an Acer 386 laptop, the computer I installed Windows 3.1 on! The computer guy was at our place regularly now, not only was I doing the same stuff before (I can’t believe I was taking apart laptops) but now I was totally digging into the very unstable Microsoft Windows 3.1! This is where I (and the rest of the computer enthusiast world) learn all the cool things you could do with Windows like opening a program being presented with a bluescreen, just because it felt like it. I think this is where I started acquiring a temper and a thing for punching my monitor. I was so used to being the cause of all my computer problems that I think I was getting a bit jealous, my futuristic computer can screw itself up and I won’t know what the cause was!!

At the age of 11, now living in Athens, Greece, my brother sends me one of his brand new computers from his office… a 486SX!! Holy crap was this thing fast; it had 2MB ram, a big 100MB hard drive, a sound card, and a frickin TURBO BUTTON! This is where I really got into both hardware and software, I remember visiting my brothers office in Phoenix, AZ, taking RAM chips out of a few other office computers and popping them into mine. At one point that computer had a whopping 8MB RAM and a LAN card.

At this time I became fascinated with networks, programming in Q-Basic, and the internet. When I was 13 we had moved back to the United States and I stumbled on this internet program called Imagination (INN). This thing was the coolest online community I had ever seen! It was a 3D world, basically a graphical map of a imaginary town that you could click on to go to different parts of the internet. One building would take you to chat rooms, another for games, and one even to meet people to have sex with, LOL.

Imagination

After Imagination came AOL which for me came hacking. Back when AOL was just a baby I used to make free accounts, spam chat rooms, kick people, ban people, and hit their servers so hard that it would shut them down for short periods of time. I ended up writing a piece of software that people could use to generate free accounts for AOL, which at that time sold for $30 and only lasted a few weeks, until my parents caught me.

I became very bored with AOL at this point and I moved on to mIRC chat rooms, hosting my own warez channels and using my computer (a pentium III) as a warez database. As illegal as this was I also learned a lot about more advanced applications from companies like Adobe, Macromedia, Microsoft, and etc… I also learned a ton about the internet and networking, more on the hosting side using DNS and Unix. At one point my parents got me my own phone line which I used specifically to host my own IRC server running a flavor of Unix, just for warez and the power of kicking and banning people when I felt like it.

I guess I got really tired of stealing applications and trading them and more interested in networking and the advancements Microsoft was making with Windows NT 3.51. Fortunately for me my brother’s company was growing fast and at that point had a ton of computers and servers running Windows NT, Microsoft Back Office and Microsoft Octopus. He also has a computer guy who was awesome and always open to have me hovering over him when he built and configured these massive servers and desktops. I am not sure if he still owns his own company, which at this point was from home, but his name was Tom Stone and his company was called Hard and Soft Answers. I owe a ton of my knowledge to Tom and his employees.

A year or two passes and my brother acquires a very large title company in Arizona. This time I get to work for the company and learn from a guy named Ron. Ron planned and built out the entire network, both computers and servers. I learn a lot about troubleshooting desktops and servers running Windows NT4.0; this was also the first time I ever saw a mini server which I thought was pretty huge. I learned in-depth about networking and server configurations and the new active directory (which back then I think was called something else). Another year passes and my brother sells the company to Continental Homes which is a huge company with tons of computer techs run by a MIS.

The MIS took me under his wing for a few days in their NOC and showed me the ropes. Here I learned a lot about TCP/IP, load balancing, disaster recovery, server configuration and implementation, and much more. The information I learn in this short amount of time was overwhelming but has stuck with me forever. I was pulling and terminating CAT3, configuring routers and switches, and learning about what all of this meant.

After leaving my brother’s company I went off into the real world and started working for companies like Discount Tire Corporate, a real estate company, a couple financial firms, and a telecommunication company. I have been blessed with an real life education and experiences that cannot be beat, above all they were all free!

I guess the part that gets me when I think back to my life with computers and networking is that I never stepped into a classroom to learn about this stuff, I learned it by doing it on my own and having people help me along the way. I have always had a drive to learn new things and especially new technologies and all of this now puts food in my child’s mouth and lights the house for my wife to relax in. Now I spend my time doing what I love for a living and giving my son the same opportunities I had to learn and grow.

My son is 3 now and for the last 7 months he has been turning on the computer, opening the internet browser, going to his favorite website (The Little Einsteins) to play his favorite games and watch his favorite movies. Niko (my son) is doing now what I did when I was around 13 or 14 years old (minus the illegal junk), I can’t imagine what he will be doing with computers and the internet when he is 13, or when he is my age…

I owe a lot to my brother John for providing me with my first computer and the experiences of working for his companies, placing me with the cream of the crop computer guys who were willing (or forced) to teach me. I owe a lot to my parents for spending way to much money to have computer guys come out weekly (sometimes daily) to fix my computer. I owe a lot to my wife and my son for allowing me the time to continue with my passion and my need for higher learning, it takes a very loving and understanding wife to go to sleep alone many nights so I can learn new things and expand my horizons.

I thank my current employer for paying a kid with just a high school education as much as they do.

;)