Skip to content

Instantly share code, notes, and snippets.

@Frobitz
Created July 29, 2012 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Frobitz/3197679 to your computer and use it in GitHub Desktop.
Save Frobitz/3197679 to your computer and use it in GitHub Desktop.
Ruby on Rails setup on Slicehost server
#
# Set up Ruby on Rails on Ubuntu 10.04 LTS Lucid
#
# First use Slicehost articles to set up secure Slice and backup
http://articles.slicehost.com/2010/4/30/ubuntu-lucid-setup-part-1
http://articles.slicehost.com/2010/10/18/ubuntu-maverick-setup-part-2
# RVM dependencies
sudo apt-get install build-essential git-core bison openssl libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
# Install RVM, Ruby and Rails
curl -L https://get.rvm.io | bash -s stable --rails
# Open your .bashrc file
nano ~/.bashrc
# Add this to .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Update .bashrc file
source ~/.bashrc
# Apache2
# https://articles.slicehost.com/2010/5/19/installing-apache-on-ubuntu
# Install Apache2
sudo aptitude install apache2
# Create servername.conf file and add 'ServerName name'
sudo nano /etc/apache2/conf.d/servername.conf
# Restart apache2
sudo /usr/sbin/apache2ctl graceful
# Follow these articles for some configuration and security options that are good to know
#
# Configure Apache2
# http://articles.slicehost.com/2010/5/19/apache-configuration-files-on-ubuntu
#
# Apache2 MPMs
# http://articles.slicehost.com/2010/5/19/configuring-the-apache-mpm-on-ubuntu
#
# More Apache2 configure
# http://articles.slicehost.com/2010/5/19/apache-configuration-on-ubuntu-part-1
# http://articles.slicehost.com/2010/5/19/apache-configuration-on-ubuntu-part-2
# Set up sites directory(s)
mkdir ~/sites
mkdir -p ~/sites/domain1.com/{public,private,log} # Repeat for each site
# Make temporary home page
sudo nano ~/sites/domain1.com/public/index.html
# Add some HTML to identify the page and save and exit
# Set permissions on sites directory
sudo chmod -R a+rX ~/sites
sudo chmod a+rx ~
# Set up virtual host file for this domain
sudo nano /etc/apache2/sites-available/domain1.com
# Virtual Host file template
# Begins:
# Place any notes or comments you have here
# It will make any customization easier to understand in the weeks to come
# domain: domain1.com
# public: /home/demo/public_html/domain1.com/
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin webmaster@domain1.com
ServerName www.domain1.com
ServerAlias domain1.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html
DocumentRoot /home/demo/public_html/domain1.com/public
# Custom log file locations
LogLevel warn
ErrorLog /home/demo/public_html/domain1.com/log/error.log
CustomLog /home/demo/public_html/domain1.com/log/access.log combined
</VirtualHost>
# :Ends
# Enable the new site
sudo /usr/sbin/a2ensite domain1.com
# Reload Apache2
sudo /usr/sbin/apache2ctl graceful
# Passenger
# Install Passenger
gem install passenger
# Install Apache2 module, follow instructions if requirements not met and try again
passenger-install-apache2-module
# Add required lines to Apache2 config file
sudo nano /etc/apache2/apache2.conf
# Reload Apache2
sudo /usr/sbin/apache2ctl graceful
# MySQL
# Memcached
# ImageMagick
# Reboot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment