Archive

Posts Tagged ‘Debian 6 LAMP’

Setup LAMP using Debian 6.0 (Squeeze)

April 10, 2011 2 comments

A colleague asked me if it was possible to setup a LAMP platform where he can evaluate a couple of CMSes (MOODLE, Drupal, Joomla and WordPress). Well, the answer is YES!

I have to admit that I am a Linux dork so please bear with me. For this tutorial, I will be using Oracle VirtualBox 4.0.4 r70112 on top of Windows 7 Ultimate. So here we go…

CREATING THE DEBIAN 6.0 VIRTUAL MACHINE (VM)

  1. Download at least the Debian net-install ISO and make sure you have Internet connection via your LAN or Windows Internet Connection Sharing (ICS).

  2. Download and Install Oracle VirtualBox (OVB).

  3. Launch OVB.

  4. Click New then Next when the wizard appears.

  5. In the Name field, type Debian-Squeeze.
    Notice that the Operating System and version parameters are automatically pre-selected.
  6. Click Next.

  7. In the Base Memory Size field, replace 384 to just 256. Actually, using 128 would be fine but just in case you decide to install and configure the X Window System, you’d be glad to have keyed-in 256.

  8. Click Next.

  9. Options are pre-selected in this stage, so just click Next.

  10. Click Next, when the Create New Virtual Disk wizard appears.

  11. Dynamically expanding storage is pre-selected, click Next.

  12. In the Size field, key-in 10 GB instead and click Next then click Finish and another Finish.

INSTALL DEBIAN 6.0 (SQUEEZE)

Notice that after creating the VM, it is now highlighted and a summary of the hardware is displayed. We need to do a little hardware tweaking before we dive into the installation proper.

  1. Click Settings. It looks like this VBox icon Settings.
    The Setting window will pop-up. You will see the major components on the left pane and details for a particular component on the right pane.

  2. Click Network on the left pane then select Bridged Adapter under Enable Network Adapter on the right pane.
    I prefer bridged so the VM gets its own IP configuration as opposed to NAT where IP configuration is shared with the host machine.

  3. Click Audio then uncheck Enable Audio.
    You won’t need audio on your Linux server.

  4. Click Storage then click Empty under IDE Controller.
  5. Click the CD/DVD icon CD/DVD icon then click Choose a virtual CD/DVD disk file from the context menu.

  6. Locate the Debian net-installer ISO file you downloaded and double-click it.

  7. Click OK to close the Settings window.

  8. Click Start to fireup the VM.
    A message box will appear. Make a mental note on the hotkey. The hotkey releases host input devices auto-captured by the VM. With this particular virtualization hypervisor, it’s the right Ctrl key.

  9. Click OK to close the message box.
    The VM should continue and displays the install option menu.

  10. Install is pre-selected, hit the Enter key.
    Pop-up message boxes could appear. Just click OK on those.

  11. English is pre-selected in the Select a language screen; hit Enter.
    If you opted to use a different language, use the arrow keys to select the appropriate language then hit Enter when you’re done.

  12. In the Country territory area, select appropriate country. In my case, it’s Philippines. Hit Enter when done.
    If for some reason your country or territory is not listed, select Other and hit Enter.
    You will have more selection; just hit Enter when you’re done.

  13. In the Keyboard layout page, just choose the appropriate keymap (American English, in my case); hit Enter.
  14. In the Hostname field, debian has been pre-entered. This is okay in the meantime so just hit Enter.
  15. If you’re using Windows ICS like me, you should have mshome.net in the Domain name field. In any case, just hit Enter.
  16. In the Root password field, key-in a complex password like c0mpl3x_p@55w0rd just for fun and hit Enter.
  17. Re-type the same complex password and hit Enter.

  18. Key-in your full name in the Full name field then hit Enter.

  19. The setup wizard usually takes your first as username, if it’s okay with you, just hit Enter. Otherwise, hit the Backspace key and enter your desired user name and hit Enter.

  20. In the Password field for the new user, just key-in the same complex password and hit Enter.

  21. Repeat step 20.

  22. In the Partition Disks page, Guided – use entire disk is pre-selected hit Enter.

  23. Under Select disk to partition, the virtual hard disk is pre-selected, hit Enter.

  24. Under Partitioning scheme, All files in one partition is pre-selected, hit Enter.

  25. Finish partitioning and write changes to disk is pre-selected, hit Enter.

  26. Select Yes and hit Enter when prompted to write the changes to disk.

  27. Select the nearest mirror to your location and hit Enter.
    Note:
    Choosing US-based mirrors aren’t always the best option when running a net install; other mirrors are faster.

  28. If you’re not using a proxy server, just hit Enter. Otherwise, key-in your proxy address and port instead.

  29. You don’t need the survey, hit Enter.

  30. Hit the space bar to deselect Desktop; you won’t need the GUI to run a Linux server. Hit Enter.

  31. Like Windows, Linux needs a bootloader. Since Yes is pre-selected, hit Enter.

  32. Finally, Setup tells you that the installation is done. But before hitting Enter, click the Devices menu then hover your mouse cursor to CD/DVD devices and uncheck the Debian install ISO to release it from the VM. Hit Enter when you’re done.
    The VM will reboot and would later present you with the login screen.

  33. Go ahead and login as root and key-in the password you assigned awhile back.

  34. If you instead installed the OS in a physical machine, you need to install four additional applications to your server. They are:

    • htop – tool you can use to monitor system resources in realtime. It’s like the System Monitor in Windows.
    • dselect – a menu driven tool to add/remove programs. At times, I use this to check which app version is installed.
    • openssh-server – a daemon allowing you to remotely manage your server from virtually anywhere in the world. Think of this as the Command-Line-Interface (CLI) version of Terminal Server (but closer to Telnet which happen to be removed now) in Windows.
    • screen – tool that allow you to create multiple workspaces while remotely managing your server. If you happen to use SysInternals’ Desktop, this is something like it except of course it’s CLI-based.

    To install these applications, you issue the following command
    apt-get install htop dselect openssh-server screen

  35. When the installation is complete, type ifconfig to determine the IP address of your server.

  36. One last thing, download putty from here. If you’re wondering what putty is, it’s a tool you use to remotely manage your server from Windows. More like Remote Desktop for the CLI.

  37. When the download is complete, simply double-click the application.

  38. In the Host Name (or IP Address) field, key-in the IP address of your server then click OK.
    You should shortly be prompted for your login name and password. Login as root and start your Linux remote administration.

Congratulations! You have just successfully installed Debian 6.0 (Squeeze). Up next, setting up your CMS platform.

SETTING UP THE CMS PLATFORM

Don’t worry, this procedure would be quick you won’t even know what hit you…

Install the Web Server

  1. Issue this command apt-get install apache2.

  2. Hit Enter to continue.
    By the way, the capitalized letter inside the bracket will be the default option when you hit Enter. In this case, it’s Y.

When you see the # prompt again, that means the installation is done.

Install the Database

There are a couple of databases available to Linux that you can use for the CMSes you want to install but majority of these usually has one particular database commonly used, MySQL.

  1. Issue the command apt-get install mysql-server.

  2. Hit Enter to continue.

  3. You will be prompted to key-in the MySQL root password. For your own sanity’s sake, don’t leave this empty, key-in your complex password
    Note: Keep the password in mind or securely store it where you can readily retrieve it; I use KisKis for this and for all the other passwords I use, personal and work-related. KisKis is acronym for Keep It Secret Keep It Safe. Try it, you’ll love it besides being FREE.

Install PHP 5 with CMS requisites

To install PHP 5 and other CMS requisites, issue this command
apt-get install php5 php5-mysql php5-gd php5-curl php-xml-rpc php5-imap libapache2-mod-auth-mysql

Oh, by the way, doing this tutorial in Ubuntu is almost identical. The only difference is that you use sudo to do root-related tasks. Unless you have explicitly enabled the root user account.

That’s it. You now have a working LAMP server based on Debian 6.0 (Squeeze)

Categories: Linux, VirtualBox, Windows 7 Tags: