Monday 31 August 2009

Setting Up Your Own Testing Server

Call it what you like, a "testbed", a "testing server", a "sandbox server", it all amounts to the same thing - a server for testing your sites, scripts, databases before you "go live".

When it comes to web design I prefer to use Dreamweaver (in conjunction with Flash, Fireworks and occasionally Photoshop). And when it comes to static websites that's all fine, you can test them in Dreamweaver by hitting F12 and getting a preview in your browser. But for more advanced sites this will not do...

3 good reasons why you need a testing server

Going beyond static sites, to sites that include server-side scripts (such as PHP or Perl (CGI)) or database connections such as discussion forums, content management systems or shopping carts, it is really useful having a place to test before you "go live". Having your own server allows you to regularly test as you develop without long upload times, and without your client getting glimpses of half finished work.

It's also great for designers wanting to learn or improve their dynamic web skills. So you want to learn some PHP? So you want to learn how to get Flash to talk to a database? So you want to practice setting up and customising a content management system or shopping cart? You're going to need a server - it's a handy place to practice without needing to buy webspace.

Finally, if you want to use Dreamweaver's testing server facility when you set up your site in the "manage sites" window... you need a testing server.

Admittedly, if you have a website of your own you could use your own website host for testing and practice by shoving it in a folder separate from the rest of your site. But this is far from ideal, since your testing site will be running from a folder below the web root, when you intend to run it from the web root when you "go live". Much better is to test it as it will run when live.

Relax

I confess that if I had not learned what I now know, the whole idea of setting up a server would be enough to send me back to bed for another couple of hours. It sounds complex, but some very clever and generous people have made it much easier than it used to be - read on.

Before we go any further - LAMP or WAMP?

Before we go further let me introduce the server platforms I will be discussing today - LAMP and WAMP.

L - Linux
A - Apache
M - MySQL
P - PHP

or

W - Windows
A - Apache
M - MySQL
P - PHP

You will already be aware that Linux and Windows are operating systems, and really that is the only major distinction between the platforms above.

Apache is FREE open source web server software.

MySQL is FREE open source database server software.

PHP is a FREE open source server-side scripting language/engine.

Loads of websites run on LAMP or WAMP. Loads of web hosting companies use LAMP or WAMP to host websites commercially. In fact, last time I checked, Apache was the most installed web server in the world.

Loads of free web software runs on LAMP or WAMP too:

PhpBB
Zen Cart
Joomla
Drupal
Moodle
To name but a few...

All free and all running on free server software. At some point I guarantee you will want to install at least one of these for a client or for your own use, you need some practice, you will need to test it as you "skin" or "theme" it, you need a testing server running Apache, MySQL and PHP.

(Although I am not going to explain commercial alternatives in this post, you should be aware that you don't have to use FREE open source server software, a popular proprietary alternative would be Microsoft's Internet Information Server (IIS), MSSQL a database server and ASP or ASP.NET for server-side scripting. The drawback is that this all requires a commercial license. the other drawback it that I won't be explaining these today.)

A couple of approaches

There are probably many approaches you can take, but I am going to discuss what are to me 2 of the easiest options:

1. Install a server on your development computer
2. Set-up a server using an old computer

Let's start with the first...

Install a server on your development computer - WAMP

This is my least favourite of the two options, but if you want something quick, and you don't have an old computer kicking around it's a good alternative. I use a Windows XP machine for web design and development, so this solution is effectively a WAMP solution.

The easiest way is to get a pre-configured bundle of Apache, MySQL and PHP and install it as an application onto your Windows machine. There are several free options, but I recommend:


or


Setting-up

Download the installer, run it, and voila, you are done.

The installer sets up all the server software you need, and creates a web root folder. To test your site all you need to do is copy the files into the web root folder and start browsing. Your new installation of Apache, MySQL and PHP will process files in or below the web root folder as though they were on a web server (in fact they are on a web server at this point).

Couldn't be simpler.

Although I have used this type of approach many moons ago with Apache Triad, and while it is quick and easy, I recently built a server on a totally separate computer, rather than installing it on my development machine, and I prefer it - I guess I just don't like to clutter my graphics workstation up with too much other software (it's sucking my resources dry man, I can feel it) - just a little harmless paranoia. Which brings me to...

Set-up a server using an old computer - LAMP - the "real deal"

I did this just last week as the culmination of sporadic research over several months. You might think that setting up your own server hardware and software is the stuff of IT technitians and not the realm of designers, and depending on the type of designer you are, or your background you may still want to leave it to your techie friend. But I managed it so I urge you to read on.

And of course the great thing about this approach is that you are not making a simulation of a web server, you will end up with an actual web server in every sense. Stick it in a datacentre and you really could use it to host yours and your clients websites and email (if you wanted), this is the "real deal".

And being the "real deal" it has several advantages:

1. More than one person can use it as a testing server simultaneously - which makes it ideal for web design studios with several designers, and ideal for schools/colleges/universities/education allowing more than one student to upload and test their projects.

2. Each user can have their own login and testing server space. In fact each project can have it's own server space and login.

3. FTP, HTTP, HTTPS, PHP and MySQL all work the way they should.

As a testing server it is ideal because it is a real server.

There are loads of LAMP options out there, but being designers, not technitians we want one that is:

1. Easy to set-up
2. Easy to operate once set-up
3. Free - we're on a budget

Which, after my research and experience, leaves me with one option that ticks all boxes:


It is described as a turnkey solution (meaning it is as easy as turning a key to get up and running) and it really is straightforward.

Setting-up

1. Is your network suitable?

Before we go any further you need to check that you are the right kind of network to have a server. Answer the following questions with a "YES" and you can go ahead:

Do you have a network hub or router with a spare LAN socket?
Do your other computers connect to the hub or router using ethernet cable or wireless?
Does the router connect to your broadband connection?

If you answered "YES" to all 3 questions, then you can go ahead. Hoorah.

2. Get your machine

First you need an old computer that works, but which you no longer need. the computer should have at least the following:

Processor (CPU): Reasonable speed
RAM: At least 256Mb
HDD (at least 40Gb)
Graphics Card: (spec irrelevant)
Network Card: 10/100 Mbps
Other Drives: Floppy, CD ROM

The higher the spec the better, but don't worry too much, I am running a working testing server with BlueOnyx on the following very low spec machine:

Processor: PII 266MHz
RAM: 256Mb
HDD: 80Gb
Graphics: 8Mb
Network Card: 10/100 Mbps
Other Drives: Floppy, CD ROM
Sound: None

And it all works like a dream. The fact is that my testing server doesn't have to put up with much load. It won't be experiencing thousands of visitors, only me, and in most situations a testing server probably won't have more simulaneous users than the number of designers using it. Obviously, the more users the the better your computer needs to be but the main areas of concern are:

HDD - Improve this to hold more files

RAM and Processor - Improve these to handle more simultaneous visitors

Web servers DO NOT need a good graphics card, they spend most of their time without a monitor plugged in because they are managed over the web via a web browser or shell client. Nor do they need a sound card.

3. Check you don't need it

Make sure you really don't need the machine for anything else.

Make sure you don't need any of the information on the Hard Drive. What we do next will wipe it completely. You will lose all data, software, downloads, accounts information, everything.

If you are using an old windows machine with an OEM Windows XP sticker on it, you need to know that we will be wiping Windows off the machine, and you won't be able to transfer the Windows licence to another machine. OEM licenses stay with the machine.

Are you sure you can spare this machine?

OK, let's move on.

4. Set up the machine for install

For installation you need to temporarily hook up a monitor and keyboard to the computer you plan to use. Make sure it has power but don't turn it on yet. Make sure it is connected to your network hub via the ethernet port in the network card.

5. Download and burn the BlueOnyx server set-up disk

The BlueOnyx set-up disc needs downloading as an ISO file and then burning to a blank CD.

Download the ISO file here:


Once downloaded you need to burn the ISO to a blank CD.

If you don't have software to burn the ISO to a blank CD, I recommend:


Burn baby burn.

6. Install the server software

This is the really exciting bit. Your old computer becomes useful again as a testing server.

Open the CD ROM drawer and insert the set-up disc.

Reboot the machine.

Booting from CD :-)

In most cases your computer will check the CD drive first, to see if it can boot from CD. If this is the case follow the on-screen prompts until installation is complete.

MAKE SURE you write down or remember usernames, passwords and IP addresses you put in during installation. You will need them later.

Not booting from CD :-(

You will know if the computer does not boot from CD if you see Windows starting up, or nothing happens and it complains it cannot boot. If this is the case you need to make sure the computer boots from the CD ROM drive before it boots from HDD by changing the "boot order" or "boot priority" in the BIOS.

Do this by pressing reset or restarting the machine, then hitting the F8 or F10 keys as soon as it starts booting up (a note on the screen should tell you which key).

Then the BIOS menu will appear and you need to hunt around for the "boot order" or "boot priority" and set CD or Optical Drive to be FIRST.

I would show you in detail but all BIOS menus are different (get your techie friend to help if you are not sure).

7. After installation

Once the server has finished installing (you will know because it will reboot and tell you to remove the CD) it is ready to begin acting like a server.

At this point you can unhook the monitor and then find a place where it won't get in anybody's way and plug it into the network there and switch it back on.

After a few minutes it will have booted up and you will be able to access the server via the web browser of any computer on the network and finish the set-up.

To do this simply input the IP address you gave to the server into your web browser.

You will then get lovely web interface to the server and be able to finish setting up.

And that's a wrap

At this point you have a web server. Look out for a future post on how to set-up "sites" on the server so you can test your work.

If you want to have a go on your own. Check my next post.

No comments:

Post a Comment