Requirements: Installation

eriksundelof edited this page Dec 14, 2011 · 6 revisions

If you have a hosting provider, you need to contact them to see what they support.

Base specifications

These are the base specifications of the environment you need to be able to run SimpleBlog. Make sure you have the following installed on your server or local machine. For the server environment you need to be able to install gems either yourself or through your hosting provider.

  1. RubyGems 1.3.7
  2. Rails 2.3.8
  3. Memcached (no version requirement)
  4. MySQL (no version requirement)
  5. ImageMagick (no version requirement)

Installation Steps

Step 1: Install XCode

You will find XCode on the installation DVD or you can download it from http://www.apple.com

Step 2: Install Apache and MySQL

All Macs are shipped with both of Apache and MySQL installed. If you do already have these installed, you can skip this step. Check out the instructions here

Step 3: Install git

The easiest way to install git is to use Mac Ports. If you have that installed just run this command.

sudo port install git-core +bash_completion +doc

You can also compile it directly from source. You will find more on this at http://help.github.com/mac-git-installation/.

Step 4: Install Rails, Rubygems and MySQL support

Follow this excellent tutorial for how to install these under Mac OSX http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard

The installation of the mysql gem sometimes fail for that set of commands as you might be running the 64 bits version. If you are unsuccessful to install the gem, try this command:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Comment: If it still fails make sure the path to mysql_config is the right one.

Step 5: Install ImageMagick

Install these dependencies.

sudo port install libxml2
sudo port install ImageMagick
sudo gem install rmagick

Comment: This will take awhile.

Step 5: Install memcached

Simple Blog makes use memcached to efficiently cache the site. To install memcached on a Mac use these commands

sudo port install memcached 
memcached -d

Comment: Remember to always start the memcached daemon with memcached -d every time you restart your machine. Optionally you can add this to your startup scripts.

Step 6: OPTIONAL: Install Apache Passenger

Installing Apache Passenger is really easy but will simplify your Rails development tremendously.

  1. Run these commands in a Terminal:

    sudo gem install passenger sudo passenger-install-apache2-module

  2. Edit the Apache configuration file http.conf according to the in the Terminal printed instructions. You can find the httpd.conf by in a Terminal run:

    locate httpd.conf

  3. Edit the file /etc/hosts and add your domain there. For instance if you would like to be able to access your site as http://domain.local this is how your hosts file will typically look like.

    127.0.0.1 domain.local

  4. Add the Virtual Host entry to the Apache configs.

     <VirtualHost *>
    
     	ServerAdmin webmaster@domain.local
     	DocumentRoot "/project_path/public"
     	ServerName *.domain.local, domain.local
     	ServerAlias *.domain.local
     	RailsEnv development
     	ErrorLog "/private/var/log/apache2/domain.local-error_log"
     	CustomLog "/private/var/log/apache2/domain.local-access_log" common
    
     	RailsSpawnMethod smart
     	PassengerMaxPoolSize 1
     	PassengerLogLevel 3
     	PassengerMaxRequests 1500
     	PassengerUseGlobalQueue on
    
     	<Directory "/">
     		Options FollowSymLinks
     		AllowOverride None
     		Order allow,deny
     		Allow from all
     	</Directory>
    
     </VirtualHost>
    

Congratulations! You are done!