RedmineInstallOSXLionServer » History » Version 4

Art Kuo, 2012-06-02 03:00

1 1 Art Kuo
h1. Installing Redmine on Mac OS X 10.7 Lion Server
2 1 Art Kuo
3 4 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 [[RedmineInstallOSXLionServer|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 3 Art Kuo
25 3 Art Kuo
socket = /tmp/mysql.sock
26 3 Art Kuo
27 3 Art Kuo
socket = /tmp/mysql.sock</pre>    
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 1 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 3 Art Kuo
<pre>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 3 Art Kuo
43 2 Art Kuo
It may also be helpful to specify the user that runs passenger, with the line
44 3 Art Kuo
<pre>PassengerDefaultUser www</pre>
45 2 Art Kuo
# Build and install Passenger Pref Pane
46 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": :
47 2 Art Kuo
@cd ~/Downloads
48 2 Art Kuo
git clone
49 2 Art Kuo
cd passengerpane
50 2 Art Kuo
51 2 Art Kuo
(If you can't find xcodebuild, it may be in /usr/bin/xcodebuild)
52 2 Art Kuo
Install the preference pane. Look in ~/Downloads/passengerpane/build/Release, and double-click on Passenger.prefPane to install it.
53 2 Art Kuo
An alternative is to download a pre-compiled build for 10.7, e.g. "SoftwhisperSL-PassengerPrefPane":
54 1 Art Kuo
55 2 Art Kuo
h2. Install Redmine
56 1 Art Kuo
57 2 Art Kuo
# Checkout Redmine 2
58 1 Art Kuo
	@cd /Library/WebServer/Sites/@
59 2 Art Kuo
If the Sites directory doesn't exist, create it (@sudo mkdir /Library/WebServer/Sites@)
60 2 Art Kuo
	@git clone
61 1 Art Kuo
# Configure Passenger
62 2 Art Kuo
	Open /Library/WebServer/Sites in Finder
63 1 Art Kuo
	Start Passenger preference pane in System Preferences
64 1 Art Kuo
	Drag redmine folder to Passenger (you may have to 'click to make changes')
65 2 Art Kuo
	Set "Address" to something like @redmine.local@ and click "Production"
66 2 Art Kuo
        Enter any aliases for the website, such as
67 2 Art Kuo
# Setup Database with redmine user and database
68 1 Art Kuo
	@mysql -u root -p@
69 2 Art Kuo
(Enter the MySQL root password when prompted)
70 2 Art Kuo
Now enter the following into MySQL, substituting a password of your choice for MYPASSWORD:
71 2 Art Kuo
@create database redmine character set utf8;
72 2 Art Kuo
create user 'redmine'@'localhost' identified by 'MYPASSWORD';
73 2 Art Kuo
	grant all privileges on redmine.* to 'redmine'@'localhost';@
74 1 Art Kuo
# Configure Redmine
75 2 Art Kuo
	@cd /Library/WebServer/Sites/redmine
76 2 Art Kuo
	sudo mkdir tmp public/plugin_assets
77 2 Art Kuo
        sudo chown -R www:www tmp public/plugin_assets log files
78 2 Art Kuo
    	sudo chmod -R 755 files log tmp public/plugin_assets
79 1 Art Kuo
	sudo cp config/database.yml.example config/database.yml@
80 2 Art Kuo
Edit database.yml, e.g.
81 3 Art Kuo
82 1 Art Kuo
  adapter: mysql
83 1 Art Kuo
  database: redmine
84 1 Art Kuo
  host: localhost
85 1 Art Kuo
  username: redmine
86 2 Art Kuo
  password: MYPASSWORD
87 3 Art Kuo
  socket: /tmp/mysql.sock</pre>
88 2 Art Kuo
If necessary, do the same for configuration.yml, for example to set up email SMTP.
89 2 Art Kuo
# Install appropriate gems
90 2 Art Kuo
Optional: It helps to have imagemagick, which can be installed with @brew install imagemagick@ if you use "Mac Homebrew":
91 3 Art Kuo
  @sudo gem install bundler@
92 2 Art Kuo
Make sure you are in the redmine directory @cd /Library/WebServer/Sites/redmine@:
93 3 Art Kuo
@sudo bundle install --without development test@
94 2 Art Kuo
(If you don't have imagemagick, also append @rmagick@ to the above line)
95 1 Art Kuo
# Establish Defaults
96 2 Art Kuo
	@sudo rake generate_secret_code
97 2 Art Kuo
	sudo RAILS_ENV=production rake db:migrate
98 2 Art Kuo
	sudo RAILS_ENV=production rake redmine:load_default_data@
99 2 Art Kuo
When prompted, enter the appropriate language (e.g. @en@ for English) and press enter
100 1 Art Kuo
101 2 Art Kuo
h2. Configure Apache to serve up Redmine
102 1 Art Kuo
103 2 Art Kuo
You may wish to try out using webrick first, but you can move straight to apache. 
104 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@
105 2 Art Kuo
# Restart the web server
106 2 Art Kuo
@sudo apachectl restart@
107 2 Art Kuo
Or, in, turn the web service off and then on. 
108 2 Art Kuo
Go to the Passenger prefPane and restart your redmine app
109 2 Art Kuo
The site should now be visible, e.g. at redmine.local
110 2 Art Kuo
To serve outside of local, instructions may be found "here":
111 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.
112 1 Art Kuo
@ln -s /Library/WebServer/Sites/redmine/public /Library/Server/Web/Data/Sites/Default/redmine@
113 2 Art Kuo
edit the appropriate .conf file in /etc/apache2/sites, and under VirtualHost add @RailsBaseURI /redmine@ to point at the same location
114 2 Art Kuo
115 1 Art Kuo
h2. Notes
116 2 Art Kuo
117 2 Art Kuo
For automated installs, check out [[How to install Redmine in Linux Windows and OS X using BitNami Redmine Stack]]
118 1 Art Kuo
The following references were helpful for compiling this howto: 
119 2 Art Kuo
120 2 Art Kuo
[[RedmineInstallOSXServer]] for Snow Leopard Server
121 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.
122 3 Art Kuo
Probably a better idea to use PostgreSQL instead of installing MySQL, which is no longer provided by Apple with OS X Server. There are also alternative methods to install MySQL, such as @brew install mysql@.