Fritz Thomas

Web Dev Appliance

Gentoo PHP Web Development Appliance for VMware

Download WebDev Appliance

Version 1.1: Download
Size: 1.4GB
md5: fe1d6f6b90fd9a859cd8c6fbe669bf8b
WebDev Appliance on VMware Marketplace




I made this appliance because i needed a small appliance, small enough to store it on a USB Stick, because i am developing on my desktop PC and from time to time on my laptop when i am on train. So i wanted to have the same “server” environment for all my projects, wherever i am.

My Needs were (basically):

  • Gentoo Hardened 2007.0 (No need, but i like it because its very flexible)
  • Apache 2
  • PHP 5
  • MySQL 5
  • fop
  • pdftk
  • per vhost configuration. PHP, Java Runtime Environment and different versions of executeables and scripts.
  • Zend Framework
  • PEAR

Its was essential for me to have different Virtual Hosts, with each different configurations for PHP settings and Environment Variables. So i build the webserver application stack with apache2 mod_suxec and mod_fcgi and build php as cgi. With this configuration i am possible to configure each Virtual Host with different settings and run each virtual host with different uid and/or gid. (Thank you to Johannes Truschnigg) Another requirement was, to run different versions of fop and pdftk (or any other executable) in each virtual host. To have this ability, in every vhost root directory is a ‘bin/’ directory, where all executeables, needed from this vhost, should be. Each Virtual Host is configured with a FCGI Wrapper File and a different PATH Environment Variable. In this PATH Variable the ‘bin/’ directory of the virtual host is the first path and the path to the ‘bin/’ directory in the users home directory is the second path. So you can have different different sets of configuarations and different versions of executeables for each vhost and user.

Some imaginable Use Cases are:
#1: In host1.local you need fop in version 0.94 and in host2.local you want fop in version 0.20.5. (fop is only an placeholder for any executable in this example)
#2: For host1.local you want the Zend Debugger extension, in all other hosts you want the xdebug extension.
#3: For an older application, installed on host1.local, you need register_globals set to on. On all other hosts you want to leave this option off (default).
#4: A host which is a zend framework application needs a class which is currently in the incubator svn repository. Another host needs the zend framework in the preview version 0.60 and another host needs the latest version of the Zend Framework.

Perhaps its helpful for you too. Please let me know what you think. Your feedback is welcome. :-) Contact me


Let`s start

User Logins and Passwords

Linux Users

User: root
Password: devdev

Login via ssh as root is not allowed, login with develop instead and call ‘su’

Development-User: develop
Password: devdev

MySQL Users

User: root
Password: devdev
phpmyadmin is already installed in default vhost.


Vhost Administration

To start, login via ssh with User ‘develop’. After the password prompt you get asked if you want to attach a screen session.
For more information about screen read this screen howto or this
screen howto in german language.

To help manage and administrate each vhost, i`ve created some scripts. This scripts are only available as user ‘develop’:

  • vhost-create
  • vhost-delete
  • vhost-update

Each vhost you create or update with this scripts have the same directory layout. The master files for each created host are in ‘/var/www/skel’. You can change the files in it, add files or directories as you want. The basic vhost directory layout should look something like this:

develop@develop ~ $ ls -l /var/www/skel/
total 20
drwxr-xr-x 2 develop develop 4096 Jan  8 19:31 bin
drwxr-xr-x 3 develop develop 4096 Jan  8 19:33 conf
drwxr-xr-x 2 develop develop 4096 Dec 27 14:35 logs
drwxr-xr-x 2 develop develop 4096 Dec 27 14:35 tmp
drwxr-xr-x 4 develop develop 4096 Dec 27 14:35 www
develop@develop ~ $ ls -lR /var/www/skel/
/var/www/skel/:
total 20
drwxr-xr-x 2 develop develop 4096 Jan  8 19:31 bin
drwxr-xr-x 3 develop develop 4096 Jan  8 19:33 conf
drwxr-xr-x 2 develop develop 4096 Dec 27 14:35 logs
drwxr-xr-x 2 develop develop 4096 Dec 27 14:35 tmp
drwxr-xr-x 4 develop develop 4096 Dec 27 14:35 www
 
/var/www/skel/bin:
total 0
 
/var/www/skel/conf:
total 12
drwxr-xr-x 2 develop develop 4096 Jan 11 20:38 php
-rwxr--r-- 1 develop develop 1621 Dec 27 11:19 vhost.conf
-rwxr--r-- 1 develop develop  325 Jan  8 19:32 wrapper.fcgi
 
/var/www/skel/conf/php:
total 48
-rwxr--r-- 1 develop develop 46286 Jan 11 12:43 php.ini
 
/var/www/skel/logs:
total 0
 
/var/www/skel/tmp:
total 0
 
/var/www/skel/www:
total 8
drwxr-xr-x 2 develop develop 4096 Dec 27 14:35 htdocs
drwxr-xr-x 2 develop develop 4096 Dec 27 14:35 includes
 
/var/www/skel/www/htdocs:
total 4
-rwxr--r-- 1 develop develop 14 Dec 27 11:19 info.php
 
/var/www/skel/www/includes:
total 0

vhost-create

It creates a new vhost. Just call vhost-create with no paramters. Its very simple and asks you some questions. Then it copies the “template” directory (/var/www/skel) to the vhost destination in /var/www/domains with the name you entered before. As default convention, every new vhost has the domain name suffix .local as ServerName. To change this to an existing domain name in your network (e.g.: [HOSTNAME].home.lan), change the vhost.conf file in the vhost template directory (/var/www/skel/conf/vhost.conf).

vhost-delete

Just call it and enter the name of the vhost you want to delete.

vhost-update

Use it if you changed a template file in /var/www/skel and you want to update some vhosts with this new configurations. Use this script if you changed something in /var/www/skel and you want to update one or more vhosts with this changes. Just call it, enter the name of the vhost, ready.

FOR ALL STEPS ABOVE ITS NECESSARY TO RESTART APACHE AFTERWARDS, SO CHANGES ARE EFFECTIVE !


Access Vhosts over the network

To access the files of a created host with an IDE (Integrated Development Environment) like Zend Studio or Zend Studio for Eclipse, the home directory of ‘develop’ and the directory ‘/var/www/’ is exported via NFS and Samba.
If you use Linux, access your hosts via NFS. Therefore you have to mount the directory /var/www:

thomas@gentoo ~ $ mount 192.168.199.128:/var/www /home/thomas/development

Do you use Windows? Access your vhosts over the network neighbourhood, or Map a new Network Drive to “\\192.168.199.128\www”. Use the above username (develop) and password to get access.


Librarys and Frameworks

The Zend Framework is preinstalled in /var/www/librarys/ZendFramework. I checked out the svn trunk and the incubator in different directorys. Change your include_path within your bootstrap file to the location you want.
You can use more Librarys and Frameworks like Cake, Symfony or SolarPHP. Put this frameworks into a subdirectory of /var/www/librarys and then change the include_path.



Configuration

Timezone is set to GMT. Read this how to change your timezone.
Keymap is set to “us”. Change it in /etc/conf.d/keymaps.
If you want to send email from your development appliance you have to change the mailhub config value in /etc/ssmtp/ssmtp.conf to a mail relay which accepts you.
Networking is set to dhcp. If you want to change this, take a look in /etc/conf.d/net.
For all other configuration related topics take a look at the Gentoo Handbook.

rc-update show

develop develop # rc-update show
             apache2 |      default
            bootmisc | boot
             checkfs | boot
           checkroot | boot
               clock | boot
         consolefont | boot
            hostname | boot
             keymaps | boot
               local |      default nonetwork
          localmount | boot
             modules | boot
               mysql |      default
            net.eth0 |      default
              net.lo | boot
            netmount |      default
                 nfs |      default
             portmap |      default
           rmnologin | boot
               samba |      default
                sshd |      default
           syslog-ng |      default
             urandom | boot
          vixie-cron |      default

make.conf

develop@develop ~ $ cat /etc/make.conf
CFLAGS="-O2 -march=i686 -pipe -fomit-frame-pointer -fforce-addr"
CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
MAKEOPTS="-j2"
FEATURES="parallel-fetch noinfo"
#GENTOO_MIRRORS="http://gentoo.inode.at/"
INPUT_DEVICES="keyboard vmmouse"
VIDEO_CARDS="vmware fbdev vesa"
PORTAGE_TMPFS="/dev/shm"
USE="-X -xorg -alsa -oss -esd -dbus -truetype -acl -nls -doc -gpm -ipv6 -ftp -qt -qt3 -qt4 -kde -gnome -gtk -gtk2 -snmp -mailwrapper -cups -samba -ldap apache2 utf8 threads memlimit logrotate mmx nptl posix tcpd readline sasl sse ssl sysvipc unicode zlib X509 x86 bash-completion vim-syntax crypt sse2 pcre jpeg jpeg2k xvid xml"
APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias"
APACHE2_MPMS="prefork"

Portage package.use

develop@develop ~ $ cat /etc/portage/package.use
dev-java/xmlgraphics-commons jpeg
dev-lang/php cgi -calendar force-cgi-redirect filter gd -imap suhosin mysqli mysql bcmath bzip2 ctype curl exif inifile json -ldap mhash mcrypt mbstring pdo session simplexml soap sqlite tidy cli xml xmlrpc xmlreader xmlwriter xsl zip mysql sockets gmp spl reflection ftp iconv sqlite -apache2
sys-devel/gcc gcj
virtual/editor bash-completion perl python
net-fs/samba automount syslog acl async
sys-libs/glibc userlocales
#www-servers/apache mpm-prefork
www-servers/apache -threads suexec
dev-util/subversion -apache2 -ruby java -perl python -nowebdav
dev-libs/cyrus-sasl -ldap
dev-libs/apr-util mysql sqlite sqlite3
media-gfx/imagemagick bzip2 jpeg jpeg2k mpeg png tiff truetype xml
media-libs/jasper jpeg
media-video/ffmpeg a52 aac encode imlib network ogg truetype vorbis
media-libs/imlib2 gif bzip2 mp3 png tiff

Portage World File (Installed Software)

develop develop # cat /var/lib/portage/world
app-admin/syslog-ng
app-misc/screen
app-portage/gentoolkit
app-text/pdftk
dev-db/mysql
dev-java/fop
dev-java/java-config
dev-java/xmlgraphics-commons
dev-lang/php
dev-libs/apr-util
dev-php/PEAR-PEAR
dev-util/cvs
dev-util/subversion
media-gfx/imagemagick
media-video/ffmpeg
net-analyzer/ngrep
net-dns/bind-tools
net-fs/nfs-utils
net-fs/samba
net-misc/dhcpcd
net-misc/neon
net-misc/ntp
net-misc/openvpn
sys-apps/paxctl
sys-apps/slocate
sys-boot/grub
sys-devel/gcc
sys-fs/sysfsutils
sys-kernel/genkernel
sys-kernel/hardened-sources
sys-kernel/hardened-sources:2.6.22-r8
sys-kernel/hardened-sources:2.6.23-r4
sys-process/lsof
sys-process/vixie-cron
virtual/libstdc++:3.3
www-apache/mod_fcgid
www-servers/apache

Notice

This appliance is not intended for productive use. Its not tested and has not yet approved for this purpose. If you want to use this as a basis for a productive use, you can but – you should make your own tests and changes. Again, the purpose for this appliance for development!! If you use this appliance you do it at your own risk and you are responsible for any damage.

  • Digg
  • del.icio.us
  • DZone
  • MisterWong
  • Reddit
  • Slashdot
  • Technorati
  • Google Bookmarks
  • Facebook
  • Twitter
  • Yahoo! Bookmarks
  • Yigg
  • LinkedIn
  • MySpace
  • PDF
  • RSS


Latest Tweets