RedmineInstallOSXLionServer » History » Version 2

Art Kuo, 2012-06-02 02:49

1 1 Art Kuo
h1. Installing Redmine on Mac OS X 10.7 Lion Server
2 1 Art Kuo
3 1 Art Kuo
This is a quick summary of the necessary steps for a simple install of Redmine on Apple OS X Lion Server 10.7. It is meant only as a supplement, not a replacement, to the official install guide found here.
4 1 Art Kuo
5 2 Art Kuo
h2. Install Prerequisites 
6 1 Art Kuo
7 1 Art Kuo
# Install Xcode/OS X Developer Tools
8 2 Art Kuo
Either get XCode from the Mac App Store or register for a free account and download from:
9 2 Art Kuo
An alternative is the latest version of Command Line Tools for XCode . This is a smaller download and contains all that is necessary for installation.
10 1 Art Kuo
# Install OS X MySQL and associated Libraries
11 2 Art Kuo
Download (select latest 64-bit version, e.g. 5.5.25)
12 2 Art Kuo
Run the installation package .pkg file. This will install into /usr/local/mysql/bin
13 1 Art Kuo
Run the MySQLStartupItem.pkg file to use GUI to start automatically after startup of your server. (Of course, command line also works.)
14 1 Art Kuo
Open the MySQL.prefPane and install for all users. This provides a GUI for starting and stopping. (Of couse, command line also works.)
15 2 Art Kuo
Set the root password for your new installation of MySQL. One way is to use the "MySQLWorkbench": Or from the command line:
16 2 Art Kuo
  @mysqladmin -u root password NEWPASSWORD@ (where your password substitutes for NEWPASSWORD)
17 2 Art Kuo
Add MySQL to the path. In terminal:
18 2 Art Kuo
    @sudo touch /etc/paths.d/mysql@ (creates a file in which you type the path)
19 2 Art Kuo
    @sudo nano /etc/paths.d/mysql@
20 2 Art Kuo
In editor type @/usr/local/mysql/bin@ then save and exit
21 2 Art Kuo
Enter startup options to tell the MySQL client and daemon to connect to the local server. In terminal:
22 2 Art Kuo
    @sudo nano /etc/my.cnf@
23 1 Art Kuo
  In editor, add the following as appropriate:
24 2 Art Kuo
25 1 Art Kuo
    socket = /tmp/mysql.sock
26 1 Art Kuo
27 2 Art Kuo
    socket = /tmp/mysql.sock@    
28 2 Art Kuo
Install the MySQL binaries. Info about client libraries is available at , or to download directly use
29 2 Art Kuo (or latest version)
30 2 Art Kuo
	@sudo tar -xzvf ~/Downloads/MySQL-55.binaries.tar.gz -C ~/Downloads@
31 2 Art Kuo
This will produce a root.tar archive, which must then also be extracted:
32 2 Art Kuo
	@sudo tar -xzvf ~/Downloads/MySQL-55.binaries/MySQL-55.root.tar.gz -C /@
33 2 Art Kuo
If successful, tar should list the many files being placed in appropriate locations throughout the system
34 2 Art Kuo
# Install "Phusion Passenger":
35 2 Art Kuo
This is a gem that handles Ruby on Rails applications and makes them accessible on the web server.
36 1 Art Kuo
	@sudo gem install passenger@
37 1 Art Kuo
	@sudo passenger-install-apache2-module@
38 2 Art Kuo
The apache2 module installation will ask you to add several lines to the apache configuration file. For the standard Lion Server, the file is /etc/apache2/httpd.conf . Typical lines to add are:
39 2 Art Kuo
@LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/ext/apache2/
40 2 Art Kuo
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.12
41 2 Art Kuo
PassengerRuby /System/Library/Frameworks/Ruby.framework/Version/1.8/usr/bin/ruby@
42 2 Art Kuo
It may also be helpful to specify the user that runs passenger, with the line
43 2 Art Kuo
@PassengerDefaultUser www@
44 2 Art Kuo
# Build and install Passenger Pref Pane
45 2 Art Kuo
This is a GUI interface for the Mac, to make it easy to add Ruby on Rails applications. Many of the binary prefPanes on the "web": are not compatible with 10.7, so it is necessary to "build": :
46 2 Art Kuo
@cd ~/Downloads
47 2 Art Kuo
git clone
48 2 Art Kuo
cd passengerpane
49 2 Art Kuo
50 2 Art Kuo
(If you can't find xcodebuild, it may be in /usr/bin/xcodebuild)
51 2 Art Kuo
Install the preference pane. Look in ~/Downloads/passengerpane/build/Release, and double-click on Passenger.prefPane to install it.
52 2 Art Kuo
An alternative is to download a pre-compiled build for 10.7, e.g. "SoftwhisperSL-PassengerPrefPane":
53 1 Art Kuo
54 2 Art Kuo
h2. Install Redmine
55 1 Art Kuo
56 2 Art Kuo
# Checkout Redmine 2
57 1 Art Kuo
	@cd /Library/WebServer/Sites/@
58 2 Art Kuo
If the Sites directory doesn't exist, create it (@sudo mkdir /Library/WebServer/Sites@)
59 2 Art Kuo
	@git clone
60 1 Art Kuo
# Configure Passenger
61 2 Art Kuo
	Open /Library/WebServer/Sites in Finder
62 1 Art Kuo
	Start Passenger preference pane in System Preferences
63 1 Art Kuo
	Drag redmine folder to Passenger (you may have to 'click to make changes')
64 2 Art Kuo
	Set "Address" to something like @redmine.local@ and click "Production"
65 2 Art Kuo
        Enter any aliases for the website, such as
66 2 Art Kuo
# Setup Database with redmine user and database
67 1 Art Kuo
	@mysql -u root -p@
68 2 Art Kuo
(Enter the MySQL root password when prompted)
69 2 Art Kuo
Now enter the following into MySQL, substituting a password of your choice for MYPASSWORD:
70 2 Art Kuo
@create database redmine character set utf8;
71 2 Art Kuo
create user 'redmine'@'localhost' identified by 'MYPASSWORD';
72 2 Art Kuo
	grant all privileges on redmine.* to 'redmine'@'localhost';@
73 1 Art Kuo
# Configure Redmine
74 2 Art Kuo
	@cd /Library/WebServer/Sites/redmine
75 2 Art Kuo
	sudo mkdir tmp public/plugin_assets
76 2 Art Kuo
        sudo chown -R www:www tmp public/plugin_assets log files
77 2 Art Kuo
    	sudo chmod -R 755 files log tmp public/plugin_assets
78 2 Art Kuo
	sudo cp config/database.yml.example config/database.yml@
79 2 Art Kuo
Edit database.yml, e.g.
80 2 Art Kuo
81 1 Art Kuo
  adapter: mysql
82 1 Art Kuo
  database: redmine
83 1 Art Kuo
  host: localhost
84 1 Art Kuo
  username: redmine
85 2 Art Kuo
  password: MYPASSWORD
86 2 Art Kuo
  socket: /tmp/mysql.sock@
87 2 Art Kuo
If necessary, do the same for configuration.yml, for example to set up email SMTP.
88 2 Art Kuo
# Install appropriate gems
89 2 Art Kuo
Optional: It helps to have imagemagick, which can be installed with @brew install imagemagick@ if you use "Mac Homebrew":
90 2 Art Kuo
  @sudo gem install bundler
91 2 Art Kuo
Make sure you are in the redmine directory @cd /Library/WebServer/Sites/redmine@:
92 2 Art Kuo
sudo bundle install --without development test@
93 2 Art Kuo
(If you don't have imagemagick, also append @rmagick@ to the above line)
94 1 Art Kuo
# Establish Defaults
95 2 Art Kuo
	@sudo rake generate_secret_code
96 2 Art Kuo
	sudo RAILS_ENV=production rake db:migrate
97 2 Art Kuo
	sudo RAILS_ENV=production rake redmine:load_default_data@
98 2 Art Kuo
When prompted, enter the appropriate language (e.g. @en@ for English) and press enter
99 1 Art Kuo
100 2 Art Kuo
h2. Configure Apache to serve up Redmine
101 1 Art Kuo
102 2 Art Kuo
You may wish to try out using webrick first, but you can move straight to apache. 
103 2 Art Kuo
# Go to, select the Web service, and add a new website. For example domain name @redmine.local@, and store site files in @/Library/WebServer/Sites/redmine/public@
104 2 Art Kuo
# Restart the web server
105 2 Art Kuo
@sudo apachectl restart@
106 2 Art Kuo
Or, in, turn the web service off and then on. 
107 2 Art Kuo
Go to the Passenger prefPane and restart your redmine app
108 2 Art Kuo
The site should now be visible, e.g. at redmine.local
109 2 Art Kuo
To serve outside of local, instructions may be found "here":
110 2 Art Kuo
For example, to serve as a subdomain from your main server, do the following. First, link the redmine directory into the directory where Server stores files in, e.g.
111 2 Art Kuo
@ln -s /Library/WebServer/Sites/redmine/public /Library/Server/Web/Data/Sites/Default/redmine@
112 2 Art Kuo
edit the appropriate .conf file in /etc/apache2/sites, and under VirtualHost add @RailsBaseURI /redmine@ to point at the same location
113 1 Art Kuo
114 2 Art Kuo
h2. Notes
115 2 Art Kuo
116 1 Art Kuo
For automated installs, check out [[How to install Redmine in Linux Windows and OS X using BitNami Redmine Stack]]
117 2 Art Kuo
The following references were helpful for compiling this howto: 
118 2 Art Kuo
119 2 Art Kuo
[[RedmineInstallOSXServer]] for Snow Leopard Server
120 2 Art Kuo
This same procedure also works for Redmine 1.4. Installation for 1.4+ is made vastly easier by the gem bundler, which ensures the appropriate gem versions are maintained.