Skip to content

Instantly share code, notes, and snippets.

@tejasbubane
Last active December 26, 2015 09:59
Show Gist options
  • Save tejasbubane/7133467 to your computer and use it in GitHub Desktop.
Save tejasbubane/7133467 to your computer and use it in GitHub Desktop.
Server installation with RVM, ruby, rails, nginx and passenger

if server name is too long change server_names_hash_bucket_size in nginx configuration file at /opt/nginx/conf/nginx.conf

If everything goes right passenger_root /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.21; passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p448/ruby; else make changes in the nginx.conf file (/opt/nginx/conf/nginx.conf)

Later steps:

  1. Generate the ssh key using ssh-keygen -t rsa -C "[email protected]"

  2. Ask someone to add this key to the unfuddle account

  3. Clone (not pull) the repositories from unfuddle to /mnt/infibeamdigital. Use git ssh urls and not https since it will ask for login each time if https is used.

  4. bundle install and restore the databases

  5. create symlinks in /mnt/infibeamdigital/project_symlinks

  6. Add server blocks in /opt/nginx/conf/nginx.conf (Refer the nginx.conf on other server like atd6.spinr.in or safe.spinr.in)

  7. Add the nginx init script by copying from some other server in /etc/init.d/nginx

  8. Restart nginx (/etc/init.d/nginx restart) and you are done!

  9. You might need to restart the server most of the time after you take a new pull, its better to create an alias

alias restart="/etc/init.d/nginx restart"

echo "Updating the system..."
sudo su -
yum update
# curl does not allow insecure connection by default, make it to allow
echo insecure > ~/.curlrc
echo "Installing rvm..."
\curl -L https://get.rvm.io | bash
source /home/jive/.rvm/scripts/rvm
echo "Installing Ruby..."
rvm install 1.9.3
rvm use 1.9.3
echo "Installing Rails..."
gem install rails --version "=3.2.13"
echo "Installing mysql..."
yum install mysql-server mysql-client mysql-devel libxslt-devel
# change mysql password
mysqladmin -u root password root
echo "Installing passenger and nginx"
# sudo rpm --import http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc
# sudo rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm
# sudo yum install nginx-passenger
# Dont use this^ method
gem install passenger
passenger-install-nginx-module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment