Skip to main content
Jump to: navigation, search

Eclipse Server Sandbox Setup

Revision as of 16:42, 11 November 2008 by (Talk | contribs)

This page replaces its predecessor, Eclipse Server Sandbox Setup (Archived).


This page documents how to set up your local Linux system to spoof most of the ( and infrastructure in order to test - in a sandbox - changes to your web and downloads content.

Thanks to Neil Skypuch for the initial setup work.

You will need to be root for most of the steps below.


To make your local machine think it's add this line to /etc/hosts (or c:\windows\system32\drivers\etc\hosts):

Note that in order for your machine to browse to the REAL servers, you will need to remove this line. You could set up a simple toggle script like this:

if [ ! -f /etc/hosts.spoof ]; then # create a copy of the current hosts file
  cp  /etc/hosts /etc/hosts.spoof; 
else # switch hosts and hosts.spoof
  # assume that hosts and hosts.spoof are different, otherwise this is a meaningless exercise
  mv /etc/hosts /etc/hosts.1;
  mv /etc/hosts.spoof /etc/hosts;
  mv /etc/hosts.1 /etc/hosts.spoof;

Install xampp

Rather than worrying about installing apache, php, mysql, and so forth, you can simply install xampp.

Apache2 configuration

Out of the box, xampp's apache2 instance runs as user nobody:nobody; you may want to run as apache:www so that you can share your workspace files w/ the webserver. In /opt/lampp/etc/httpd.conf, change this

# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
User nobody
Group nobody

... to this ...

User apache
Group www

Next, make sure this user and group exist. You can use adduser or useradd and addgroup or groupadd to add them. Then make sure that you and the web user are both in the www group. Edit your /etc/group file:


If you want to spoof different web content for,,, etc., you'll need vhost directories so that each server has a different server root. See Eclipse_Server_Sandbox_Setup_(Archived)#Apache2_configuration.

Restart Apache2

/etc/init.d/httpd restart
  - or -
/opt/lampp/lampp restart

If you already have an /etc/init.d/http for apache2, not for lampp, you can replace it with this:

# start up xampp
/opt/lampp/lampp $1
exit $RETVAL

Phoenix content

Extract from CVS and put it in the root of your webserver:

cd /opt/lampp/htdocs; \
cvs -d -Q ex -r HEAD -d org.eclipse.phoenix/

Repeat for any vhosts you've got set up, or use symlinks.

Web content

You can checkout the content from CVS and put it into the htdocs folder(s), or you can check out the content in Eclipse and symlink your checked out projects from the htdocs folder. If symlinking, make sure that the user running the webserver (apache:www) can read into your home dir & workspace folder!

Checkout directly

This is handy for maintaining a mirror server (eg., an internal build server which contains the same files as on Changes you make to code - once committed back to CVS - can be updated running cvs update in the htdocs folder. This can be run as a cronjob at some regular interval.

cd /opt/lampp/htdocs/; \
cvs -d -Q co -d modeling www/modeling

This is also useful for editing code on a machine which does not have an X server running or on which you don't have Eclipse installed. After making changes to code, simply check it back in to cvs.

cd /opt/lampp/htdocs/; \
cvs -d -Q co -d modeling www/modeling

vi modeling/somefile.php

cvs -d -Q ci "modeling/somefile.php" -m "[bug#] some commit comment"

Symlink workspace projects

This is handy for sandbox testing of code changes on your local workstation. Every change you make in Eclipse to your code will immediately be reflected on your local webserver.

cd /opt/lampp/htdocs/; ln -s ~/workspace/modeling

Back to the top