Header_image
Jeremy Walker

Software Developer & Social Entrepreneur

Creating an EC2 webserver using Amazon's basic AMI.

Today I setup a new x64 server on EC2 using Amazon's homemade AMI.

This is the bash script I wrote to replicate what I did. It should set you up with a working Apache/Passenger/mysql install, along with Memcached and Imagemagick.

Note: This will not configure a MySQL server as I'm talking to Amazon RDS.

sudo yum install -y httpd httpd-devel mysql mysql-devel git patch gcc gcc-devel make zlib-devel curl-devel openssl openssl-devel gcc gcc-c++ kernel-devel libxml2-devel ImageMagick ImageMagick-devel libxslt libxslt-devel memcached
 
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source .bash_profile
rvm install 1.9.2
rvm use 1.9.2 --default
gem install passenger
passenger-install-apache2-module
 
echo 'export rvm_pretty_print_flag=1' >> ~/.rvmrc.
 
sudo chkconfig httpd on
sudo chkconfig memcached on
 
mkdir ~/tmp
git clone git://github.com/drogus/apache-upload-progress-module.git ~/tmp/progress
cd ~/tmp/progress
sudo apxs -c -i -a mod_upload_progress.c
 
echo "Now copy these lines into httpd.conf. CHECK THE PASSENGER VERSION"
echo "LoadModule passenger_module /home/ec2-user/.rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7/ext/apache2/mod_passenger.so"
echo "PassengerRoot /home/ec2-user/.rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7"
echo "PassengerRuby /home/ec2-user/.rvm/wrappers/ruby-1.9.2-p180/ruby"
echo "LoadModule upload_progress_module /usr/lib64/httpd/modules/mod_upload_progress.so"

Share This Post

Comments

No-one has posted a comment yet. Be the first!

Post a Comment

I'd love to hear your thoughts :)