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