Created
June 15, 2011 06:08
-
-
Save huobazi/1026578 to your computer and use it in GitHub Desktop.
rails passenger apache sphinx install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$(whoami)" != "root" ]; then | |
echo "You need to be root to run this!" | |
exit 2 | |
fi | |
echo "What is the hostname of the server? " | |
read hostname | |
echo "What version of Rubygems do you need? " | |
read rubygems_version | |
echo "What version of Rails will you need? " | |
read rails_version | |
echo "The following gems are installed with the CMS:" | |
echo "rails will_paginate rdefensio mysql passenger haml rmagick rspec rspec-rails cucumber populator faker ruport ruport-util geokit" | |
echo "Enter any other gems you will require (space separated): " | |
read extra_gems | |
echo "What will the user be called? " | |
read user_name | |
echo "What will the application be called? " | |
read app_name | |
apt-get update | |
aptitude update | |
aptitude install build-essential man apache2 ruby ri irb ruby1.8-dev wget mysql-client mysql-server libmysqlclient15-dev xmkmf libopenssl-ruby apache2-prefork-dev git-core imagemagick libmagick9-dev vim sendmail memcached | |
wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz | |
tar zxvf sphinx-0.9.8.1.tar.gz | |
cd sphinx-0.9.8.1 | |
./configure --prefix=/usr/local | |
make | |
make install | |
cd .. | |
rm sphinx-0.9.8.1.tar.gz | |
rm -rf sphinx-0.9.8.1 | |
curl -O http://rubyforge.iasi.roedu.net/files/rubygems/rubygems-${rubygems_version}.tgz | |
tar -xzvf rubygems-${rubygems_version}.tgz | |
cd rubygems-${rubygems_version} | |
ruby setup.rb | |
cd .. | |
rm rubygems-${rubygems_version}.tgz | |
rm -rf rubygems-${rubygems_version} | |
ln -s /usr/bin/gem1.8 /usr/bin/gem | |
gem update --system | |
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc | |
gem install rails -v=$rails_version | |
gem install mislav-will_paginate --source=http://gems.github.com | |
gem install mattapayne-rdefensio --source=http://gems.github.com | |
gem install mysql passenger haml rmagick rspec rspec-rails cucumber populator faker ruport ruport-util geokit | |
if $extra_gems | |
then | |
gem install $extra_gems | |
fi | |
passenger-install-apache2-module | |
# vim /etc/apache2/apache2.conf | |
echo "LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so" >> /etc/apache2/apache2.conf | |
echo "PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2" >> /etc/apache2/apache2.conf | |
echo "PassengerRuby /usr/bin/ruby1.8" >> /etc/apache2/apache2.conf | |
# vim /etc/apache2/sites-available/app-development or whatever | |
# symlink to /etc/apache2/sites-enabled | |
rm /etc/apache2/sites-enabled/000-default | |
ln -s /etc/apache2/sites-available/app-development 000-app-development | |
<VirtualHost *:80> | |
ServerName www.yourhost.com | |
DocumentRoot /somewhere/public | |
</VirtualHost> | |
apache2ctl restart | |
echo $hostname >> /var/hostname | |
adduser $user_name --home=/var/www/$user_name | |
chmod 755 /var/www/$user_name | |
mysql -p | |
create database $app_name_production | |
# should it be mysql create database $user_name + "_production";? | |
GRANT all privileges ON $app_name_production.* to "$user_name"@"localhost" IDENTIFIED by '$app_name1001;;'; | |
echo "Installation finished." | |
ruby -v | |
gem -v | |
/opt/ruby/bin/passenger-status | |
AS USER: | |
cd ~ | |
mkdir .ssh | |
ssh-keygen | |
# copy id_rsa.pub to github as deploy key | |
mkdir authorized_keys | |
cd authorized_keys | |
# vi authorized_keys | |
# add keys from devs | |
# cat id_rsa.pub | pbcopy | |
chmod 600 authorized_keys | |
# git clone [email protected]:offmadisonave/qpm.git (to introduce servers) | |
# add the config/database.yml file | |
# config, index, start for sphinx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment