Java, .NET, Ubuntu, Tomcat, Apache, Cloud Computing, JQuery, UI Design, Architecture, Martin Fowler, Domain Driven Development, and everything else...

Amazon EC2 – Fedora/Linux Startup Guide

Posted: September 16th, 2009 | Author: Terrance A. Snyder | Filed under: Linux | Tags: , , , | Comments Off

Zabbix Monitoring
CentOS 5 + MySQL + ZABBIX で監視システム構築
Installing Zabbix 1.4 on CentOS 5
Zabbix Bash Shell Script for Install

Solr – Enterprise Search
Setting Up SOLR on EC2, Part I
SOLR with Apache Tomcat
Apache Reverse Proxy + Load Balancing via mod_proxy, mod_proxy_balancer, mod_status.
mod_proxy を使ってサービスを止めずにサーバ移転
Effective Use of Solr Index Distribution Scripts

Selenium Grid on EC2
Setting up Selenium on EC2

Amazon EC2 Documents
Guide: Putty and Amazon EC2 and Linux
Guide: Creating AMIs
Elastic Block Storage

Connecting to Amazon EC2
Amazon EC2 iPhone and SSH
SFTP Amazon EC2 – Ubuntu

Amazon EBS*
Setting up EBS Raid 0 on Linux – Nice command line perl options as well
Performance Optimizations for EBS Raid on Linux – Very good suggestions
Misc Benchmarks for Raid 0 Configurations

* I am probably going to go with 2 EBS in Raid 0. The reason being is that max IO is more to do with Ethernet between EBS than physical I0

Getting up and running (Ubuntu AMI Image)
Courtesy of http://alestic.com/

My current setup is using amazon ec2 instance created by alestic labeled “ami-ed46a784“. I usually run on a 32-bit on medium hardware -it’s the best fit for me given the price point. In the future, with more backing, I’ll move to the x64 version on a medium instance.

#update current os and patch
apt-get install update
#nice "graphical" processor
apt-get install htop
#nice screen manager in ssh
apt-get install screen
#unzip/zip
apt-get install unzip zip
#java (standard stuff) => use arrow keys to install when sigining jdk agreement
apt-get install sun-java6-jdk
# amazon ec2 api tools
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip unzip ec2-api-tools-1.3-41620.zip mv ec2-api-tools-1.3-41620/ /usr/local/ec2/

Setup environment

touch ~/.bash_profile
chmod 700 ~/.bash_profile
chmod +x ~/.bash_profile

pico ~/.bash_profile

~/.bash_profile

# ensure we get nice colors when using putty
if [ -f ~/.bashrc ];
then
source ~/.bashrc
fi

export EC2_HOME=/root/tools/ec2-api-tools-1.3-41620
export EC2_CERT=/root/.private/cert-xxxxxxxxxxxxxxxxxxx.pem
export EC2_PRIVATE_KEY=/root/.private/pk-xxxxxxxxxxxxxxxxxxxx.pem

export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16

PATH=$PATH:$EC2_HOME/bin:$JAVA_HOME/bin

Then resource bash using

# refresh bash_profile
source ~/.bash_profile
# check make sure everything is golden
ec2-describe-volumes

SOLR Install
Brief to get SOLR up and running on an EC2 instance.
A short cut would be to use an AMI already created –
but you learn less that way.

$ apt-get install apache2-mpm-prefork
$ apt-get install libapache2-mod-php5 php5-mysql
cd /etc/apache2
# this is a nicer layout than what i remeber
# we have mods-enabled, mods-available, and a nicely seperated
# system of files
# to enable apache mods just create a symbolic link in mods-enabled
# to the mods-available target
# for example - i am going to setup mod_proxy to proxy to tomcat/jetty
# for solr
$ cd /etc/apache2/mods-enabled
# enable apache proxy
$ ln -s ../mods-available/proxy.conf proxy.config
$ ln -s ../mods-available/proxy.load proxy.load
$ ln -s ../mods-available/proxy_http.load proxy_http.load

Solr Install

# get solr package
$ wget http://www.gossipcheck.com/mirrors/apache/lucene/solr/1.3.0/apache-solr-1.3.0.zip
# ants is required to build solr
$ apt-get install ant
# unzip
$ unzip apache-solr-1.3.0.zip
# build example
$ cd apache-solr-1.3.0
$ ant example
# copy /example to /etc/jetty as new home
$ mv ./example /etc/jetty
$ cd /etc/jetty

Initial Setup

  • You can find schema.xml at /etc/jetty/solr/config/schema.xml
  • If you modify it clear the /etc/jetty/solr/data directory to re-index all the data
  • Tip: You can call sh post.sh *.xml to upload some documents with your new schema in /etc/jetty/solr/exampledocs

Apache Proxy / Load Balance Configuration

$ cd /etc/apache2/
$ pico /etc/apache2/mods-available/proxy.config
<IfModule mod_proxy.c>
ProxyRequests Off
ProxyPreserveHost On
ProxyStatus On

ProxyPass /solr http://localhost:8983/solr
ProxyPassReverse /solr http://localhost:8983/solr
</IfModule>

Now we need to update the default website for httpd (apache) (/etc/apache2/sites-enabled/000-default).

<VirtualHost>
// ....
// ....
Include /etc/apache2/mods-enabled/proxy.config
</VirtualHost>

Comments are closed.