Skip to content

Instantly share code, notes, and snippets.

@maccman
Created January 5, 2009 15:59
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 maccman/43444 to your computer and use it in GitHub Desktop.
Save maccman/43444 to your computer and use it in GitHub Desktop.
# Installing a Rails Stack on EC2/Ubuntu
# based on ami-1c5db975 - see http://alestic.com/ for more info.
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install build-essential
sudo apt-get install ruby rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libmysqlclient15off libnet-daemon-perl libplrpc-perl libreadline-ruby1.8 libruby1.8 mysql-client-5.0 mysql-common mysql-server-5.0 ruby1.8 subversion rubygems libopenssl-ruby irb rake
sudo gem update --system # try again if it fails
vim /usr/bin/gem
# add require 'rubygems/gem_runner' after require 'rubygems'
# remove Gem.manage_gems
# For sqlite3:
sudo apt-get install libsqlite3-dev
sudo gem install sqlite3-ruby --no-ri --no-rdoc
# For Mysql:
apt-get install gcc libc6-dev libmysqlclient15-dev
sudo gem install mysql --no-ri --no-rdoc
# For Apache2:
apt-get install apache2
# For Enterprise Ruby:
http://www.rubyenterpriseedition.com/download.html
# For Mod Rails:
http://www.modrails.com/install.html
# Move Mysql Data Dir over to /mnt
/etc/init.d/mysql stop
mkdir /mnt/mysql_data
cp -rf /var/lib/mysql/* /mnt/mysql_data/
mkdir /mnt/mysql_data/tmp
sudo chown -R mysql:mysql /mnt/mysql_data/*
# Edit /etc/mysql/my.cnf datadir to /mnt/mysql_data & tmpdir to /mnt/mysql_data/tmp
/etc/init.d/mysql start
# Move Mysql Log Dir over to /mnt
mkdir /mnt/log
mkdir /mnt/log/mysql
sudo chown -R mysql:mysql /mnt/log/mysql
# Change log_bin in /etc/mysql/my.cnf to the following:
log_bin = /mnt/log/mysql/mysql-bin.log
# Allow Access to Mysql from other EC2 instances
Change bind-address in /etc/mysql/my.cnf to 0.0.0.0
# See http://alestic.com/ for build information
bash ec2ubuntu-build-ami --codename hardy --bucket mxm-hardy-05-01-09 --prefix mxm-hardy-05-01-09 --user xxx --access-key xxx --secret-key xxx --private-key /mnt/pk-mbmec2.pem --cert /mnt/cert-mbmec2.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment