Websites/Mozilla.org/Archive/MAC OSX Stage Setup
This setup was conducted on an Intel Mac running OS X 10.5.8 which was the latest version of Leopard at the time of this writing. 10.6 (Snow Leopard) has just come out but, this setup has not been tested on Snow Leopard.
Most of the really big pieces needed to run a site are built in to OS X. The majority of the work to get a development version of mozilla.org running is configuring these things. There shouldn't be any reason why both OS X 10.4 (Tiger) and 10.6 (Snow Leopard) shouldn't also work right out of the box with these instructions and a little coaxing.
Testing this guide on Tiger and Snow Leopard is highly appreciated!
Email me if you find any problems or have any changes to suggest.
Tools Included in OSX
- OSX 10.5 comes with Apache 2.0.x
- OSX 10.5 comes with PHP 5.2.x
Need to Install
- Collabnet Subversion Binaries
- Simplest and fastest way to get
svnrunning if you don't already have it.
- Collabnet Subversion for OSX (Universal Binary 10.4+) Download
Typing into Terminal:
Should output the following if you installed SVN correctly:
svn, version 1.6.5 (r38866) compiled Sep 5 2009, 10:55:17 Copyright (C) 2000-2009 CollabNet. Subversion is open source software, see http://subversion.tigris.org/ This product includes software developed by CollabNet (http://www.Collab.Net/).
- virtualhost.sh by Patrick Gibson
- An ingenious little time-saver for OSX and Ubuntu that will make a /etc/hosts entry and setup apache in one easy step.
- To install merely download and put virtualhost.sh in ~/Sites/ or somewhere in your path like /usr/bin/
Checkout from SVN
cd ~ mkdir src cd src svn co http://svn.mozilla.org/projects/mozilla.org/trunk mozilla.dev
There are over eleven thousand files in the trunk directory so it's gonna take a while. While you wait for that to finish downloading, continue this guide in a new terminal window.
Setup a Virtual Host in Apache
While SVN is downloading, open a new terminal window.
cd ~/Sites sudo virtualhosts.sh mozilla.dev
Enter your password and things should look like below.
Create http://mozilla.dev/? [Y/n]: Creating a virtualhost for mozilla.dev... + Adding mozilla.dev to /etc/hosts... done + Checking for /Users/eman/Sites/mozilla.dev... not found - Use /Users/eman/Sites/mozilla.dev as the virtualhost folder? [Y/n] + Creating folder /Users/eman/Sites/mozilla.dev... done + Creating virtualhost file... done + Flushing cache... done + Restarting Apache... done http://mozilla.dev/ is setup and ready for use. Launching virtualhost... done
The working directory,
~/src/mozilla.org has the files that we want Apache to serve up on the domain
http://mozilla.dev. Apache is expecting that directory at
~/Sites/mozilla.dev so we will make a symbolic link (or symlink) where the code actually is to where Apache expects it to be.
cd ~/Sites/ rm -rf mozilla.dev ln -sv ~/src/mozilla.org mozilla.dev
mozilla.dev -> /Users/username/src/mozilla.org
Wait for SVN to finish downloading before continuing
Copy the config.inc.php-dist to the right filename.
cd ~/src/mozilla.org/includes cp config.inc.php-dist config.inc.php
Open the configuration file in your text editor of choice. Find the line with the hostname setting and enter the mozilla.dev.
$config['server_name'] = 'mozilla.dev';
Find the line with the file_root setting and enter /Users/username/src/mozilla.org
$config['file_root'] = '/Users/username/src/mozilla.org';
Prime the Feed Parser Pump
cd ~/src/mozilla.org/includes sudo ./feed-parser.php -c ./feed-parser-config.xml
As is the UNIX way, you know you did it right if the script doesn't say anything.
This is setup to be done manually but, you could schedule a cron job or in the case of OS X 10.5+ (Leopard) by using a launchd script.
Edit the mozilla.dev Apache Configuration
/private/etc/apache2/virtualhosts/mozilla.dev in your favorite editor or
The virtualhost setup has already done most of the work. We're just going to add some directives from the README file in the root directory.
First, set the server aliases. Even though the README says www.mozilla.dev and *.www.mozilla.dev but, that will screw up our local install.
ServerName mozilla.dev ServerAlias *.mozilla.dev
Add the rest of the directives from the README
## Directives from the README AddType application/x-httpd-php .php .html DirectoryIndex index.php index.html Options -Indexes RewriteEngine On RewriteMap toupper int:toupper ## END README Directives
Comment out all the other things that virtualhosts.sh gave us. Less directives means less things to troubleshoot if something goes wrong. The full mozilla.dev Apache conf is below.
# Created Sat Sep 5 17:02:18 PDT 2009 <VirtualHost *:80> DocumentRoot /Users/username/Sites/mozilla.dev ServerName mozilla.dev ServerAlias *.mozilla.dev ## Directives from the README AddType application/x-httpd-php .php .html DirectoryIndex index.php index.html Options -Indexes RewriteEngine On RewriteMap toupper int:toupper ## END README Directives #ScriptAlias /cgi-bin /Users/username/Sites/mozilla.dev/cgi-bin # <Directory /Users/username/Sites/mozilla.dev> # Options All # AllowOverride All # Order allow,deny # Allow from all # </Directory> </VirtualHost>