Run Your Own Unix Web Server (part 1 of 3)

Part 1 of 3 / Install FreeBSD

Setting up and running a Unix web server is surprisingly easy. Recently, on del.icio.us, I ran across the article Become Your Own Web Host in 75 Steps. Without too much explanation, the article describes how to install FreeBSD, MySQL, PHP, and Apache. Hopefully the following series will expand on that article and go a little deeper.

We will be installing:
  • FreeBSD (STABLE)
  • MySQL
  • Apache
  • PHP
  • and some other apps helpful to webmasters
Before we start, you'll need
  1. 1 blank CD
  2. A CD burner
  3. A computer with an ethernet card
  4. An Internet connection with a static IP address

Download FreeBSD


Your new webserver can be any old, cheap, Intel-based box, as FreeBSD will run on any old piece of crap.
  1. First, make sure your computer is compatible
    • Go to the FreeBSD Releases page
    • Check Hardware Notes for the Stable Release
    • Make sure your hardware is compatible with that release. I can almost guarantee that it is...
  2. Download FreeBSD
    • Go to the FreeBSD home page
    • Follow instructions for downloading the production/stable release
    • Download just the disc1.iso ISO image
  3. Burn the iso to your blank CD

Boot up Install CD


Now you should have:
  • 1 FreeBSD ISO CD
  • 1 computer (with a network card) ready to be transformed into a web server
Let me warn you that FreeBSD's installer is more old school than my VHS copy of Wild Style. But like Wild Style, it never gets old.

Installer Notes:
  • Use the arrow keys to move
  • Use space to select
  • Use enter to execute/select
  • Don't use the number pad; stick to the regular number keys
...Ok, let's go:
  1. Boot up
    Put your freshly burned CD into the soon-to-be webserver and turn it on. If all goes well you'll see the FreeBSD daemon asking you what you want to do
  2. Select the default option: Boot FreeBSD
  3. Use the arrows to select Standard - Begin Standard Installation, then hit Enter

The FreeBSD Installer


  1. Select Standard, hit Enter
  2. Use arrow keys to delete all current partitions: D deletes current partition; A uses entire partition; Q when you're done
  3. Boot Manager Select Boot Mgr, hit enter
  4. Disk Label Editor: Create disk partitions: Type C to create a new partition. Create custom partitions, something like below. Create the partitions in this order:
    2GB FS Mount Point: /
    1GB SWAP
    1GB FS Mount Point: /tmp
    1GB FS Mount Point: /var
    10GB FS Mount Point: /usr
    [all remaining] FS Mount Point: /home

    The 2nd partition (SWAP) should be 2x the amount of RAM installed. Partitions /, /tmp, and /var can stay rather small (use the defaults above) no matter how big your HD is.

    Type Q to finish
  5. Select Distribution Choose All
  6. Ports Collection Yes you want the ports skeleton (you'll go back to the Select Distribution screen. Scroll up, select Exit
  7. Installer Source Select CD/DVD
  8. Last Chance Hell, yeah. Delete everything, reformat the HD, give me some BSDLove
FreeBSD creates the filesystems that you named in the Disk Label Editor, and begins installing stuff. During the installation, you can see what's going on in a number of different views:
ALT-F1 - default GUI view
ALT-F2 - verbose installation log
ALT-F4 - emergency interactive shell
After extracting the source, and installing the source, you'll get to a screen that says:

Congratulations


Hit OK and move on...

Configuration


  1. would you like to configure any ethernet or SLIP/PPP network devices? Yes
  2. Select Your Network Card Select the first option unless you're sure your network card is one of the other options
  3. try IPV6? No
  4. try DHCP? No
  5. Network Info:
    Host [servername] If you want your server to be "foo.example.com", enter "foo" here
    Domain example.com
    enter the rest of your net info, click OK
  6. function as a network gateway? No
  7. inetd and network services that it provides? No
  8. enable SSH? Yes
  9. anonymous FTP? No
  10. NFS server? No
  11. NFS client? No
  12. customize system console settings? Yes
    I just select SAVER and select a really retro screen saver...like snake...
  13. Set this machine's timezones now? Yes
  14. Linux binary compatibility? Yes - this should let you run compiled linux binaries through FreeBSD's emulator.
  15. Does this system have a PS/2, serial, or bus mouse? No - mice are for wimps.
  16. FreeBSD Package Collection - Browse the collection now? No - we'll add ports later on
  17. Add any initial user accounts? Yes
    Select User; hit Enter
    • Login ID: web
    • UID: [default]
    • Group: [leave blank]
    • Password: *******
    • Full Name: Web Master
    • Member Groups: wheel
    • Home Directory: /home/web
    • Login Shell: /bin/csh (I like csh better than the default, sh)
  18. Set Root's Password
  19. Visit the general configuration menu for a chance to set any last options? No
  20. Use the right arrow to select [Exit Install]
    Hit Enter
  21. Are you sure you want to exit? Hell, fricken' yes, I'm sure
Your system will restart. Remove the install CD, and behold your new FreeBSD webserver

First Startup


You'll see a verbose startup messages page across the screen. The first startup, you'll eventually be asked to create an SSH key. To do this, just type a screenful (maybe 10 lines) of random junk then hit enter.

Your system will finish booting up and eventually prompt you with:

FreeBSD/i386 (foo.example.com) (ttyv0)
login: []

Login


Log in as web and the password you made, and start familiarizing yourself with some unix commands:

Next Steps

Now you have a FreeBSD web server connected to the internet. SSH is enabled, but not FTP. More importantly, to serve web pages, you'll need to install some additional software.

In the next lesson, we'll install:
  • PHP
  • MySQL
  • Apache
  • ...and more.
See Also
Run Your Own Unix Web Server (part 1 of 3) - FreeBSD Installation
Run Your Own Unix Web Server (part 2 of 3) - Software
Run Your Own Unix Web Server (part 3 of 3) - Configuration

Comments

Friday, Feb 10, 2006 / 1:28am JLMax said…

Nice one..!! Now I know what to do with my old PC Thanks.

Will wait for the next part

Monday, Feb 13, 2006 / 8:53am Craig said…

I will too...Until then I need to figure out how to transfer my poxy strings from my internal database to the external IODB conflict on port 4.

Thanks Dave!

Saturday, May 13, 2006 / 3:08am chris said…

Thanks! Me and a few of my friends have been running a forum for a while, and always wanted our own server. But up till now, we didnt know how. Again thanks, I found this very usefull!

Sunday, May 14, 2006 / 4:37am Ivan Minic said…

Great tutorial champ!

Wednesday, May 24, 2006 / 5:27am Tom Goodman said…

I have come across many sites. Very few sites give the useful information. This site is one among the best.

Tom Goodman http://www.Computerserverscore.com

Tuesday, Sep 26, 2006 / 9:03pm Unix Tips said…

Hi your site is pretty neat. This site also has some tips for you unix aficionados out there - cheers.

Wednesday, Dec 13, 2006 / 10:04am Sz said…

Awesome guide! Just one thing that seems to be left out -- Steps Number 2 and 3 in "FreeBSD Installer," leaves out something like "Remember to set the partition as Bootable by pressing 's'."

Again, excellent guide!

Szornes

Friday, Jan 5, 2007 / 10:59pm Thomas Polasek said…

Thanks to you, i have replace my puppy linux os 2.2 with freebsd 6 ... aside from having to do everything from the shell the os is a big step. I'm running a webserver using these very steps, check it out: http://isff.isff.com http://y.uk.to

Wednesday, Mar 28, 2007 / 9:59pm ocnsss said…

On personal opinion, I find this very helpful. Guys, I have also posted some more relevant info further on this, not sure if you find it useful: http://www.bidmaxhost.com/forum/

Friday, Apr 27, 2007 / 8:31am Chuks said…

This tut, has helped me alot, on setting up my web on my personal server, thanks....

Wednesday, Aug 15, 2007 / 10:06am Joseph Muli said…

Happy about this!I now know exactly what am going to do with my pc

Comments have been turned off on this blog.
Read something more recent.

Statements and opinions expressed in this blog and any comments made are the private opinions of the respective poster, and, as such, iMarc LLC is neither responsible nor liable for such content.

Meet The Author

Dave Tufts

Vice President, Director of Technology

Search

Recent Blog Posts

Recent Comments

We heart Visitors

  • iMarc
  • 14 Inn Street
  • Newburyport, MA 01950
  • Phone: (978) 462-8848
  • Fax: (978) 462-8807
  • Directions

Contact Us

Whether you have a huge project specification or just want to talk about updating your site, we’re here to help. Fill out the form, and we’ll get right back to you.

Contact Us
  • All Fields Required

Close