To use this guide, you are going to need the following:
- 1 burnable CD-R
- A computer with at least a 4GB hard drive
- A working ethernet card
- A network that uses DHCP.
Part I of this guide will guide you through the installation of the operating system
Part II will explain the installation of MySQL 5.0, Apache 2.0, and PHP 5.1.2.
1. Download the FreeBSD 6.0 Disc 1 from the internet (http://www.freebsd.org/where.html). If you are going to be running on what used to be a Windows machine, you probably have i386 architecture, so select that one. If you have a 64 bit processor (AMD makes several of these now, including the Opteron processor), select a 64 bit architecture.
2. Burn the FreeBSD “6.0-Release-i386-disc1.iso” to a disc.
3. Insert the Disk into the CD drive of the computer you want to turn into a server.
4. Start the machine.
A menu titled “sysinstall Main Menu”, this is the menu that will give you all of the installation options.
5. Use the arrows to select “Standard” and hit enter.
6. Hit OK to the message that pops up.
7. Hit Shift+A, and then Shift+Q.
8. Choose the “BootMgr” option.
Either the "bootmgr" or "standard boot manager" will work, but for simplicity we will go with the default option.
9. Hit OK to the message that pops up.
10 .Hit Shift+A and then Shift+Q
This will select the standard and most likely best setup of your hard drive.
11. Select option 8, “User”.
12. Hit “Yes” when you are prompted whether or not you want to install the FreeBSD ports collection.
The FreeBSD ports colection is a collection of thousands of open-source software programs that are extremely easy to install. We want this so that it is easy for us to install MySQL, Apache, and PHP.
13. Scroll back up to “Exit” now that we have selected a configuration set.
"Configuration set" is just the name for the settings and features of the operating system that we want.
14. Select option 1, “CD/DVD”.
You could also choose FTP at this step, but for reasons of speed, I recommend you just use the disk that we already have in the drive, since we already burned it. You may want to choose FTP if you burned the disk more than a couple months ago, and you want the absolute latest features of the operating system.
15. Select “Yes” if you are absolutely sure you are willing to sacrifice this machine to be a web server, and that you will never need any of the current contents of the hard drives again.
Hitting "Yes" is going to erase and reformat the entire hard-drive, so make sure that you actually want to do this before hitting it.
Approximately 15 minute wait.
FreeBSD has now been installed!
16. Hit OK to the installation message.
17. Yes, you would like to configure Ethernet or SLIP/PPP.
18. Select your Ethernet card (Mine is “3COM 3c90x / 3c90xB PCI Ethernet card”)
19. “No” do not try IPv6 configuration.
20. “Yes” try DHCP configuration.
This step is going to assume that your network automatically assigns DHCP addresses.
21. Enter one of the main domain names that will be hosted from this server (preferably the main one) in the “Host” box.
By one of the main domain names, I mean that if you are going to be hosting johndoespersonalwebsite.com, enter that domain name.
22. Note the IP that your machine has been assigned (Will probably look like 192.168.*.*, where the stars could be any number between 1 and 255). Tab to the end and hit OK.
23. “No” we do not want this machine to function as a network gateway.
24. “No” we don’t want to configure inetd and the network services that it provides.
25. “Yes” we want to enable SSH login.
SSH login is the standard way that people can access a *nix box remotely. If you want, you will be able to use any machine in the world to access and manage this server by using SSH.
26. “No” anonymous FTP access.
27. “No” not an NFS server.
28. “No” not an NFS client.
29. “No” don’t customize console settings.
30. “Yes” set the time zone.
31. Most machines are set to local time, and not UTC, so hit “No” unless you know that your machine is set up otherwise.
32. Select your region (America – North and South for me)
33. Select your country (United States for me, number 45)
34. Select your time zone (11, Central for me)
35. Select “Yes” the time zone looks reasonable.
36. “Yes” we want to enable Linux binary compatibility.
Approximately 3 minute wait.
37. “No” we don’t need to bother with a mouse.
38. “No” don’t browse the collection of packages.
39. “Yes” add an initial user account to the system.
40. Select option 2; add a new user to the system.
41. Enter the username that you would like to normally use and enter it in the “Login ID” box. Also enter a password for this user.
This step ensures that you have a user in the system other than the all-powerful "root". It is a good idea to have at least one other use in the system that you use on a normal basis, because if you always work as root, there is chance that you could accidently modify or delete some system files.
42. For the “Group” field, enter “wheel”, if you don’t do this, then you won’t be able to perform remote admin tasks.
43. Hit OK.
44. Go back up and select “Exit”.
45. Hit “OK” to the message that pops up.
We are about to set the “root” password, which is the most important password on a *nix box, so make sure that you come up with a good password that you are not going to forget or lose. You need to balance the difficulty of the password because if you forget it, you may have to reinstall the entire machine, but if the password is too easy, then malicious users or hackers will be likely to gain control of your machine.
46. Enter the root password twice.
47. “No”, you don’t want to return to the configuration menu.
48. Select “Exit Install”.
49. Select “Yes”, and while the system is rebooting, remove the FreeBSD disk from the drive.
50. As the machine boots up it will ask you for an entropy source, just hit a few keys at random and hit the enter key.
You have now installed and configured the main FreeBSD operating system, all future configuration and installs can be done remotely without ever touching the machine again. And, barring any unforeseen hardware or software problems, you should never need the monitor or keyboard of this machine ever again.
Use a program called Putty to connect to the machine via the IP that we were assigned during the DHCP step, or continue using the local keyboard and monitor connected to the machine.
1. Log in using the username and password that you came up with (webmaster, myJa3e9@npasS)
2. Log in as the super user by entering “su”, and then entering the “root” password when prompted.
Logging in as the super user gives you access to install and configure programs and change operating system settings.
3- 11. Enter the following commands, waiting until each completes before running the next one:
make install clean
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
/usr/local/bin/mysqld_safe -user=mysql &
make install clean
12. Hit OK
13-14: Enter the following commands:
make install clean
15. Select "use Apache 2.x instead"
16-17. Enter the following commands:
18. Select any php extensions you want for your webserver and hit "OK".
This is part of the configuration for PHP. PHP has many possible features that come in modules, such as the ability to manage user sessions, interface with a database, etc. By selecting a module at this step, it will automatically be installed and configured for you.
19. make install clean
20. Simply hit "OK" for any option configurations that pop up.
21. Type "cat >> /usr/local/etc/apache2/httpd.conf". On the next line type "AddType application/x-httpd-php .php" and hit CTRL+D.
22. apachectl start
23. To be able to upload the files for your website, you will need to download a program like WinSCP.
24. Upload all of the files to /usr/local/www/
25. (Optional step) Purchase a domain name and point the DNS to your IP.
Connect to the server by the domain name that you have purchased, or by the IP that you wrote down in an earlier step, and everything should work. Congratulations, you have installed a FreeBSD server, complete with Apache, PHP, and MySQL!
Dislaimer: I understand that this article does not include router setup, domain name pointing, bandwidth, uptime, or TOS issues. This was intentionally an article that just shows you how to set up FreeBSD, Apache, PHP, and MySQL. This article does not cover security concerns or teach you how to manage the server after it has been set up. Setting up your own box by following this guide is a decent way to create an intranet webserver, get into *nix for the first time if have previously always used external hosting, and from these steps you can feel free to deviate in order to explore and learn. If you are looking for more information, I recommend you look up the individual install processes, or perhaps try setting up these webservices with different operating systems to learn for yourself what is going to make sense for you or your business.
Written by Stephen Fluin.