Project

General

Profile

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
3
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
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 2 Art Kuo
@[mysqld]
25 1 Art Kuo
    socket = /tmp/mysql.sock
26
    [client]
27 2 Art Kuo
    socket = /tmp/mysql.sock@    
28
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 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
@LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
40
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
It may also be helpful to specify the user that runs passenger, with the line
43
@PassengerDefaultUser www@
44
# Build and install Passenger Pref Pane
45
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 :
46
@cd ~/Downloads
47
git clone https://github.com/Fingertips/passengerpane/
48
cd passengerpane
49
xcodebuild@
50
(If you can't find xcodebuild, it may be in /usr/bin/xcodebuild)
51
Install the preference pane. Look in ~/Downloads/passengerpane/build/Release, and double-click on Passenger.prefPane to install it.
52
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
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
	@git clone https://github.com/redmine/redmine@
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
	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
        Enter any aliases for the website, such as @your.server.com/redmine@
66
# 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
Now enter the following into MySQL, substituting a password of your choice for MYPASSWORD:
70
@create database redmine character set utf8;
71
create user 'redmine'@'localhost' identified by 'MYPASSWORD';
72
	grant all privileges on redmine.* to 'redmine'@'localhost';@
73 1 Art Kuo
# Configure Redmine
74 2 Art Kuo
	@cd /Library/WebServer/Sites/redmine
75
	sudo mkdir tmp public/plugin_assets
76
        sudo chown -R www:www tmp public/plugin_assets log files
77
    	sudo chmod -R 755 files log tmp public/plugin_assets
78
	sudo cp config/database.yml.example config/database.yml@
79
Edit database.yml, e.g.
80
@production:
81 1 Art Kuo
  adapter: mysql
82
  database: redmine
83
  host: localhost
84
  username: redmine
85 2 Art Kuo
  password: MYPASSWORD
86
  socket: /tmp/mysql.sock@
87
If necessary, do the same for configuration.yml, for example to set up email SMTP.
88
# Install appropriate gems
89
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
90
  @sudo gem install bundler
91
Make sure you are in the redmine directory @cd /Library/WebServer/Sites/redmine@:
92
sudo bundle install --without development test@
93
(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
	sudo RAILS_ENV=production rake db:migrate
97
	sudo RAILS_ENV=production rake redmine:load_default_data@
98
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
# 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@
104
# Restart the web server
105
@sudo apachectl restart@
106
Or, in Server.app, turn the web service off and then on. 
107
Go to the Passenger prefPane and restart your redmine app
108
The site should now be visible, e.g. at redmine.local
109
To serve outside of local, instructions may be found "here":http://developer.apple.com/library/mac/#featuredarticles/PhusionRails/_index.html
110
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
@ln -s /Library/WebServer/Sites/redmine/public /Library/Server/Web/Data/Sites/Default/redmine@
112
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
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
http://macweb.cz/press/2012/01/28/instalace-redmine-na-mac-os-x-lion-server-10-7/
119
[[RedmineInstallOSXServer]] for Snow Leopard Server
120
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.