Project

General

Profile

RedmineInstallOSXLionServer » History » Revision 7

Revision 6 (Yudistira Asnar, 2012-06-16 16:47) → Revision 7/16 (Art Kuo, 2012-06-29 19:35)

h1. Installing Redmine on Mac OS X 10.7 Lion Server 

 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]]. 

 h2. Install Prerequisites  

 # Install Xcode/OS X Developer Tools 
 Either get XCode from the Mac App Store or register for a free account and download from: https://developer.apple.com/downloads/ 
 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. 
 # Install OS X MySQL and associated Libraries 
 Download http://www.mysql.com/downloads/mysql/ (select latest 64-bit version, e.g. 5.5.25) 
 Run the installation package .pkg file. This will install into /usr/local/mysql/bin 
 Run the MySQLStartupItem.pkg file to use GUI to start automatically after startup of your server. (Of course, command line also works.) 
 Open the MySQL.prefPane and install for all users. This provides a GUI for starting and stopping. (Of couse, command line also works.) 
 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: 
   @mysqladmin -u root password NEWPASSWORD@ (where your password substitutes for NEWPASSWORD) 
 Add MySQL to the path. In terminal: 
     @sudo touch /etc/paths.d/mysql@ (creates a file in which you type the path) 
     @sudo nano /etc/paths.d/mysql@ 
 In editor type @/usr/local/mysql/bin@ then save and exit 
 Enter startup options to tell the MySQL client and daemon to connect to the local server. In terminal: 
     @sudo nano /etc/my.cnf@ 
   In editor, add the following as appropriate: 
 <pre>[mysqld] 
 socket = /tmp/mysql.sock 
 [client] 
 socket = /tmp/mysql.sock</pre>     
 Install the MySQL binaries. Info about client libraries is available at http://support.apple.com/kb/HT4006 , or to download directly use 
 http://www.opensource.apple.com/other/MySQL-55.binaries.tar.gz (or latest version) 
	 @sudo tar -xzvf ~/Downloads/MySQL-55.binaries.tar.gz -C ~/Downloads@ 
 This will produce a root.tar archive, which must then also be extracted: 
	 @sudo tar -xzvf ~/Downloads/MySQL-55.binaries/MySQL-55.root.tar.gz -C /@ 
 If successful, tar should list the many files being placed in appropriate locations throughout the system 
 # Install "Phusion Passenger":http://www.modrails.com/install.html 
 This is a gem that handles Ruby on Rails applications and makes them accessible on the web server. 
	 @sudo gem install passenger@ 
	 @sudo passenger-install-apache2-module@ 
 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: 
 <pre>LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/ext/apache2/mod_passenger.so 
 PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.12 
 PassengerRuby /System/Library/Frameworks/Ruby.framework/Version/1.8/usr/bin/ruby@ 
 </pre> 
 It may also be helpful to specify the user that runs passenger, with the line 
 <pre>PassengerDefaultUser www</pre> 
 # Build and install Passenger Pref Pane 
 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 : 
 @cd ~/Downloads 
 git clone https://github.com/Fingertips/passengerpane/ 
 cd passengerpane 
 xcodebuild@ 
 (If you can't find xcodebuild, it may be in /usr/bin/xcodebuild) 
 Install the preference pane. Look in ~/Downloads/passengerpane/build/Release, and double-click on Passenger.prefPane to install it. 
 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 

 h2. Install Redmine 

 # Checkout Redmine 2 
	 @cd /Library/WebServer/Sites/@ 
 If the Sites directory doesn't exist, create it (@sudo mkdir /Library/WebServer/Sites@) 
	 @git clone https://github.com/redmine/redmine@ 
 # Configure Passenger 
	 Open /Library/WebServer/Sites in Finder 
	 Start Passenger preference pane in System Preferences 
	 Drag redmine folder to Passenger (you may have to 'click to make changes') 
	 Set "Address" to something like @redmine.local@ and click "Production" 
         Enter any aliases for the website, such as @your.server.com/redmine@ 
 # Setup Database with redmine user and database 
	 @mysql -u root -p@ 
 (Enter the MySQL root password when prompted) 
 Now enter the following into MySQL, substituting a password of your choice for MYPASSWORD: 
 <pre>create database redmine character set utf8; 
 create user 'redmine'@'localhost' identified by 'MYPASSWORD'; 
	 grant all privileges on redmine.* to 'redmine'@'localhost';</pre> 
 # Configure Redmine 
	 @cd /Library/WebServer/Sites/redmine 
	 sudo mkdir tmp public/plugin_assets 
         sudo chown -R www:www tmp public/plugin_assets log files 
    	 sudo chmod -R 755 files log tmp public/plugin_assets 
	 sudo cp config/database.yml.example config/database.yml@ 
 Edit database.yml, e.g. 
 <pre>production: 
   adapter: mysql 
   database: redmine 
   host: localhost 
   username: redmine 
   password: MYPASSWORD 
   socket: /tmp/mysql.sock</pre> 
 If necessary, do the same for configuration.yml, for example to set up email SMTP. 
 # Install appropriate gems 
 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 
   @sudo gem install bundler@ 
 Make sure you are in the redmine directory @cd /Library/WebServer/Sites/redmine@: 
 @sudo bundle install --without development test@ 
 (If you don't have imagemagick, also append @rmagick@ to the above line) 
 # Establish Defaults 
	 @sudo rake generate_secret_token 
	 sudo RAILS_ENV=production rake db:migrate 
	 sudo RAILS_ENV=production rake redmine:load_default_data@ 
 When prompted, enter the appropriate language (e.g. @en@ for English) and press enter. 
 Note: You may receive warning message "Please install RDoc". This does not appear to prevent successful installation. For redmine 1.4, use generate_session_store instead of generate_secret_token. enter 

 h2. Configure Apache to serve up Redmine 

 You may wish to try out using webrick first, but you can move straight to apache.  
 # 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@ 
 # Restart the web server 
 @sudo apachectl restart@ 
 Or, in Server.app, turn the web service off and then on.  
 Go to the Passenger prefPane and restart your redmine app 
 The site should now be visible, e.g. at redmine.local 
 To serve outside of local, instructions may be found "here":http://developer.apple.com/library/mac/#featuredarticles/PhusionRails/_index.html 
 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. 
 @ln -s /Library/WebServer/Sites/redmine/public /Library/Server/Web/Data/Sites/Default/redmine@ 
 edit the appropriate .conf file in /etc/apache2/sites, and under VirtualHost add @RailsBaseURI /redmine@ to point at the same location 

 h2. Notes 

 For automated installs, check out [[How to install Redmine in Linux Windows and OS X using BitNami Redmine Stack]] 
 The following references were helpful for compiling this howto:  
 http://macweb.cz/press/2012/01/28/instalace-redmine-na-mac-os-x-lion-server-10-7/ 
 [[RedmineInstallOSXServer]] for Snow Leopard Server 
 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. 
 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@.