Skip to content

Instantly share code, notes, and snippets.

@moh-alsheikh
Created November 12, 2012 07:39
Show Gist options
  • Save moh-alsheikh/4058014 to your computer and use it in GitHub Desktop.
Save moh-alsheikh/4058014 to your computer and use it in GitHub Desktop.
INSTALL MYSQL , PASSENGER , CONFIGURE APACHE WITH PASSENGER SETUP NOTES
:: INSTALL MYSQL , PASSENGER , CONFIGURE APACHE WITH PASSENGER FOR MAC OS SETUP NOTES ::
1 - To install mysql in mac os you will need to run the following command ::
___________________________________________________
brew install mysql
___________________________________________________
== AFTER INSTALLING FINSHED YOU NEED TO READ THE FOLLWING INSTRUCTION
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
mysql_install_db --help
and view the MySQL documentation:
* http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
* http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html
To run as, for instance, user "mysql", you may need to `sudo`:
sudo mysql_install_db ...options...
Start mysqld manually with:
mysql.server start
Note: if this fails, you probably forgot to run the first two steps up above
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
To launch on startup:
* if this is your first install:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mysql/5.5.27/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
* if this is an upgrade and you already have the homebrew.mxcl.mysql.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
cp /usr/local/Cellar/mysql/5.5.27/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
You may also need to edit the plist to use the correct "UserName".
==============================================================================================================================
2- install phusion passenger module to apache2
___________________________________________________
passenger-install-apache2-module
___________________________________________________
== AFTER INSTALLING FINSHED YOU NEED TO COPY THE FOLLWING LINES TO APACHE CONFIGRATION FILE /etc/apache2/
___________________________________________________
LoadModule passenger_module /Users/mohammed/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
PassengerRoot /Users/mohammed/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18
PassengerRuby /Users/mohammed/.rvm/wrappers/ruby-1.9.3-p286/ruby
___________________________________________________
==============================================================================================================================
3 - Configure rails app for deployment by copy the following lines to apache configration file /etc/apache2/
and modify the paths to point to your peoject ::
___________________________________________________
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.empapp.com
ServerAdmin [email protected]
DocumentRoot /Users/mohammed/desktop/rubyonrails/practice/empapp/public
RailsEnv development
RailsAllowModRewrite off
<directory "/Users/mohammed/desktop/rubyonrails/practice/empapp/public">
Order allow,deny
Allow from all
</directory>
</VirtualHost>
___________________________________________________
Now just restart your apache server and enjoy your rails journey
sudo apachectl restart
Well Done !
==============================================================================================================================
==============================================================================================================================
SOME USEFUL COMMANDS
sudo apachectl start
sudo apachectl stop
sudo apachectl restart
==============================================================================================================================
==============================================================================================================================
WEB LINKS & NOTES
=================================================
http://stackoverflow.com/questions/4359131/brew-install-mysql-on-mac-os
http://railscasts.com/episodes/122-passenger-in-development
https://www.phusionpassenger.com/
=================================================
passenger & apache user guide
/Users/mohammed/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17/doc/Users guide Apache.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment