Friday, December 30, 2011

run hadoop on aws ec2 by yourself.

$/usr/bin/hadoop namenode -format 11/12/31 06:28:39 INFO namenode.NameNode: STARTUP_MSG: /************************************************************ STARTUP_MSG: Starting NameNode STARTUP_MSG: host = ip-10-146-3-18.ap-northeast-1.compute.internal/10.146.3.18 STARTUP_MSG: args = [-format] STARTUP_MSG: version = 0.20.2-cdh3u2 STARTUP_MSG: build = file:///tmp/topdir/BUILD/hadoop-0.20.2-cdh3u2 -r 95a824e4005b2a94fe1c11f1ef9db4c672ba43cb; compiled by 'root' on Thu Oct 13 21:51:41 PDT 2011 ************************************************************/ 11/12/31 06:28:39 INFO util.GSet: VM type = 32-bit 11/12/31 06:28:39 INFO util.GSet: 2% max memory = 19.33375 MB 11/12/31 06:28:39 INFO util.GSet: capacity = 2^22 = 4194304 entries 11/12/31 06:28:39 INFO util.GSet: recommended=4194304, actual=4194304 11/12/31 06:28:40 INFO namenode.FSNamesystem: fsOwner=hduser 11/12/31 06:28:40 INFO namenode.FSNamesystem: supergroup=supergroup 11/12/31 06:28:40 INFO namenode.FSNamesystem: isPermissionEnabled=true 11/12/31 06:28:40 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=1000 11/12/31 06:28:40 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s) 11/12/31 06:28:40 INFO common.Storage: Image file of size 112 saved in 0 seconds. 11/12/31 06:28:40 INFO common.Storage: Storage directory /tmp/hadoop-hduser/dfs/name has been successfully formatted. 11/12/31 06:28:40 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************ SHUTDOWN_MSG: Shutting down NameNode at ip-10-146-3-18.ap-northeast-1.compute.internal/10.146.3.18 ************************************************************/ Refer to http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/

install Hadoop 0.20 to your AWS EC2 (CentOS)

$cd /etc/yum.repos.d $sudo wget http://archive.cloudera.com/redhat/cdh/cloudera-cdh3.repo $sudo yum update yum $sudo yum search hadoop $sudo yum install hadoop-0.20

change your default git editor to vi

git config --global core.editor vi

start using git

$ sudo apt-get install git-core $ git config –global user.name “YOUR NAME” $ git config –global user.email “YOUR EMAIL” $ git config –list want to install Grails, Groov on Ununtu 11.04

Tuesday, December 13, 2011

install rvm on CentOS for aws ec2

$ bash < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile

$ source ~/.bash_profile

$ yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison
888 sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison

$ $ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.6-head
[ruby-]1.8.7[-p352]
[ruby-]1.8.7-head
[ruby-]1.9.1-p378
[ruby-]1.9.1[-p431]
[ruby-]1.9.1-head
[ruby-]1.9.2-p180
[ruby-]1.9.2[-p290]
[ruby-]1.9.2-head
[ruby-]1.9.3-preview1
[ruby-]1.9.3-rc1
[ruby-]1.9.3[-p0]
[ruby-]1.9.3-head
ruby-head

# GoRuby
goruby

# JRuby
jruby-1.2.0
jruby-1.3.1
jruby-1.4.0
jruby-1.6.1
jruby-1.6.2
jruby-1.6.3
jruby-1.6.4
jruby[-1.6.5]
jruby-head

# Rubinius
rbx-1.0.1
rbx-1.1.1
rbx-1.2.3
rbx-1.2.4
rbx[-head]
rbx-2.0.0pre

# Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2011.03]
ree-1.8.6-head
ree-1.8.7-head

# Kiji
kiji

# MagLev
maglev[-head]
maglev-1.0.0

# Mac OS X Snow Leopard Only
macruby[-0.10]
macruby-nightly
macruby-head

# IronRuby -- Not implemented yet.
ironruby-0.9.3
ironruby-1.0-rc2
ironruby-head

http://beginrescueend.com/rvm/install/

Friday, December 2, 2011

How to solve this problem: curl: (7) couldn't connect to host for cuuchDB

if you configure couchdb for CentOS.
please refer to http://opikanoba.org/linux/couchdb-centos6

if you ok for curl http://localhost:5984 but not for curl http://domainName:5984

change your bind IP in local.ini as follows

$ sudo vi /usr/local/etc/couchdb/local.ini

change bind 127.0.0.1 to  bind 0.0.0.0

Thursday, November 24, 2011

add swap on AWS EC2 for CentOS

To add 512MB swap for example:

$ sudo dd if=/dev/zero of=/usr/swap0 bs=1M count=512
$ mkswap /usr/swap0
$ sudo swapon /usr/swap0

To use "top" command, you can see the swap is on.

To make it available on restart. Add following line to the end of your /etc/fstab file

/usr/swap0    swap    swap   defaults 0 0

Monday, November 14, 2011

install ejabberd on CentOS for EC2 server

1. download and install ejabberd

$ git clone git://git.process-one.net/ejabberd/mainline.git ejabberd
$ cd ejabberd
$ git checkout -b 2.1.x origin/2.1.x
$ cd src
$ ./configure
$ make
$ sudo make install

if you miss expat package,

$ wget http://fossies.org/unix/www/expat-2.0.1.tar.gz
$ gzip -d expat-2.0.1.tar.gz
$ tar xvf expat-2.0.1.tar
$ ./configure
$ make
$ sudo make install

$ sudo ejabberdctl start
$ sudo ejabberdctl status

to make sure ejabberd is installed successfully.


1.1 make a script file in /etc/init.d

$ cd src
$ sudo cp ejabberd.init /etc/init.d/ejabberd
$ cd /etc/rc2.d (and rc3.d, rc4.d, rc5.d, rc6.d
$ ln -s ../init.d/ejabberd S97ejabberd

$ cd /etc/rc0.d (and rc1.d)
$ ln -s ../init.d/ejabberd K87ejabberd

2. configuration

$ cd /etc
$ sudo vi ejabberd/ejabberd.cfg

add your domain name in the configuration file, such as

{hosts, ["url0.info", "localhost"]}.

3. register an user account

$ ejabberdctl register USERNAME DOMAINNAME PASSWORD

for example:

$ ejabberdctl register admin url0.info passwd

4. start the server

$ cd /etc/init.d
$ sudo ./ejabberd start

make sure the server process is keep running.

$ ps -ef | grep ejabberd root 1341 1 4 08:45 ? 00:00:00 /usr/local/lib/erlang/erts-5.8.3/bin/beam -K true -P 250000 -- -root /usr/local/lib/erlang -progname erl -- -home //var/lib/ejabberd -- -sname ejabberd@localhost -noshell -noinput -noshell -noinput -pa //lib/ejabberd/ebin -mnesia dir "//var/lib/ejabberd" -kernel inet_dist_use_interface {127,0,0,1} -s ejabberd -sasl sasl_error_logger {file,"//var/log/ejabberd/erlang.log"} -smp auto start

or

$ sudo ejabberdctl status
The node ejabberd@localhost is started with status: started ejabberd 2.1.x is running in that node

5. testing

$ epmd -names
epmd: up and running on port 4369 with data: name ejabberd at port 59502

$ sudo netstat -tpan | grep "beam\|epmd"
tcp 0 0 127.0.0.1:59502 0.0.0.0:* LISTEN 1341/beam
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 1131/epmd
tcp 0 0 0.0.0.0:5269 0.0.0.0:* LISTEN 1341/beam
tcp 0 0 0.0.0.0:5280 0.0.0.0:* LISTEN 1341/beam
tcp 0 0 10.146.47.148:59840 0.0.0.0:* LISTEN 965/beam
tcp 0 0 0.0.0.0:5222 0.0.0.0:* LISTEN 1341/beam
tcp 0 0 127.0.0.1:4369 127.0.0.1:52165 ESTABLISHED 1131/epmd
tcp 0 0 10.146.47.148:5280 210.71.153.52:49533 ESTABLISHED 1341/beam
tcp 0 0 127.0.0.1:52165 127.0.0.1:4369 ESTABLISHED 1341/beam

6. open your TCP ports in your Security Groups for the ports you use for xmpp server or web binding.

such as 5280, 5222 and 59502 (custom TCP ports).



7. open web page from your browser, such as

http://url0.info:5280/admin



you need to login with your admin user name and password, which you create one in step 3.

8. Good reference for testing server: http://lists.jabber.ru/pipermail/ejabberd/2007-October/003186.html

Tuesday, November 8, 2011

how to install Expat library on aws ec2 CentOS server.

how to install Expat library on aws ec2 CentOS server.

1. download the source code from http://fossies.org/unix/www/expat-2.0.1.tar.gz
2. gzip -d expat-2.0.1.tar.gz
3. tar xvf expat-2.0.1.tar
4. cd expat-2.0.1
5. ./configure
6. make
7. sudo make install

It's a requirement for build openfire on CentOS for a xmpp (jabber) server.

Monday, October 31, 2011

install redis on a AWS EC2.

Step 1. get source from redis web site (http://redis.io/download) and follow the following instructions.

$ wget http://redis.googlecode.com/files/redis-2.4.2.tar.gz
$ tar xzf redis-2.4.2.tar.gz
$ cd redis-2.4.2
$ make

it works fine on my CentOS image running on t1-micro.

Saturday, October 22, 2011

if you can't run couchdb on port 80.

1. cd to your source directory such as $ cd svn/couchdb
2. $ vi etc/default/couchdb and change COUCHDB_USER=root
3. $ make && sudo make install

of course you need to change your local.ini (port = 80) before restart your couchdb.

Monday, September 26, 2011

how to push your couchapps to your couchDB on your aws ec3 server.

$ git clone git://github.com/couchone/pages.git
Initialized empty Git repository in /home/ming/couchapp/pages/.git/
remote: Counting objects: 888, done.
remote: Compressing objects: 100% (426/426), done.
remote: Total 888 (delta 375), reused 852 (delta 352)
Receiving objects: 100% (888/888), 144.51 KiB | 57 KiB/s, done.
Resolving deltas: 100% (375/375), done.
$ cd pages
$ couchapp init
$ couchapp push . http://ming:xxxxxxxx@url0.info:59840/pages
2011-09-26 20:54:16 [INFO] Visit your CouchApp here:
http://url0.info:59840/pages/_design/pages/_rewrite/page/index

Sunday, September 25, 2011

Hi, if you are not familiar to couchDB, checkout this web site for simple tutorial (http://couchtim.github.com/clubhouse/)

if you prefer to play around couchDB on couchOne, get your instance clouding couchDB from couchBase, go http://www.couchbase.com/downloads

Assume you already install your own couchDB on your EC2. let's issue some commands from your command lines.

1. Login as admin for configuration the couchdb you had insatlled, you may get some errors because your are not admin yet.

$ curl http://url0.info:59840/_config/admins
{"error":"unauthorized","reason":"You are not a server admin."}

Everything is Javascript and JSON, includes the error message.

Tuesday, September 20, 2011

how to make a git server on AWS CE2

On your aws ec2 server:

1. make an user account called "git"
2. $ su git
3. $ cd /home/git
4. $ mkdir test.git
5. $ cd test.git
6. $ git --bare init Initialized empty Git repository in /home/git/test.git/
7. $ pwd /home/git/test.git

then back to local site.

1. $ mkdir test
2. $ cd test
3. $ touch me
4. $ ls me
5. $ git init Initialized empty Git repository in /tmp3/test/.git/
6. $ git add .
7. $ git commit -m 'init' [master (root-commit) f16acd9] init Committer: ming Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly:
git config --global user.name "Your Name" git config --global user.email you@example.com
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author='Your Name '
0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 me
8. $ git log commit f16acd95a84465a9cbf7ed7f9acacb6362724a30 Author: ming Date: Tue Sep 20 23:06:07 2011 +0800
init
9. $ git branch -a * master
10. git remote add origin git@url0.info:test.git
11. $ git push origin master Counting objects: 3, done. Writing objects: 100% (3/3), 197 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To git@url0.info:test.git * [new branch] master -> master
12. $ git branch -a * master remotes/origin/master
13. $ git status # On branch master nothing to commit (working directory clean)
14. $ git pull origin master From url0.info:test * branch master -> FETCH_HEAD Already up-to-date.

Remarks: make sure you can ssh the server by the git account before hand.

how to trace and debug your git push and pull

before you get pull or push, you can set GIT_TRACE to true as follows, $ GIT_TRACE=true $ export GIT_TRACE

Thursday, May 26, 2011

Friday, May 6, 2011

Installing Nginx with header-more on CentOS 5

1. to solve cross-dimension request problem for get RSS from YQL on AWS
2. install PCRE library.
     $ sudo yum install pcre-devel
3. download headers-more-nginx-module source code.
     $ git clone git://github.com/agentzh/headers-more-nginx-module.git
4. download nginx-0.8.54.tar.gz source code, configure and build.
     $ wget 'http://sysoev.ru/nginx/nginx-0.8.54.tar.gz'
     $ tar -xzvf nginx-0.8.54.tar.gz
     $ cd nginx-0.8.54
     $ ./configure --prefix=/opt/nginx --add-module=../headers-more-nginx-module
     $ make && sudo make install

Thursday, April 21, 2011

after you install node.js, nginx is there? Change its configuration to do proxy for Sling if sling port move to 8080

This is the default index.html page that is distributed with nginx on Fedora. It is located in /usr/share/nginx/html.

You should now put your content in a location of your choice and edit the root configuration directive in the nginx configuration file /etc/nginx/nginx.conf.

Tuesday, April 19, 2011

install node.js on AWS CentOS

Thanks to @wavded post on http://wavded.tumblr.com/post/475957278/hosting-nodejs-apps-on-centos-5

when I upgrade to v0.5.10 on CentOS in aws ec2

under your node source directory

$ git pull
$ ./configure
$ make

...
Waf: Leaving directory `/home/ec2-user/git/node/out'
'build' finished successfully (31m18.692s)


$ sudo make install

...
Waf: Leaving directory `/home/ec2-user/git/node/out'
'install' finished successfully (0.324s)


and test

$ make test.

Wednesday, April 6, 2011

if you can't run couchdb on port 80.

It's because the user to run couchdb is (couchdb) who is not allow to run on port 80. You need to rebuild couchdb and change COUCHDB_USER to root as follows;

1. cd to your couchdb source code directory

$ cd svn/couchdb

2. change COUCHBD_USER to root

$ vi etc/default/couchdb

change COUCHDB_USER=couchdb to COUCHDB_USER=root

3. make and install it again.

$ make && sudo make install

4. then you can change couchdb local.ini configuration file to use port = 80. and restart the couchdb service again.

if you can 't run couchjs because of libjs.so missing.

when run /usr/local/bin/couchjs and got error as follows;

./couchjs: error while loading shared libraries: libjs.so: cannot open shared object file: No such file or directory

try to copy /usr/local/lib/libjs.so to /usr/lib

$ sudo cp /usr/local/lib/libjs.so /usr/lib

or make a symbolic link from /usr/lib/libjs.so to /usr/local/lib/libjs.so

$ sudo ln -s /usr/local/lib/libjs.so /usr/lib/libjs.so

Friday, March 25, 2011

good tutorial for couchdb with couchapp

http://blog.edparcell.com/using-jquery-and-couchdb-to-build-a-simple-we

more easy on a ubuntu 9.10 system to install couchapp

adding the couchapp's PPA to Ubuntu 9.10 (Karmic) and later

$ sudo add-apt-repository ppa:couchapp/couchapp

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv E9AE0C6F64E1127BDAB2C06D9180CDCB0CC91448
gpg: ....
gpg: ....
gpg: ...: 1 (RSA: 1)

$ sudo apt-get update

install couchapp on your AWS EC2

if you have not install couchdb, plesae install it first. refer to "install couchdb for AWS" in this blog.
(on Linux ip-10-146-47-148 2.6.34.7-56.40.amzn1.i686 #1 SMP Fri Oct 22 18:48:33 UTC 2010 i686 i686 i386 GNU/Linux
)

$ cd /tmp
$ curl -O http://python-distribute.org/distribute_setup.py
$ sudo python distribute_setup.py
$ sudo easy_install pip
$ sudo pip install couchapp

test: (you will see couchapp help)
$ couchapp

Tuesday, March 22, 2011

install couchdb 1.2.0 on AWS (AMI: ami-8e08a38f) successfuly

0. pre-isntall os dependencies.
on CentOS.
$ sudo yum install gcc glibc-devel make ncurses-devel openssl-devel yum install libicu-devel curl-devel git nmap

or on ubuntu 10.04
$ sudo apt-get install libtool libicu-dev libssl-dev libssl0.9.8 (for building couchdb, ssl is for erlang).

1. make sure your have curl

build it from source:

$ wget http://curl.haxx.se/download/curl-7.21.4.tar.gz
$ tar -xvzf curl-7.21.4.tar.gz
$ cd curl-7.21.4
$ ./configure --prefix=/usr/local
$ make
$ make test
$ sudo make install

result:
curl --version
curl 7.21.4 (i686-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

2. check your linux version

uname -a
Linux ip-10-146-47-148 2.6.34.7-56.40.amzn1.i686 #1 SMP Fri Oct 22 18:48:33 UTC 2010 i686 i686 i386 GNU/Linux

3. Install SpiderMonkey (Mozilla javascript is required for build couchDB)

$ wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.8.0-rc1.tar.gz
$ tar xvzf js-1.8.0-rc1.tar.gz
$ cd js/src
$ make BUILD_OPT=1 -f Makefile.ref
$ sudo make BUILD_OPT=1 JS_DIST=/usr/local -f Makefile.ref export

4. Install Erlang (couchDB is written by Erlang)

Remark: pre-install ncurses-devel.i386 first on CentOS (yum install ncurses-devel.i386)
or (sudo apt-get install libncurses5-dev) on ubuntu 10.04.

$ wget http://erlang.org/download/otp_src_R14B02.tar.gz
$ tar xvzf otp_src_R14B02.tar.gz
$ cd otp_src_R14B02
$ ./configure && make && sudo make install

result:
erl -version
Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.8.3

5. build couchdb

$ svn co http://svn.apache.org/repos/asf/couchdb/trunk couchdb
$ cd couchdb
$ ./bootstrap
$ ./configure
$ make && sudo make install


6. configure couchdb

Edit the CouchDB configuration file (if necessary)

# vi /usr/local/etc/couchdb/local.ini

Create couchdb user and change file ownership

$ sudo adduser -r --home /usr/local/var/lib/couchdb -M --shell /bin/bash --comment "CouchDB Administrator" couchdb
$ sudo chown -R couchdb: /usr/local/var/lib/couchdb /usr/local/var/log/couchdb

Set CouchDB service to run on startup:

# ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb (on ubunutu, ln -s /usr/local/etc/init.d/couchdb /etc/init.d/couchdb)

# chkconfig --add couchdb
# chkconfig --level 345 couchdb on

Start CouchDB and verify it running:

# sudo service couchdb start
# sudo service couchdb status
# curl http://127.0.0.1:5984/
{"couchdb":"Welcome","version":"1.2.0a1084126"}

REMARKS:
1. first problem you may also encounter for sing in a new account or fix party admin. see also,
http://couchdbtw.blogspot.com/2011/03/first-problem-i-had-encountered-is-i.html

couchdb 1.2.0 installed on AWS EC2 successfully.

curl http://127.0.0.1:5984
{"couchdb":"Welcome","version":"1.2.0a1084126"}

with help from this cached page
http://webcache.googleusercontent.com/search?q=cache:v8EJh5QJwP0J:www.ipublic.org/blog/2011/02/install-couchdb-geocouch-on-centos-5/+install+couchdb+on+centos&cd=6&hl=zh-TW&ct=clnk&gl=tw&client=opera&source=www.google.com.tw

Saturday, March 19, 2011

set colorful prompts

$ echo 'export PS1="\e[0;35m[\u@\h \w]\$ \e[m"' | sudo tee -a /home/lou/.bashrc

add a new account, for example "lou"

$sudo useradd lou

ec2-user$ sudo su lou
lou$ mkdir -m 700 ~/.ssh
lou$ touch ~/.ssh/authorized_keys
lou$ chmod 600 ~/.ssh/authorized_keys
lou$ exit
ec2-user$ cat ~/id_rsa_ec2.pub | sudo tee -a /home/lou/.ssh/authorized_keys

add user account and others

http://codelikezell.com/setting-up-rails-mysql-php-apache-and-git-on-ec2/

Tutorial: how to run your first Cloud MapReduce job

http://code.google.com/p/cloudmapreduce/wiki/Tutorial

install couchDB to your aws ec2 with sprinkle (ruby gem)

http://knuthellan.com/2009/08/31/couchdb-on-amazon-ec2-centos-server-with-sprinkle/

install sprinkle when ruby and gem are ready on your AWS EC2 server

~/rubygems-1.6.2$ gem install sprinkle
Fetching: highline-1.6.1.gem (100%)
Fetching: net-ssh-2.1.3.gem (100%)
Fetching: net-ssh-gateway-1.0.1.gem (100%)
Fetching: net-sftp-2.0.5.gem (100%)
Fetching: net-scp-1.0.4.gem (100%)
Fetching: capistrano-2.5.20.gem (100%)
Fetching: sprinkle-0.3.3.gem (100%)
Successfully installed highline-1.6.1
Successfully installed net-ssh-2.1.3
Successfully installed net-ssh-gateway-1.0.1
Successfully installed net-sftp-2.0.5
Successfully installed net-scp-1.0.4
Successfully installed capistrano-2.5.20
Successfully installed sprinkle-0.3.3
7 gems installed
Installing ri documentation for highline-1.6.1...
Installing ri documentation for net-ssh-2.1.3...
Installing ri documentation for net-ssh-gateway-1.0.1...
Installing ri documentation for net-sftp-2.0.5...
Installing ri documentation for net-scp-1.0.4...
Installing ri documentation for capistrano-2.5.20...
Installing ri documentation for sprinkle-0.3.3...
Installing RDoc documentation for highline-1.6.1...
Installing RDoc documentation for net-ssh-2.1.3...
Installing RDoc documentation for net-ssh-gateway-1.0.1...
Installing RDoc documentation for net-sftp-2.0.5...
Installing RDoc documentation for net-scp-1.0.4...
Installing RDoc documentation for capistrano-2.5.20...
Installing RDoc documentation for sprinkle-0.3.3...

install ruby gem on Amazon EC2 CentOS server

1. assume you system already install ruby
2. wget http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz
4. gzip -d *gz
5. tar xvf *tar
6. cd ru*
7. ruby setup.rb

gem will be install to your /usr/loca/gem

refer to: http://rubygems.org/pages/download

Friday, March 18, 2011

Install SpiderMonkey on AWS

you may need to add a yum repository. Add rpmforge.repo in /etc/yum.repos.d containing:

# Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag
# URL: http://rpmforge.net/
[rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
baseurl = ftp://ftp.pbone.net/mirror/atrpms.net/el5-i386/atrpms/stable
enabled = 1
protect = 0
gpgcheck = 0

(Put "x86_64" instead of "i386" if when appropriate.)

Now run:

yum clean all
yum install js-devel (--skip-broken)

install couchdb on amazone standard AMI for AWS EC2

you don't have to install EPEL.

1. sudo yum install ncurses-devel openssl-devel icu libicu-devel js js-devel curl-devel erlang erlang-devel libtool

2. mkdir svn; cd svn; svn checkout http://svn.apache.org/repos/asf/couchdb/trunk couchdb

3. cd couchdb; ./bootstrap

You need to install SpiderMonkey.

you may need to add a yum repository. Add rpmforge.repo in /etc/yum.repos.d containing:

# Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag
# URL: http://rpmforge.net/
[rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
baseurl = ftp://ftp.pbone.net/mirror/atrpms.net/el5-i386/atrpms/stable
enabled = 1
protect = 0
gpgcheck = 0

(Put "x86_64" instead of "i386" if when appropriate.)

Now run:

yum clean all
yum install js-devel


4. ./configure --with-erlang=/usr/lib/erlang/usr/include && \
make && \
make install

sudoyum updatbuild katdchttp://twd.cer24.com/usd/converter/e

sudo yum update
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
amzn | 2.1 kB 00:00
Skipping security plugin, no data
Setting up Update Process
Resolving Dependencies
Skipping security plugin, no data
--> Running transaction check
---> Package aws-amitools-ec2.noarch 0:1.3.57676-1.1.amzn1 set to be updated
---> Package aws-apitools-as.noarch 0:1.0.33.1-1.1.amzn1 set to be updated
---> Package aws-apitools-ec2.noarch 0:1.3.62308-1.1.amzn1 set to be updated
---> Package aws-apitools-mon.noarch 0:1.0.9.5-1.1.amzn1 set to be updated
---> Package aws-apitools-rds.noarch 0:1.3.003-1.1.amzn1 set to be updated
---> Package cloud-init.noarch 0:0.5.14-23.amzn1 set to be updated
---> Package java-1.6.0-openjdk.i686 1:1.6.0.0-44.1.9.1.18.amzn1 set to be updated
---> Package java-1.6.0-openjdk-devel.i686 1:1.6.0.0-44.1.9.1.18.amzn1 set to be updated
---> Package system-release.noarch 0:2010.11-2 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Updating:
aws-amitools-ec2 noarch 1.3.57676-1.1.amzn1 amzn 87 k
aws-apitools-as noarch 1.0.33.1-1.1.amzn1 amzn 5.9 M
aws-apitools-ec2 noarch 1.3.62308-1.1.amzn1 amzn 8.3 M
aws-apitools-mon noarch 1.0.9.5-1.1.amzn1 amzn 5.9 M
aws-apitools-rds noarch 1.3.003-1.1.amzn1 amzn 6.0 M
cloud-init noarch 0.5.14-23.amzn1 amzn 78 k
java-1.6.0-openjdk i686 1:1.6.0.0-44.1.9.1.18.amzn1 amzn 31 M
java-1.6.0-openjdk-devel i686 1:1.6.0.0-44.1.9.1.18.amzn1 amzn 11 M
system-release noarch 2010.11-2 amzn 16 k

Transaction Summary
==============================================================================================================================================================
Install 0 Package(s)
Upgrade 9 Package(s)

Total download size: 68 M
Is this ok [y/N]: y
Downloading Packages:
(1/9): aws-amitools-ec2-1.3.57676-1.1.amzn1.noarch.rpm | 87 kB 00:00
(2/9): aws-apitools-as-1.0.33.1-1.1.amzn1.noarch.rpm | 5.9 MB 00:00
(3/9): aws-apitools-ec2-1.3.62308-1.1.amzn1.noarch.rpm | 8.3 MB 00:00
(4/9): aws-apitools-mon-1.0.9.5-1.1.amzn1.noarch.rpm | 5.9 MB 00:00
(5/9): aws-apitools-rds-1.3.003-1.1.amzn1.noarch.rpm | 6.0 MB 00:00
(6/9): cloud-init-0.5.14-23.amzn1.noarch.rpm | 78 kB 00:00
(7/9): java-1.6.0-openjdk-1.6.0.0-44.1.9.1.18.amzn1.i686.rpm | 31 MB 00:00
(8/9): java-1.6.0-openjdk-devel-1.6.0.0-44.1.9.1.18.amzn1.i686.rpm | 11 MB 00:00
(9/9): system-release-2010.11-2.noarch.rpm | 16 kB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 29 MB/s | 68 MB 00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : aws-amitools-ec2-1.3.57676-1.1.amzn1.noarch 1/18
Updating : system-release-2010.11-2.noarch 2/18
Updating : cloud-init-0.5.14-23.amzn1.noarch 3/18
Updating : 1:java-1.6.0-openjdk-1.6.0.0-44.1.9.1.18.amzn1.i686 4/18
Updating : 1:java-1.6.0-openjdk-devel-1.6.0.0-44.1.9.1.18.amzn1.i686 5/18
Updating : aws-apitools-as-1.0.33.1-1.1.amzn1.noarch 6/18
Updating : aws-apitools-ec2-1.3.62308-1.1.amzn1.noarch 7/18
Updating : aws-apitools-mon-1.0.9.5-1.1.amzn1.noarch 8/18
Updating : aws-apitools-rds-1.3.003-1.1.amzn1.noarch 9/18
Cleanup : aws-apitools-rds-1.2.006-2.2.amzn1.noarch 10/18
Cleanup : aws-apitools-mon-1.0.2.3-2.1.amzn1.noarch 11/18
Cleanup : aws-apitools-ec2-1.3.57419-2.3.amzn1.noarch 12/18
Cleanup : aws-apitools-as-1.0.9.0-2.1.amzn1.noarch 13/18
Cleanup : aws-amitools-ec2-1.3.56066-2.5.amzn1.noarch 14/18
Cleanup : system-release-2010.11-1.noarch 15/18
Cleanup : cloud-init-0.5.14-22.amzn1.noarch 16/18
Cleanup : 1:java-1.6.0-openjdk-devel-1.6.0.0-44.1.9.1.16.amzn1.i686 17/18
Cleanup : 1:java-1.6.0-openjdk-1.6.0.0-44.1.9.1.16.amzn1.i686 18/18

Updated:
aws-amitools-ec2.noarch 0:1.3.57676-1.1.amzn1 aws-apitools-as.noarch 0:1.0.33.1-1.1.amzn1 aws-apitools-ec2.noarch 0:1.3.62308-1.1.amzn1
aws-apitools-mon.noarch 0:1.0.9.5-1.1.amzn1 aws-apitools-rds.noarch 0:1.3.003-1.1.amzn1 cloud-init.noarch 0:0.5.14-23.amzn1
java-1.6.0-openjdk.i686 1:1.6.0.0-44.1.9.1.18.amzn1 java-1.6.0-openjdk-devel.i686 1:1.6.0.0-44.1.9.1.18.amzn1 system-release.noarch 0:2010.11-2

Complete!

Monday, March 14, 2011

Thursday, March 10, 2011

How to create an Amazon Elastic Compute Cloud EC2 Machine Image (AMI)

a good reference from Phil Chen's Blog as the following link:

http://www.philchen.com/2009/02/14/how-to-create-an-amazon-elastic-compute-cloud-ec2-machine-image-ami

aki-d209a2d3 AWS EC2 AMI is not so bad.

1. user account (bitnami) bitnami@ec2-175-41-196-29.ap-northeast-1.compute.amazonaws.com
2. you can use 'sudo apt-get install xxx' to get new application, which Amazon AMI can't.

3. But it also hang here.

Setting up openjdk-6-jre-headless (6b20-1.9.7-0ubuntu1~10.04.1) ...
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/java to provide /usr/bin/java (java) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode.

bug report. i-8a47c78b in Tokyo region.

in i-8a47c78b (Tokyo AWS) it will hang as follows; you can't install any software though.

$ sudo dpkg --configure -a
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Setting up openjdk-6-jre-headless (6b20-1.9.7-0ubuntu1~10.04.1) ...
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/java to provide /usr/bin/java (java) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-openjdk/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode.

Sunday, March 6, 2011

to create an AWS EC2 Instance in Japan Zone.

It is really fast. Much faster than US east zone when you use ssh to login them. Move your Instance to Japan now.

想裝其它 server 在你 AWS EC2 上嗎?

in AWS 想裝其它 server 在你 AWS EC2 上嗎? 例如 Tomcat, samba, LAMP 等...


ssh 進了你的 EC2後
$ sudo tasksel --section server

Saturday, March 5, 2011

AWS 如果你不想無緣無故被 Amazon 收錢.

https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=activity-summary

常常檢查以上網址, 了解現本月份帳單.

AWS Elastic IP is not free. Even you use free acount in the first year.

Elastic IP Addresses
$0.01 per non-attached Elastic IP address per complete hour 11 Hrs 0.11

Thursday, March 3, 2011

extra charge for Data Transfer (unknown reason)

Data Transfer (unknown reason)

$0.010 per GB - regional data transfer - in/out/between EC2 Avail Zones or when using public/elastic IP addresses or ELB 0.012 GB US$ 0.01

When I use Android AWS Demo to access my Simple DB.

CloudWatch may charged in free trial

Amazon CloudWatch - $0.015 per monitored instance-hour (or partial hour) 25 Hrs US$ 0.38

to reboot your instance (i-192f1074 for example)

$ ec2-reboot-instances i-192f1074

first command line (how to make your aws ec2 instance ping-able)

$ ec2-authorize default -P icmp -t -1:-1 -s 0.0.0.0/0