2011年5月12日 星期四

ntp server in taiwan

server 1.tw.pool.ntp.org
server 0.asia.pool.ntp.org
server 2.asia.pool.ntp.org

2011年5月11日 星期三

Bind9 dns system with master and slave

1.install bind9 system packages on master and slave server
#apt-get update
#apt-get upgrade
#apt-get install bind9 bind9-doc


2.modify /etc/hosts and add two server record like this
#vim /etc/hosts
127.0.0.1 localhost
192.168.11.111 master.csp.com.tw master
192.168.11.50 slave.csp.com.tw slave

3.modify /etc/resolv.conf and add nameserver setting about master and slave
#vim /etc/resolv.conf
nameserver 192.168.11.111
nameserver 192.168.11.50


4.modify /etc/bind/named.conf.local on master to add new zone to allow transfer
#vim /etc/bind/named.conf.local
zone "csp.com.tw" {
type master;
file "/etc/bind/db.csp.com.tw";
allow-transfer {
192.168.11.50;
};
notify yes;
};

zone "2.10.10.in-addr.arpa" {
type master;
file "/etc/bind/db.10.10.2";
allow-transfer {
192.168.11.50;
};
notify yes;
};

5.add new file name db.csp.com.tw and db.10.10.2 about setting zone csp.com.tw
#vim /etc/bind/db.csp.com.tw

; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA csp.com.tw. admin. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1
@ IN MX 5 mail1.csp.com.tw.
@ IN MX 10 mail2.csp.com.tw.

www1 IN A 66.77.88.120
www2 IN A 66.77.88.120
dns IN A 10.10.2.171
ftp IN A 10.10.2.172
mail1 IN A 10.10.2.200
mail2 IN A 10.10.2.201
webapp1 IN CNAME www1.csp.com.tw.
webapp2 IN CNAME www2.csp.com.tw.
================db.10.10.2=======================
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA csp.com.tw. admin. (
2011052301 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS dns.csp.com.tw.

172 IN PTR ftp.csp.com.tw.

6.modify /etc/bind/named.conf.options
#vim /etc/bind/named.conf.options

acl "trusted" { 127.0.0.1; 192.168.11.0/24; };

options {
directory "/var/cache/bind";

allow-recursion { trusted; };
allow-transfer { none; };
notify no;

auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};

7.restart bind service on master server
#/etc/init.d/bind9 restart

8.modify /etc/bind/named.conf.local on slave server

#vim /etc/bind/named.conf.local

zone "csp.com.tw" {
type slave;
file "db.csp.com.tw";
masters {
192.168.11.111;
};
};

zone "2.10.10.in-addr.arpa" {
type slave;
file "db.10.10.2";
masters {
192.168.11.111;
};
};



9.restart bind service on slave server

10.check /var/cache/bind to find new file named db.csp.com.tw transfered from master server

how to find installed packages on ubuntu system

root@django:/etc/bind# dpkg --get-selections | grep bind
bind9 install
bind9-doc install
bind9-host install
bind9utils install
libbind9-60 install

it will list all packags about bind installed in your system


root@django:/etc/bind# dpkg -L bind9
/etc
/etc/ufw
/etc/ufw/applications.d
/etc/ufw/applications.d/bind9
/etc/apparmor.d
/etc/apparmor.d/force-complain
/etc/apparmor.d/usr.sbin.named
/etc/bind
/etc/bind/bind.keys
/etc/bind/db.0
/etc/bind/db.255
/etc/bind/db.empty
/etc/bind/zones.rfc1918
/etc/bind/db.127
/etc/bind/db.local
/etc/bind/db.root

it will show files within the packages you search

2011年4月27日 星期三

reactive eth0 if mac is binded

SIOCSIFADDR No such device eth0 error while getting interface flags

#vim /etc/udev/rules.d/70-persistent-net.rules
delete eth0 line

#sudo reboot

2011年3月2日 星期三

how to change language

#dpkg-reconfigure locales

you must change language interface on web interface

2010年11月30日 星期二

how to install hadoop on ubuntu 10.04 LTS server installion 1

1.install ubuntu l0.04 LTS version

2.update,upgrade and install ssh
#apt-get update
#apt-get upgrade
#apt-get install ssh

3.install sun-6-java jdk
#apt-get install openjdk-6-java

4.create new user hadoop and group
#addgroup hadoop
#adduser --ingroup hadoop hadoop

5.generate ssh key to auto login to manager all nodes
#ssh-keygen -t rsa -P ""

6.disable ipv6 and reboot machine
#vim /etc/modprobe.d/blacklist
add new line in it
blacklist ipv6

7.download hadoop from mirror site
#wget http://XXX.XXX.XXX.XXX/hadoop-0.21.0.tar.gz

8.untar hadoop-0.21.0.tar.gz and rename it to hadoop
#tar zxvf hadoop-0.21.0.tar.gz
#mv hadoop-0.21.0

9.change owner and group to hadoop on hadoop folder
#chown -R hadoop:hadoop hadoop/

10.confirm java home folder
#ls -l `whereis javac`

11.modify hadoop home folder hadoop-env.sh
#vim hadoop/conf/hadoop-env.sh
uncomment export JAVA_HOME and modify it
export JAVA_HOME = /usr/lib/jvm/java-6-openjdk/

12.config hadoop config file
#vim hadoop/conf/core-site.xml
add these line into it
<property>
    <name>hadoop.tmp.dir</name>
    <value>/home/hadoop/hadoop/tmp/dir/hadoop-hadoop</value>
</property>
<property>
    <name>fs.default.name</name>
    <value>hdfs://10.124.2.225</value>
</property>

13.config hadoop file with hdfs-site.xml
#vim hadoop/conf/hdfs-site.xml
add these line into it
<property>
    <name>dfs.replication</name>
    <value>1</value>
<property>

14.config hadoop file with mapred-site.xml
#vim hadoop/conf/mapred-site.xml
add these line into it
<property>
    <name>mapred.job.tracker</name>
    <value>10.124.2.225:54311</value>
</property>

15.formating the namenode
#hadoop/bin/hadoop namenode -format

16.start cluster
#hadoop/bin/start-all.sh

17.check hadoop process
#hadoop/bin/jps

18.use netstat to check all service running status
#netstat -plten | grep java

19.stop cluster
#hadoop/bin/stop-all.sh

20.start cluster
#hadoop/bin/start-all.sh

21.mkdir a folder for gutenberg and touch three files with contents
#mkdir /tmp/gutenberg
#cd /tmp/gutenberg
#vim 1.txt
#vim 2.txt
#vim 3.txt

21.use hadoop fs copyFromLocal copy files to hdfs folder
#hadoop/bin/hadoop fs -copyFromLocal /tmp/gutenberg gutenber

22.check hdfs folder content
#hadoop/bin/hadoop fs -ls
#hadoop/bin/hadoop fs -ls gutenberg

23.use java wordcount to calculate the words number
#hadoop/bin/hadoop jar hadoop-mapred-examples-0.21.0.jar wordcount gutenberg gutenberg-output

24.list gutenberg-output folder content
#bin/hadoop fs -ls gutenberg-output

25.mkdir one subfolder on folder tmp
#mkdir /tmp/gutenberg-output

26.copy data from hdfs to local folder
# bin/hadoop fs -copyToLocal gutenberg-output/part-r-00000 /tmp/gutenberg-output/

27.show content for part-r-000000
#more /tmp/gutenberg-content/part-r-00000

2010年11月18日 星期四

how to confirm java_home

1.install java 1.6 jdk
#apt-get install openjdk-6-jdk

2.use whereis to find javac
#whereis javac

3.use ls -al to confirm if javac is a symbolic
#ls -al `whereis javac`

4.use export java_home
#export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre