Project

General

Profile

RedmineInstallOSXLionServer » History » Version 5

Art Kuo, 2012-06-02 06:58

1 1 Art Kuo
h1. Installing Redmine on Mac OS X 10.7 Lion Server
2
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
# 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: https://developer.apple.com/downloads/
9
An alternative is the latest version of Command Line Tools for XCode https://developer.apple.com/downloads . 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 http://www.mysql.com/downloads/mysql/ (select latest 64-bit version, e.g. 5.5.25)
12
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
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":http://www.mysql.com/products/workbench/. Or from the command line:
16
  @mysqladmin -u root password NEWPASSWORD@ (where your password substitutes for NEWPASSWORD)
17
Add MySQL to the path. In terminal:
18
    @sudo touch /etc/paths.d/mysql@ (creates a file in which you type the path)
19
    @sudo nano /etc/paths.d/mysql@
20
In editor type @/usr/local/mysql/bin@ then save and exit
21
Enter startup options to tell the MySQL client and daemon to connect to the local server. In terminal:
22
    @sudo nano /etc/my.cnf@
23 1 Art Kuo
  In editor, add the following as appropriate:
24 3 Art Kuo
<pre>[mysqld]
25
socket = /tmp/mysql.sock
26
[client]
27
socket = /tmp/mysql.sock</pre>    
28 2 Art Kuo
Install the MySQL binaries. Info about client libraries is available at http://support.apple.com/kb/HT4006 , or to download directly use
29
http://www.opensource.apple.com/other/MySQL-55.binaries.tar.gz (or latest version)
30
	@sudo tar -xzvf ~/Downloads/MySQL-55.binaries.tar.gz -C ~/Downloads@
31
This will produce a root.tar archive, which must then also be extracted:
32
	@sudo tar -xzvf ~/Downloads/MySQL-55.binaries/MySQL-55.root.tar.gz -C /@
33
If successful, tar should list the many files being placed in appropriate locations throughout the system
34
# Install "Phusion Passenger":http://www.modrails.com/install.html
35
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
	@sudo passenger-install-apache2-module@
38
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/mod_passenger.so
40 2 Art Kuo
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.12
41
PassengerRuby /System/Library/Frameworks/Ruby.framework/Version/1.8/usr/bin/ruby@
42 3 Art Kuo
</pre>
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
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":http://www.fngtps.com/passenger-preference-pane are not compatible with 10.7, so it is necessary to "build":http://think.gregorybowers.com/post/8032492180/getting-passengerpane-to-work-in-lion-for-twerps-like :
47
@cd ~/Downloads
48
git clone https://github.com/Fingertips/passengerpane/
49
cd passengerpane
50
xcodebuild@
51
(If you can't find xcodebuild, it may be in /usr/bin/xcodebuild)
52
Install the preference pane. Look in ~/Downloads/passengerpane/build/Release, and double-click on Passenger.prefPane to install it.
53
An alternative is to download a pre-compiled build for 10.7, e.g. "SoftwhisperSL-PassengerPrefPane":http://macweb.cz/press/wp-content/uploads/2012/01/SoftwhisperSL-PassengerPrefPane-OSX10.7-6c7197b.tar.gz
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
	@git clone https://github.com/redmine/redmine@
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
	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
        Enter any aliases for the website, such as @your.server.com/redmine@
67
# 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
Now enter the following into MySQL, substituting a password of your choice for MYPASSWORD:
71 5 Art Kuo
<pre>create database redmine character set utf8;
72 2 Art Kuo
create user 'redmine'@'localhost' identified by 'MYPASSWORD';
73 5 Art Kuo
	grant all privileges on redmine.* to 'redmine'@'localhost';</pre>
74 1 Art Kuo
# Configure Redmine
75 2 Art Kuo
	@cd /Library/WebServer/Sites/redmine
76
	sudo mkdir tmp public/plugin_assets
77
        sudo chown -R www:www tmp public/plugin_assets log files
78
    	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
<pre>production:
82 1 Art Kuo
  adapter: mysql
83
  database: redmine
84
  host: localhost
85
  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
# Install appropriate gems
90
Optional: It helps to have imagemagick, which can be installed with @brew install imagemagick@ if you use "Mac Homebrew":https://github.com/mxcl/homebrew/wiki/installation
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
	sudo RAILS_ENV=production rake db:migrate
98
	sudo RAILS_ENV=production rake redmine:load_default_data@
99
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
# Go to Server.app, 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
# Restart the web server
106
@sudo apachectl restart@
107
Or, in Server.app, turn the web service off and then on. 
108
Go to the Passenger prefPane and restart your redmine app
109
The site should now be visible, e.g. at redmine.local
110
To serve outside of local, instructions may be found "here":http://developer.apple.com/library/mac/#featuredarticles/PhusionRails/_index.html
111
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
115 1 Art Kuo
h2. Notes
116 2 Art Kuo
117
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
http://macweb.cz/press/2012/01/28/instalace-redmine-na-mac-os-x-lion-server-10-7/
120
[[RedmineInstallOSXServer]] for Snow Leopard Server
121
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@.