2014년 11월 2일 일요일

ubuntu 14.04 R install

very easy~ $ sudo apt-get install r-base r-base-dev

Centos에 yum으로 Git설치하기

$ yum install git
설치가 안되면

1. yum 쌧팅
/etc/yum.repos.d/epel.repo
위 파일을 만들고 아래와 같이 작성한다.

[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1


2. rpm샛팅
$ cd /etc/pki/rpm-gpg/
위 폴더에 가서 RPM-GPG-KEY-EPEL 이 파일이 있는지 확인한다.
없다면 아래와 같이 작성하고 있다면 넘어가자 3번으로 넘어가자
$ wget http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL
$ rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

3. 설치
$ yum install git git-daemon

fluentd couchdb elasticsearch kibana ubuntu 14.04


- port -
elasticsearch : 9200
couchdb : 5984


1. elasticsearch install

$ sudo apt-get install openjdk-7-jre-headless -y
$ sudo wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -


$ sudo vi /etc/apt/sources.list
  -> deb http://packages.elasticsearch.org/elasticsearch/1.3/debian stable main

$ sudo apt-get update
$ sudo apt-get install elasticsearch
$ sudo update-rc.d elasticsearch defaults 95 10
$ sudo /etc/init.d/elasticsearch start


2. fluentd install
$ curl -L http://toolbelt.treasuredata.com/sh/install-ubuntu-lucid.sh | sh
$ sudo /usr/lib/fluent/ruby/bin/fluent-gem install fluent-plugin-elasticsearch




3. fluentd power up
- multiprocess
  http://docs.fluentd.org/articles/in_multiprocess
- ruby memory fix
  https://github.com/kzk/jemalloc-rb

4. elasticsearch + couchdb

$ curl -XPUT 'http://localhost:9200/news/'
$ cd /usr/share/elasticsearch/
$ ./bin/plugin -install elasticsearch/elasticsearch-river-couchdb/1.2.0

 - date set time format, it is options
$ curl -XPUT localhost:9200/news/news/_mapping -d '{
    "news" : {
         "numeric_detection" : false,
          "properties" : {
               "creation" : {"format":"date_time_no_millis","type" : "date"}
        }
    }
}'
 - add river (it's connect couchdb)
$ curl -XPUT 'localhost:9200/_river/news/_meta' -d '{
     "type" : "couchdb",
     "couchdb" : {
          "host" : "localhost",
          "port" : 8888,
          "db" : "news",
          "filter" : null
     },
     "index" : {
          "index" : "news",
          "type" : "news",
          "bulk_size" : "100",
          "bulk_timeout" : "10ms"
     }
}'

- river delete
curl -XDELETE 'http://localhost:9200/_river/news/'

- news delete
curl -XDELETE 'http://localhost:9200/news/'


 - option
5. fluentd + geoip
$ sudo apt-get install libgeoip-dev
$ sudo /usr/lib/fluent/ruby/bin/fluent-gem install fluent-plugin-geoip

<match low.lighttpd.log>
     type copy
     <store>
          type    geoip
          geoip_lookup_key  host
     <record>
          city  ${city['host']}
          lat   ${latitude['host']}
          lon   ${longitude['host']}
     </record>
     remove_tag_prefix low.
     tag     couch.${tag}
     </store>
</match>

6. kibana download
http://www.elasticsearch.org/overview/kibana/

vi config.js
elasticsearch: "http://127.0.0.1:9200"