Super Tiny Webservers

Back to our regularly scheduled programming.  I’ve written a lot of not-quite-technical posts in the past few weeks.  I know I did this week (because the gas tax has me furious).  All that being said, I decided to make a right-proper one this time because I’ve been toying around with this project at work and information is pretty slim because it’s out of date.  We needed a web server.  A small web server.  Apache, PHP, MySQL.  PhpMyAdmin to make part of the project super easy.

Well, the tiny part was easy.  Damn Small Linux.  Base install less than half a gig.

Adding Apache, PHP, MySQL, and PhpMyAdmin: not so much.  All the instructions were hand-wavy and the newest installer scripts don’t work on the size of disk I wanted.

So I present to you: Linux, Apache, PHP, MySQL, PhpMyAdmin: <768MB total install size.


  1. I used Oracle VM VirtualBox to do this.  Using the base settings for the VM (type in the name of DSL and it will make all the settings for you) worked fine.  The only thing I tweaked was the drive size.
  2. Please don’t run this web-facing.  This was for internal use on a completely private (trusted) network.  It’s running very old versions of PHP, Apache, and MySQL.  I wouldn’t even browse the web on it (except to get the XAMPP installer) for fear of drive-by (not that you can visit many sites because the SSL implementation that the browser supports is dismal and broken with current gen SSL).
  3. DSL is available here.
  4. XAMPP 1.8.1 is available here.  This is the latest version that will install on a system with the drive size we are using (768MB).

Let’s get started!

  1. Create a new VM in VirtualBox.
    1. Click New in the VM Manager.
    2. Name: DSL-<anything you want>
      1. This will auto-select the type as Linux and the version as Linux 2.4 (32-Bit).
    3. Memory Size: Any amount higher than 1GB because MySQL Databases but no more than 2GB because 32-bit OS.  I used 2GB because I can.
    4. Create a drive of any type (I used VMDK) with a size of 768MB.
    5. Right click on the newly-created VM and select Settings.
      1. Make any changes you might want, but don’t mess with the PS/2 Mouse (it will be sad).
      2. Add the CD as the slave to the IDE controller.  SATA will not work.  Do not try it.
      3. Disable audio. It’s a damn server.
      4. Network options: I always set it to Bridged Adapter because I like having a LAN accessible IP to work with.
      5. Disable the USB controller because USB support in DSL is minimal at best.
      6. Save your settings.
  2. Start the VM and immediately boot off the CD.
  3. Press Enter to boot DSL off the CD.
  4. Let’s install DSL.
    1. Open ATerminal via the icon on the desktop.
    2. Partition the disk
      1. Type in “sudo cfdisk” and press Enter.
      2. Press y to create a new partition table.
      3. Press n to create a new partition.
      4. Press p to create a new primary partition.
      5. Press enter to confirm the disk size (mine showed up as 805.11MB).
      6. Press b to enable the bootable flag.
      7. Press the right arrow until “Write” is selected and press Enter.
      8. Type in “yes” and press Enter.
      9. Press q to quit cfdisk.
    3. You could reboot with “sudo shutdown -r now” but I found it was not necessary to do so.
    4. Install to the hard drive.
      1. Type in “sudo dsl-hdinstall” from the ATerminal window.
      2. Provide the partition name.  If we did one partition it will be hda1.  Type in the partition name and press Enter.
      3. Press y and Enter to enable multi-user support.  This is not necessary, but was for my project.
      4. Press y and Enter to use Ext3 because the machine as a VM has tons of resources and can handle it.
      5. Press y and Enter to confirm installation.
      6. Press y and Enter to install the boot loader.
      7. You can use either Grub or Lilo.  I have confirmed Grub works.  Press g and Enter.
      8. Press y and Enter to reboot.
    5. Boot from the hard drive and select the appropriate resolution.  I use 1024×768 out of simplicity.
    6. Set your passwords.
      1. You’ll need to set passwords for root and dsl users.
      2. For root I used: IAmRoot2016!
      3. For dsl I used: XAMPP2016!
    7. Login as user dsl.
    8. Let’s get XAMPP installed!
      1. Open up ATerminal again.
      2. As user dsl type in: wget and press Enter.
      3. Wait for it to download.
      4. Type in: sudo tar xvzf xampp-linux-1.8.1.tar.gz -C /opt and press Enter.
      5. Type in: rm xampp-linux-1.8.1.tar.gz and press Enter.
      6. Type in: cd /opt/lampp and press Enter.
    9. Let’s start XAMPP!
      1. Type in: sudo ./lampp start and press Enter.
    10. Let’s configure XAMPP!
      1. Type in: sudo ./lampp security and press Enter.  This will let us set some security on the installation.
        1. Choose whether or not you want the base htdocs to be protected by a password.  I didn’t, so I press n and Enter.
        2. Choose whether or not you want the PhpMyAdmin user pma to have a password (hint: you do).  Press y and Enter.
          1. Enter the password and press Enter.  I used Harbor2016!
          2. Confirm the password and press Enter.
        3. Choose whether or not you want the MySql user root to have a password (hint: you do).  Press y and Enter.
          1. Enter the password and press Enter.  I used Freight2016!
          2. Confirm the password and press Enter.
        4. Choose whether or not you want the FTP user nobody to have a password.  I did.  You might not.  I pressed y and Enter.
          1. Enter the password and press Enter.  I used Logitech2016!
          2. Confirm the password and press Enter.
      2. Type in: sudo nano /opt/lampp/htdocs/xampp/cds.php and press Enter.  We’re going to fix the hard-set root password in this file just so the examples work.
        1. Press Ctrl and W and search for root.
          1. It will be in two places.  Run the search twice.  The line will be: mysql_connect(“localhost”,”root,””);
          2. You need to change the line to be: mysql_connect(“localhost”,”root”,”Freight2016!”); where Freight2016! is your MySQL root password you set earlier.  Change it in both places.
          3. Press Ctrl and X, press y, and press Enter.
      3. Type in: sudo nano /opt/lampp/etc/extra/httpd-xampp.conf and press Enter. We’re going to fix the PhpMyAdmin Security so we can access it elsewhere on the LAN.
        1. Scroll to the bottom of the file until you see a section starting with # New XAMPP Security Concept.
        2. Put a # in front of the lines:
          1. Order deny, alloww
          2. Deny from all
          3. Allow from ::1
          4. fc00::
          5. fe80::
        3. Add a line: Require all granted
        4. Press Ctrl and X, press y, and press Enter.
      4. Type in: cd /opt/lampp and press Enter.
        1. Type in: sudo ./lampp restart and press Enter.
          1. We need to restart XAMPP because we changed a config file.
      5. Type in: sudo su and press Enter.
        1. Type in echo /opt/lampp/lampp start >> /opt/
          1. This will make Apache, PHP, and MySQL part of the startup routine!
    11. Visit the IP Address of your VM in a browser.  It should show you the basic XAMPP for Linux page:
    12. Even better, everything should be working!

Even better, here’s what we get when we run df -k:


A fully working Apache, PHP, MySql, and PHPMyAdmin installation weighing in at 469,472 KB (458.5MB).


I re-iterate, this was for a project that needed to be super tiny (we need to image the drive to do forensics on it) and shouldn’t be used in the wild.  That being said, it was a fun exercise in working with something not-quite-recent and making it work the way we needed.

I’m providing the archived version of the VM here.  It’s 158MB in a 7Zip format.  Insane, right?  Normally I wouldn’t have provided the passwords I used, but since I’m putting the VirtualBox files up I figured if anyone wanted it, they could grab it and do whatever they needed with it after the fact.

-M, out.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.