Difference between revisions of "InstallingAboutUsOnOSX"

(Added instructions for updating to 64-bit on snow leopard)
(Added instructions to 64-bit section for apache and php)
Line 82: Line 82:
 
> sudo port upgrade --enforce-variants installed
 
> sudo port upgrade --enforce-variants installed
  
 
+
# rebuild ruby as x86_64
# now, rebuild ruby as x86_64
 
 
> cd /www/source/ruby-1.8.7-p22
 
> cd /www/source/ruby-1.8.7-p22
 
> make
 
> make
 
> sudo make install
 
> sudo make install
 +
 +
# rebuild apache
 +
> cd /www/source/httpd-2.2.10
 +
> ./configure --prefix=/www  --enable-modules=most  --enable-mods-shared=all \
 +
    --enable-info  --enable-rewrite  --enable-so  --with-program-name=apache2 \
 +
    --enable-ssl  --enable-header  --enable-proxy  --enable-proxy-http  \
 +
    --with-ssl=/opt/local
 +
> make
 +
> make install
  
 
# download and install x86_64 mysql binaries
 
# download and install x86_64 mysql binaries
Line 99: Line 107:
 
> sudo ln -s mysql-5.0.86-osx10.5-x86_64 mysql
 
> sudo ln -s mysql-5.0.86-osx10.5-x86_64 mysql
 
> sudo mysqld_safe &
 
> sudo mysqld_safe &
 +
 +
# rebuild php
 +
> cd /www/source/php-5.2.6
 +
>./configure --prefix=/www --with-mysql=/usr/local/mysql --without-iconv \
 +
    --with-apxs2=/www/bin/apxs
 +
# edit the Makefile and add -lresolv to the EXTR_LIBS section (ie EXTRA_LIBS = -lresolv -lmysqlclient ... )
 +
> mate Makefile
 +
> make
 +
> make install
  
 
# build mysql ruby bindings from source as the current gem has a bug
 
# build mysql ruby bindings from source as the current gem has a bug

Revision as of 23:38, 8 October 2009

Xcode tools

Git

Dev environment

(Includes precompiled Apache, PHP, Ruby, and all necessary libraries and extensions)

Copy Base Files

  • Download au_dev_environment.dmg from nimbus and open the image file.
  • Copy [dev image]/opt and [dev image]/www to /
  cp -r /Volumes/AboutUs\ dev\ environment/www /Volumes/AboutUs\ dev\ environment/opt /

Configure your environment

  • Edit your ~/.profile (or ~/.bashrc) and append the lines from [dev image]/profile
  • Restart any open terminal sessions.
  • Append the following line to /etc/hosts:
127.0.0.1 compostus

Update git repositories

  • In /www/aboutus/www, and /www/aboutus/compostus edit the .git/config file and change the URL for the 'origin' remote to
<email>15bb9cd2f75f14e2b92c6ec81bd372cb</email>:AboutUs/compostus.git
  • Run 'git pull' in each of the above directories:
  • Clone electric_sheep into /www/aboutus/electric_sheep
  git clone <email>15bb9cd2f75f14e2b92c6ec81bd372cb</email>:AboutUs/electric_sheep.git /www/aboutus/electric_sheep

Setup MySQL

  • Copy mysql-5.0.67-osx10.5-x86 to /usr/local
  • Run the following commands to set up mysql:
cd /usr/local
sudo ln -s mysql-5.0.67-osx10.5-x86 mysql
sudo chown -R _mysql /usr/local/mysql/data
sudo mysqld_safe (If you haven't start your mysql)


Install gem requirements

  • Update rubygems and geminstaller
  sudo gem update --system
  sudo gem update geminstaller
  • Add github as a gem source
  gem source -a http://gems.github.com/
  • (optional) Disable generation of rDoc and ri documentation to speed up the gem install process by editing ~/.gemrc to include
  gem: --no-rdoc --no-ri
  • Go to /www/aboutus/compostus/compost and run geminstaller as root. This will standarized all gems needed to run AboutUs.

MacPorts

  • Libraries copied over as part of dev environment install process should work fine.
  • However, the MacPorts installation is partially broken and won't install new libraries. To fix this, reinstall MacPorts (available at http://www.macports.org/install.php). This won't remove or overwrite existing libraries.
  • Do this after existing dev environment has been installed.

Rebuild for 64-bit

  • If you're on Snow Leopard, you may find problems with gems with native extensions. This is because the dev image binaries are 32-bit, but your gems will likely build as 64-bit. RubyInline in particular will be broken.
  • To fix things, you need everything consistently 32-bit or 64-bit. I have not found a way to force gems to build as 32-bit, so here's how to migrate to 64-bit binaries.
  • gd2 however does not work with 64-bit ruby
# in /opt/local/etc/macports/variants.conf add this line to build all ports in
# both 32-bit and 64-bit. It's slower but it should limit compatibility issues.
+universal

# n the shell, rebuild all ports:
# some ports with lots of dependencies (ie ncurses) may fail. You likely can ignore this,
# or use the various force commands to overcome the dependency cycles
> sudo port upgrade --enforce-variants installed

# rebuild ruby as x86_64
> cd /www/source/ruby-1.8.7-p22
> make
> sudo make install

# rebuild apache
> cd /www/source/httpd-2.2.10
> ./configure --prefix=/www   --enable-modules=most   --enable-mods-shared=all \
     --enable-info   --enable-rewrite   --enable-so   --with-program-name=apache2 \
     --enable-ssl   --enable-header   --enable-proxy   --enable-proxy-http  \
     --with-ssl=/opt/local
> make
> make install

# download and install x86_64 mysql binaries
> cd /www/source
> sudo port install wget
> sudo wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.86-osx10.5-x86_64.tar.gz/from/http://mysql.he.net/
> tar xvfz mysql-5.0.86-osx10.5-x86_64.tar.gz
> sudo mysqladmin -u root shutdown
> sudo cp -r mysql/data mysql-5.0.86-osx10.5-x86_64/
> sudo chown -R _mysql mysql-5.0.86-osx10.5-x86_64/data
> sudo rm mysql
> sudo ln -s mysql-5.0.86-osx10.5-x86_64 mysql
> sudo mysqld_safe &

# rebuild php
> cd /www/source/php-5.2.6
>./configure --prefix=/www --with-mysql=/usr/local/mysql --without-iconv \
    --with-apxs2=/www/bin/apxs
# edit the Makefile and add -lresolv to the EXTR_LIBS section (ie EXTRA_LIBS = -lresolv -lmysqlclient ... )
> mate Makefile
> make
> make install

# build mysql ruby bindings from source as the current gem has a bug
> cd /www/source
> sudo wget http://tmtm.org/downloads/mysql/ruby/mysql-ruby-2.8.1.tar.gz
> sudo tar xvfz mysql-ruby-2.8.1.tar.gz
> cd mysql-ruby-2.8.1
> make
> sudo make install

# now rebuild all gems to update to 64-bit for native extensions
> sudo gem pristine --all

# and clear out any cached rubyinline object files
> rm -rf ~/.ruby_inline

Oddities

  • If vim is acting strangely, remove the MacPorts version--the built-in OS X version works much better. Do so by running
port uninstall vim
  • If you are asked for an SSL password when starting the dev server, try 'default'

Build from scratch

Don't do this, it is many times more effort. If we somehow lose the dev environment image, here are partially correct instructions on how to rebuild from scratch: InstallingAboutUsOnOSXFromScratch.



Retrieved from "http://aboutus.com/index.php?title=InstallingAboutUsOnOSX&oldid=19763320"