iMarc | Interactive Media Architects
  • Portfolio
  • Process
  • About
  • Communiqué
  • Contact
  • Support
  • Search

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

by Dave Tufts - February 7, 2006 / 12:12pm View more articles

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:
  • Unix commands reference card
  • Unix in a Nutshell: Desktop Reference

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
More Articles Get the RSS Feed Post A Comment

11 Comments

by JLMax   #
on February 10, 2006 / 1:28am
Nice one..!!
Now I know what to do with my old PC
Thanks.

Will wait for the next part
by Craig   #
on February 13, 2006 / 8:53am
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!
by chris   #
on May 13, 2006 / 3:08am
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!
by Ivan Minic   #
on May 14, 2006 / 4:37am
Great tutorial champ!
by Tom Goodman   #
on May 24, 2006 / 5:27am
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
by Unix Tips   #
on September 26, 2006 / 9:03pm
Hi your site is pretty neat. This site also has some tips for you unix aficionados out there - cheers.


by Sz   #
on December 13, 2006 / 10:04am
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
by Thomas Polasek   #
on January 5, 2007 / 10:59pm
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
by ocnsss   #
on March 28, 2007 / 9:59pm
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/
by Chuks   #
on April 27, 2007 / 8:31am
This tut, has helped me alot, on setting up my web on my personal server, thanks....
by Joseph Muli   #
on August 15, 2007 / 10:06am
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.

iMarc

iMarc is a web development company in Newburyport, MA. This is our blog.
View all blogs or learn more about iMarc.

About the Author

Dave's Head Dave Tufts, Vice President of Technology
I help people build websites.
I have two daughters.
I'd rather be gardening.
More blogs by Dave

Search Our Blog

Recent Communiqués

  • Inc. 5000
  • Say Hello to our new Sys Admin
  • "Not Invented Here" for a Triple Word Score
  • ca·coph·o·ny
  • Clank
  • Year in Quotes (volume 2)
  • Gunslinging Rockstar Ninjas
  • Now Hiring: Junior Interactive/Web Designer
  • Photoshop: Create Your Own Glossy Icons
  • They only come out at night
  • Context switches are expensive
  • <i> is not evil.
  • Schooled.
  • Full-screen branding
  • Summer Job, iMarc Style

Popular Communiqués

  • Now Hiring: Junior Interactive/Web Designer
  • Photoshop: Create Your Own Glossy Icons
  • Say Hello to our new Sys Admin
  • "Not Invented Here" for a Triple Word Score
  • ca·coph·o·ny
  • Custom Away Messages are Overrated
  • Schooled.
  • Summer Job, iMarc Style
  • Year in Quotes (volume 2)

Recent Comments

  • Inc. 5000

    By Nick: Congrats.

  • Inc. 5000

    By Craig Henry: WOOWOOOO

  • Inc. 5000

    By Jeff Turcotte: wow!!

  • Photoshop: Create Your Own Glossy Icons

    By nicole: thats cool ,but can u make it a little easyer . =/…

  • Say Hello to our new Sys Admin

    By Nick: 14 days and no love. Congrats Mike.

RSS

RSS Icon Learn about RSS and get the feed for our blog.

About iMarc

  • We build custom web sites
  • In-house strategy, design, programming, hosting
  • In business since 1997
  • We’re located in Newburyport, MA
  • Call us at (978) 462-8848

© 2008 iMarc LLC, Contact Us

Links

  • Home
  • Portfolio
  • Client Support
  • Log In
  • (icon)RSS

Meet the Team

Judi's Head Judi Crofts, Controller

Keeping everyone under control. In business terms: Accounting

Learn More | Meet the Others