Local Development Environment - Part 1

Being a web developer who worked on several open source projects remotely with some friends and colleagues, I have faced some difficulties at the beginning getting my development setup done correctly and available online, specially as being behind the proxy of my internet provider. But now after some work I have a stable local development environment that helped me get more organized, support all my development requirements and luckily available live and online.

In this article I’ll share how I prepared this environment on my Windows XP system, it will cover the installation of a web server, mail server, database server, open source programming languages, version control, and some other quick tools too, all of the tools and applications used here are either open source or freeware, below are the links to download them before we start:

Just before we start let’s decide the directories we will use, I don’t recommend using the system drive for this (normally it’s Local Disk C:) in order to separate the development environment files from the system files, if you have another partition it would be much better but at the end it’s your own choice, mainly we will need two directories:

  • development where we are going to place all the program files of our tools and servers.
  • webroot as the web root folder where we will put our scripts and projects files.

Naturally you can use your own names and places for these folders, in this tutorial I’ll refer to them as D:\development and D:\webroot, now we have the files and the directory structure ready so let’s get to work.

No-IP Dynamic Update Client

No-IP is a dynamic/managed DNS service. Simply when you don’t have a static IP, installing the dynamic updater provided by No-IP will automatically update your dynamic IP to a given subdomain of your choice.

As a start you have to sign up for a free account, after signing up and verifying your email it’s time to setup your subdomain, to do that login to your account and from the left sidebar, under “Hosts / Redirects” choose Add:

No-IP configuration screen

Never simpler, in the Hostname field type a subdomain of your choice to be the address that will always redirect to your local machine, you can choose the domain on which you want your address to be, confirm that the Host Type is DNS Host (A), leave all the other options as is and Create Host.

Install the No-IP DUC that you have already downloaded earlier, choose the development path we have created D:\development to store the program files in. The first step after the installation is to enter the account details, the email address and password you signed up with, so we can reach our account window to see our hosts and activate them.

From the No-IP window go to Options, from the first tab Standard check the first and the third options that will make the dynamic updater Run on startup and Run as system service so you don’t have to worry about it anymore, if you use a proxy for your internet connection configure it from Connection -> Proxy. When you are done confirm your changes and close the Options dialog box.

Back to your No-IP window, the host you have created online is listed here with an empty checkbox next to it, checking this box will update your IP with this host, to test No-IP configurations you can either ping your subdomain from the command prompt and see if it’s replying with your IP or wait until we finish installing Apache and test your live web server.

Apache Web Server

Apache is an open-source HTTP server, Netcraft claims that more than 62.72% of the websites online uses Apache, which makes it the most commonly used web server, specially for open-source projects. It’s easy to use, secure, efficient and extensible.

Installing Apache

Run the installation file downloaded earlier (named apache_2.0.55-win32-x86-no_ssl.msi), accept the license agreement, read about Apache, and then let’s configure the server:

Apache configuration dialog box

In this dialog box we will use the No-IP hostname that we have created few minutes ago yoursubdomain.no-ip.org for both Network domain and Server name, use your own email address as the administrator’s email and finally keep the last option on Port 80 as we will change it later.

Typical install is fine, then we have to choose the installation folder, as we have decided to keep all our development files in one directory we will choose D:\development as the path.

If you have any firewall installed (most likely Windows XP SP2) you may see some warning message after the installation is done, simply unblock and here we go, Apache is up and running and welcoming you at http://localhost.

Apache welcome screen

Configuring Apache

The port, If you have such a great ISP like mine, that prevent you from enjoying the port 80, the only way to get your web server available online is by changing the port, we can do this by simply editing the httpd.conf file located inside D:\development\Apache2\conf\ folder.

Search for “Listen 80″ or simply go to line 120, now just change the port to your own, personally I use an easy to type number 8520, save and restart Apache from the system tray icon -> Open Apache Monitor -> Restart, let’s try again… http://localhost:8520 the same apache welcome page has just moved, now let’s simply test it with our online No-IP hostname and see if it will work, http://yoursubdomain.no-ip.org:8520. Pingo our server is online too.

Modules, Apache comes with the most used modules enabled already, but personally I recommend you uncomment the rewrite_module, dav_module and dav_fs_module as you may need them in your development, from httpd.conf file again simply remove the hash “#” from the beginning of each of the lines (145, 146, 164), save and restart Apache. We will add some more modules later when we will need them for our programming languages.

Document Root, You may like to change your web document root also, which is currently under the Apache2 folder with the name htdocs, to do that we have to change to paths in httpd.conf you can find them by searching for “DocumentRoot”, you will find the DocumentRoot and the Directory directives that have to be changed. (careful with the reversed slashes), we will use the one we have created earlier for this purpose D:/webroot, save and restart Apache and check the results http://localhost:8520.

You will get 403 Forbidden message as you don’t have access to the root directory, or in other words you don’t have access to the directory listing of the web root folder, as this option is important for security reasons we will not change it, you can solve it by adding a simple html page in our webroot directory and name it index.html.

More information about installing Apache on Windows platform can be found online at Apache website.

MailEnable

MailEnable Standard Edition is a freeware mail server with fully functional POP and SMTP mail services, which will allow us to send emails from our local server, mainly by connecting to a local SMTP server.

With the simplicity of its install MailEnable needs only two configuration steps during the installation process:

  • Post office details, keep it simple, your name or your group name and a password, you will rarely need this.
  • Domain name, DNS servers and SMTP port, the domain name is the same No-IP hostname we have created yourdomainname.no-IP.org and your DNS should be already loaded there.

Note: If the DNS details are not mentioned automatically and you don’t know them, simply go to Start -> Run -> type “cmd” and run, type the command: “ipconfig /all” and you will get all the information you need, you will see two IPs for the DNS server(s) just copy them with a comma in the middle.

Finally the SMTP port, only if your ISP blocks this port change it, otherwise it’s much better to leave the default port, if you change this port you will have to change it every time you configure any mail function in your scripts.

MailEnable install configuration

To be sure you got your installation right, just run the “Diagnostic Utility” (if you have an antivirus it will prompt you for a virus, just ignore it as it is part of the diagnostic test and not a real virus), check the following items in the html result file and ensure that they have all their sub-items passed the test:

  • Host TCP/IP Settings
  • SMTP Configuration Test
  • SMTP Relay Settings
  • SMTP Inbound Bindings Test
  • SMTP Outbound Configuration

MailEnable is now installed successfully and any script that requires a mail server will use it as its SMTP server, it has many lovely features too, and a user friendly administration panel, you can find more about it on MailEnable - Standard Edition page online.

Summary

Now we have a local http server (Apache) and a mail server (MailEnable), available online (via No-IP) with our own hostname which we can access it from anywhere.

Part two of this article will cover the installation of a database server (MySQL), programming languages and their Apache modules, and then we are going to test them by trying some quick scripts too.

Comments

7

  1. dotone said..

    oh cool, you remind me of days I was in college and the early days of job hunting. Man this No-IP thingy let me down big time on an interview where I had all my stuff on my home server, thank god I memorized my IP :) then. But that was back then when connections were too slow max was ADSL 384KBit down and 128Kbit up.

    Now having a local server is for development environment. But now with the connections we recently got access to, it’s better be online directly after the staging and running on production server. I mean with tools and components of Zend IDE one no more needs to even code on the local environment, how much ever it is more convinient on local side.

    Btw, apache on windows always made me go mad on URL rewriting and Apache modules.

    Note on SMTP server, you could use the SMTP server that comes with you Window XP Professional, but u gotta tweak the authentications components.

    Oh man when is Static IP to become in a realistic price…. oh man they’re chargin 2500+ AED a month for it, add the bandwidth charges too and you’ll never think of going with hosting localy.

  2. Rida said..

    I agree with you, sometimes commercial solutions like Zend Studio can be better, and there are a lot more solutions out there, but I tried to setup a completely costless, simple to use environment, starting from servers ending by the editor, trying to avoid any Microsoft products like IIS or the SMTP provided with it, specially that I meant of this development environment to be for open source development so let it use open source tools too.

    As you said internet here is really very expensive not to mention the stupid censorship too, there are some alternatives like internet via satellite which is also expensive, personally I’m waiting a better vendor who respect the user more than his pocket.

  3. Rida said..

    Part 2 is now available.

  4. Rida Al Barazi » Blog Archive » Local Development Environment - Part 3 said..

    [...] After we had our WAMP local server setup done in Part 1 and Part 2, and booting it online via No-IP dynamic DNS service, it’s time now to talk about installing Ruby on Rails on our server and use Apache 2 along with FastCGI as the webserver for the first option and Mongrel for the second, we will also install few ruby libraries that are commonly used and ensure that they are working and functioning properly by installing a ready rails script. [...]

  5. SAURABH said..

    I HAV DONE EVERY THING AS U SAID
    BUT IT IS STILL NOT WORKING WHEN I PUT
    http://yoursubdomain.no-ip.org THEN IT WORKS WHEN SOME BODY AT REMOTE PLACE WANT TO ACCESS IT HE IS NOT ABLE TO DO THAT
    WHAT SHOULD I DO.
    hELP ME ITS URGENT

  6. Rida said..

    You shouldn’t use http://yoursubdomain.no-ip.org you should use the subdomain you have signed up with No-IP.

    Did you install the Dynamic Updater? is it showing any errors?

  7. alex said..

    hi nice site.

Leave a Reply

you can use these xhtml tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Articles Permanent Link