Backend and Infrastructure

Adding a Web Server to Ubuntu

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

Sprout Video

In this lesson you will learn how to install a Web server on your virtual machine. Ultimately we will use a provisioning script to automate this task, but this lesson shows you the virtual machine is just like any other server you might have worked with in the past. Any time you want to add new software, you can always come back to this lesson if you (for some reason) don't want to create a recipe and re-provision your machine. Hopefully, though, by the end of this series you'll see why provisioning is a more robust solution than installing software directly.

Lesson Outcomes

By the end of this lesson, you will be able to log into your virtual machine, and use the command line to install new software.

Lesson Summary

  1. Navigate to
  2. Locate a base box you would like to use. Ensure you are matching the "provider" to what you have. e.g. VirtualBox for these lessons (not VMware).
  3. At the command lines, initialize your new server:

Ensure your server is up and running, and then log in with the command: vagrant ssh. This command must be issued from within the directory which contains the file Vagrantfile.

Install an AMP server using the directions for your base box. We'll use the same technique as is covered in the lesson Installing a Web Server on Ubuntu.

  • $ sudo apt-get install tasksel
  • $ sudo tasksel install lamp-server

This will install Apache, MySQL, and PHP.

To confirm the server is running, use the command: pstree.

Troubleshooting and Gotchas

  • OSX can use vagrant ssh; Windows will need to install PuTTY and use ssh vagrant. Using PuTTY is covered in the bonus lesson for this series.
  • If you get the error tasksel: aptitude failed (100), run the following commands:
    1. $ sudo apt-get update
    2. $ sudo tasksel install lamp-server 
      (I got this error on a precise32 base box with a Windows 8 host running inside of Parallels on a Mac OSX machine.)