Servidor Apache+PHP+SQL en FreeBSD 6.0 en 75 pasos

Que nadie se asuste con eso de los 75 pasos :)

Muchos de esos 75 pasos son del tipo «encienda su máquina», «pulse OK en el mensaje», «meta su clave de root dos veces» etc. De todos modos, seguro que más de uno lo agradece.

Un documento de los buenos: directo al grano, todo paso a paso bien explicado y sin saltarse nada y por tanto, una manera rápida y cómoda de echar a andar nuestro propio servidor web Apache, con PHP y MySQL, en un entorno FreeBSD 6.0.

Los pasos están detallados en el enlace anterior, y los reproduzco aquí también en la noticia extendida.

Minimum Requirements:

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.

Part I

1. Download the FreeBSD 6.0 Disc 1 from the internet ( 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, 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.

Part II

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:

cd /usr/ports/databases/mysql50-server

make install clean


chown -R mysql /var/db/mysql/

chgrp -R mysql /var/db/mysql/

/usr/local/bin/mysqld_safe -user=mysql &

cd /usr/ports/www/apache20

make install clean

12. Hit OK

13-14: Enter the following commands:

cd /usr/ports/lang/php5

make install clean

15. Select «use Apache 2.x instead»

16-17. Enter the following commands:

cd /usr/ports/lang/php5-extensions

make config

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. apachectl start

22. To be able to upload the files for your website, you will need to download a program like WinSCP.

23. Upload all of the files to /usr/local/www/

24. (Optional step) Purchase a domain name and point the DNS to your IP.

25. 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!