Title
Description
Body <p>I work at a web agency called Domain7 in Abbotsford, BC, Canada. It's a fun group of people to work with. I'm about a decade older than most of them. It helps keep my young. Domain7 has a suite of tools that the owner, Shawn Neumann has been developing for the last ten years, called RouteOne. The application and its components are written in Perl and developed in a Linux environment. Perl is a language that I have very little experience with. I once played around with MovableType. That's about it.</p> <p>I have been doing interface design for the Project Manager module of the system, and we have it to the point that our entire team has been using it to track time for Projects and Tickets. I like to be able to understand how the system works so I can add functionality in a way that works. To be able to help with the development of the application, I want to learn a little Perl to help me understand our templating system better. Also, I have some ideas about how we might be able to make things better by using XSLT as a templating engine for the system. I'm a big fan of open source and web standards, plus my experience with a web publishing application called Symphony has sold me on the idea of using XSLT to develop a much more flexible system for managing content.</p> <h3>Requirements</h3> <p>To that end, I wanted to set up a development environment for working on RouteOne, our suite of proprietary web tools and modules. To accomplish this, I needed Apache, MySQL, Perl and an Eclipse-based IDE with CVS support. Here are the steps I took to set up my system.</p> <p>I started with a fresh install of Mac OS X 10.5.3 on my Power Mac G5 booting off an external LaCie Firewire drive. This allows me to have a portable system, separate from the system I use for home use.</p> <h4>Hardware Overview</h4> <pre>Model Name: Power Mac G5 Model Identifier: PowerMac7,3 Processor Name: PowerPC G5 (3.0) Processor Speed: 2 GHz Number Of CPUs: 2 L2 Cache (per CPU): 512 KB Memory: 2 GB Bus Speed: 1 GHz Boot ROM Version: 5.2.4f1</pre> <h4>System Software Overview</h4> <pre>System Version: Mac OS X 10.5.3 (9D34) Kernel Version: Darwin 9.3.0</pre> <h3>Mac OS X Software</h3> <p>To start with, I don't need a whole lot as far as software goes. I can generally find free software for everything that I might want to do. I recommend the following if you want to go the free/open source route:</p> <h4>Free/Open Source Tools</h4> <ul> <li><a href="http://www.getfirefox.com/">Firefox</a> - web browser</li> <li><a href="http://getfirebug.com/">Firebug</a> - an indispensable Firefox web developer plugin</li> <li><a href="http://barebones.com/products/textwrangler/">TextWrangler</a> - text editor</li> <li><a href="http://aptana.com/studio/">AptanaStudio</a> - a nice open source IDE (integrated development environment)</li> <li><a href="http://cyberduck.ch/">Cyberduck</a> - FTP/SFTP client</li> <li><a href="http://www.mamp.info/">MAMP</a> - Apache, MySQL and PHP for Mac OS X</li> <li><a href="http://21degrees.com.au/products/symphony/">Symphony</a> - a web publishing system based on PHP, XML and XSLT</li> </ul> <h4>Commercial Tools</h4> <p>Panic produces two of what have become my favourite tools for web development. Also, Adobe Creative Suite 3 rounds out requirements as a graphic designer/web developer.</p> <ul> <li><a href="http://www.panic.com/transmit/">Transmit</a> - FTP/SFTP client</li> <li><a href="http://www.panic.com/coda/" title="One Window Web Development">Coda</a> - text editor, FTP client, terminal, css editor, browser</li> <li><a href="http://www.adobe.com/products/creativesuite/">Adobe Creative Suite</a> - Illustrator, Photoshop - graphics and image editing</li> </ul> <h3>Installation Procedure</h3> <p>The system I needed to set up required several Perl modules to be installed, in addition to Apache and MySQL. I decided, based on previous experience, that I was going to avoid using CPAN to install Perl modules as much as possible. I found that using MacPorts was much faster by far, and less prone to additional user input and errors resulting from missing dependencies.</p> <h4>Install MacPorts</h4> <p>According to the <a href="http://www.macports.org/">MacPorts</a> website:</p> <blockquote>The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system. To that end we provide the command-line driven MacPorts software package under a BSD License, and through it easy access to thousands of ports that greatly simplify the task of compiling and installing open-source software on your Mac.</blockquote> <p>Before installing MacPorts, it is required to install Apple's XCode Developer Tools and X11. This software is included on the install disks for the Mac. However, the latest version of <a href="https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=19897">XCode</a> is available for download from the <a href="http://developer.apple.com/">Apple Developer Connection</a>.</p> Download the appropriate MacPorts package installer. Run the package installer. When installed, open Terminal and run the following command to update MacPorts to the latest version:</p> <code><pre> sudo port -v selfupdate</pre></code> <h4>Install MySQL</h4> <p>Review instructions for <a href="http://dev.mysql.com/doc/refman/5.0/en/installation-overview.html">upgrading/installing MySQL</a></p> <p>Marc Liyanage provides a good set of instructions for <a href="http://www.entropy.ch/software/macosx/mysql/">installing and upgrading MySQL</a>. Download latest version of the <a href="http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg">Mac OS X package installer for MySQL 5.0</a>. Install MySQL by running the installer:</p> <code><pre> mysql-5.0.51b-osx10.4-powerpc.pkg</pre></code> <p>Install MySQL Startup Item by running the installer:</p> <code><pre> MySQLStartupItem.pkg</pre></code> <p>Install MySQL.prefPane:</p> <code><pre> /Library/PreferencePanes/MySQLStartupItem.pkg</pre></code> <p>Add aliases to .profile. (By the way, I am using TextWrangler here with the command line tools installed so that when I type <code>edit filename</code>, this will automatically open the file <code>filename</code> in TextWrangler for editing. One of the things I like about TextWrangler is its integration with Terminal in Mac OS X. As an alternative, use <code>nano</code> to edit this file. It will not be visible in the Finder because any file that starts with a <code>.</code> is a hidden file in the Finder. Use Terminal or an application such as TextWrangler, Transmit or Coda which can be enabled to view hidden or invisible files.)</p> <code><pre> cd ~ edit .profile</pre></code> <p>Add the following to the .profile</p> <code><pre> alias mysql=/usr/local/mysql/bin/mysql alias mysqladmin=/usr/local/mysql/bin/mysqladmin</pre></code> <p>Start up MySQL server:</p> <code><pre> sudo /usr/local/mysql/bin/mysqld_safe</pre></code> <p>Login to MySQL monitor</p> <code><pre> mysql -u root</pre></code> <p>Verify that MySQL server 5.0.51b is installed. Upon typing the above command in Terminal, you should receive a message similar to the welcome message below. You may want to follow the <a href="http://dev.mysql.com/doc/refman/5.0/en/user-account-management.html" title="MySQL User Account Management">recommended instructions</a> to change the root password and set up a new user.</p> <code><pre> Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.51b MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer.</pre></code> <p>To view the databases available to the root MySQL user, type the following at the <code>mysql></code> prompt</p> <code><pre> mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql> exit Bye</pre></code> <p>Shutdown MySQL server:</p> <code><pre> sudo /usr/local/mysql/bin/mysqladmin shutdown</pre></code> <h3>Install Apache 2.0 with MacPorts</h3> <p>Because I wanted to maintain an Apache install independent of the default Mac OS X Apache WebServer, I chose to use MacPorts, which installs into <code>/opt/local/apache2/</code>. Find the latest version of Apache from MacPorts:</p> <code><pre> port search apache</pre></code> <p>Find the latest port for Apache 2.8.8</p> <code><pre> apache2 www/apache2 2.2.8 The extremely popular second version of the Apache http server</pre></code> <p>Get more information on the Apache 2 port</p> <code><pre> port info apache2</pre></code> <p>List dependencies</p> <code><pre> port deps apache2</pre></code> <p>Install Apache 2.2.8</p> <code><pre> sudo port install apache2 fetch failed</pre></code> <p>Apache 2.2.9 has been released, so the old version is no longer available</p> <code><pre> http://trac.macports.org/ticket/15630</pre></code> <p>Install Apache 2.2.9</p> <code><pre> sudo env MASTER_SITE_LOCAL=http://distfiles.macports.org/apache2 port -v fetch apache2 sudo port install apache2</pre></code> <p>The install process provides feedback like this in Terminal:</p> <code><pre> ... ---> Verifying checksum(s) for apache2 ---> Extracting apache2 ---> Configuring apache2 ---> Building apache2 with target all ---> Staging apache2 into destroot ---> Creating launchd control script ########################################################### # A startup item has been generated that will aid in # starting apache2 with launchd. It is disabled # by default. Execute the following command to start it, # and to cause it to launch at startup: # # sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist ########################################################### Warning: apache2 requests to install files outside the common directory structure! ---> Installing apache2 2.2.9_1+darwin_9 ---> Activating apache2 2.2.9_1+darwin_9 ---> Cleaning apache2 </pre></code> <h3>Install Perl with MacPorts</h3> <p>Find the latest version of Perl from MacPorts:</p> <code><pre> port search perl</pre></code> <p>Find the port for Perl 5.8.8</p> <code><pre> perl5.8 lang/perl5.8 5.8.8 Perl 5.8.x - Practical Extraction and Report Language</pre></code> <p>Get more information on the Perl 5.8 port</p> <code><pre> port info perl5.8 perl5.8 5.8.8, Revision 2, lang/perl5.8 (Variants: darwin, threads, shared, darwin_8, darwin_9) http://www.perl.org/ Perl is a general-purpose programming language originally developed for text manipulation and now used for a wide range of tasks including system administration, web development, network programming, GUI development, and more. Platforms: darwin freebsd linux Maintainers: nomaintainer@macports.org</pre></code> <p>Install Perl 5.8.8</p> <code><pre> sudo port install perl5.8 Skipping org.macports.activate (perl5.8 +darwin_8) since this port is already active ---> Cleaning perl5.8</pre></code> <p>I believe Perl had already been installed as one of the dependencies of Apache.</p> <h3>Install Mod Perl Apache Module with MacPorts</h3> <p>Find the latest version of Perl from MacPorts:</p> <code><pre> port search perl</pre></code> <p>Find the port for mod_perl2</p> <code><pre> mod_perl2 www/mod_perl2 2.0.3 Embeds a Perl interpreter in the Apache2 server</pre></code> <p>Install mod_perl</p> <code><pre> sudo port install mod_perl2</pre></code> <h3>Stop Mac OS X WebServer</h3> <p>Stop the native web server to avoid conflicts with MacPorts version</p> <code><pre> sudo apachectl stop</pre></code> <p>A list of apachectl commands</p> <code><pre> start - start httpd stop - stop httpd restart - restart httpd if running by sending a SIGHUP or start if not running fullstatus - dump a full status screen; requires lynx and mod_status enabled status - dump a short status screen; requires lynx and mod_status enabled graceful - do a graceful restart by sending a SIGUSR1 or start if not running configtest - do a configuration syntax test help - this screen</pre></code> <h3>Modify the Apache Configuration file</h3> <p>Copy the sample configuration file</p> <code></pre> cd /opt/local/apache2/conf sudo cp httpd.conf.sample httpd.conf</pre></code> <p>Enable mod_perl in the httpd.conf file by adding the following line to httpd.conf</p> <code><pre> LoadModule perl_module modules/mod_perl.so</pre></code> <h4>Start MacPorts Apache2 </h4> <p>Start Apache with the following command</p> <code><pre> sudo /opt/local/apache2/bin/apachectl start</pre></code> <h4>Test Apache Server</h4> <p>Go to <a href="http://localhost/">http://localhost/</a>. If all went well, there should be a message in the browser window with the following message:</p> <blockquote>It works!</blockquote> <h3>Check out CVS project with AptanaStudio</h3> <p>Assuming AptanaStudio is already installed, documentation for CVS support can be found on the <a href="http://www.aptana.com/plugins">Aptana Plugins</a> page:</p> <blockquote> <p>CVS Support. This adds the Eclipse CVS plugins not bundled with Aptana Studio standalone.</p> <ol> <li>Go to the Update Manager in Aptana Studio via Help->Software Updates->Find and Install...</li> <li>Add a new Remote Update site to the following url: http://update.aptana.com/install/cvs/</li> <li>Install the Eclipse CVS feature from that update site</li> </ol> </blockquote> <p>In Aptana, create a new project</p> <code><pre> File > New > Project > CVS > Projects from CVS</pre></code> <h3>Install Perl Packages</h3> <p>Several Perl modules are available from the CPAN. On the Mac, it seems to be far easier to use MacPorts for as many modules as are available. These are the modules that were required that could be found at MacPorts, listed according to the commands used to install the packages:</p> <code><pre> sudo port install p5-archive-tar sudo port install p5-archive-zip sudo port install p5-authen-sasl sudo port install p5-bsd-resource sudo port install p5-bit-vector sudo port install p5-cache-cache sudo port install p5-class-singleton sudo port install p5-crypt-passwdmd5 sudo port install p5-module-build sudo port install p5-datetime sudo port install p5-date-calc sudo port install p5-digest sudo port install p5-digest-hmac sudo port install p5-email-valid sudo port install p5-file-mmagic sudo port install p5-html-parser sudo port install p5-html-tree sudo port install p5-libwww-perl sudo port install p5-mailtools sudo port install p5-mime-lite sudo port install p5-module-install sudo port install p5-net-telnet sudo port install p5-soap-lite sudo port install p5-string-crc32 sudo port install p5-text-csv sudo port install p5-timedate sudo port install p5-time-piece sudo port install p5-time-modules sudo port install p5-xml-simple sudo port install p5-cgi-simple sudo port install p5-mail-imapclient sudo port install p5-xml-rss sudo port install p5-perl-ldap sudo port install ImageMagick +perl </pre></code> <p>I found a few more packages that might aid in developing an XSLT templating solution for our suite of tools</p> <code><pre> sudo port install p5-xml-libxml sudo port install libxslt sudo port install p5-xml-libxslt </pre></code> <p>Those packages I could not find in MacPorts, I installed using <a href="http://cpan.org/">CPAN</a>, the Comprehensive Perl Archive Network. Mac OS X comes installed with Perl, along with a command line program, <code>cpan</code>, for installing Perl modules. Running the first <code>cpan</code> command begins an initialization process. I initialized it with all the default settings, by pressing the <em>Return</em> button when prompted to select an option, and ignoring any missing software.</p> <code><pre> sudo cpan -i Crypt::Util sudo cpan -i Net::FTPServer::XferLog sudo cpan -i Chart::Graph::Gnuplot sudo cpan -i Math::FixedPrecision sudo cpan -i Net::LDAP sudo cpan -i SOAP::Amazon::S3 sudo cpan -i MIME::WordDecoder sudo cpan -i DBI sudo cpan -i DBD::mysql</pre></code> <h3>Configure Apache</h3> <p>To configure Apache to run Perl scripts in a specific directory, edit the configuration file.</p> <code><pre> edit httpd.conf</pre></code> <p>Then add directives for each directory:</p> <code><pre> ### Perl directories: execute scripts in these directories <Directory "/opt/local/apache2/htdocs/perl/*"> Options Indexes FollowSymLinks +ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> <Directory "/opt/local/apache2/htdocs/symperl/*"> Options Indexes FollowSymLinks +ExecCGI AllowOverride All Order allow,deny Allow from all </Directory></pre></code> <h3>Running Multiple Apache Web Servers</h3> <p>To be able to run the default Mac OS X Web Server, the MacPorts Apache 2 Web Server, and MAMP simultaneously, I can run each server on a different port. For the MacPorts server, I modified the Apache configuration file to run the server on port 3000.<p> <code><pre> cd /opt/local/apache2/conf edit httpd.conf</pre></code> <p>Look for a line that directs the server to run on the default port, port 80:</p> <code><pre> Listen 80</pre></code> <p>Then, to run the server on port 3000, change the line to this:</p> <code><pre> Listen 3000</pre></code> <p>To have completely separate installs of Apache, including separate MySQL installs, I should also install MySQL using MacPorts. That way, I can have multiple instances of MySQL running on different ports. However, that seems a little overkill (if this whole setup doesn't already). So, that's my development environment.</p>
Section Tutorials Contact Journal About Home
Category Applications Design History Ideas Technology
Tags
Date
DesignProjectX | The digital sandbox of Stephen Bau