2012年8月10日 星期五
[Hadoop] 基本環境建立-2
[Sun JDK6]
0. download jdk file from sun: jdk-6u32-linux-x64.bin
FTP to host
1. #create jdk folder
cd /etc
sudo mkdir jdk
cd jdk
sudo cp /home/hadoop/jdk-6u32-linux-x64.bin .
2. #install
chmod 755 jdk-6u32-linux-x64.bin
sudo -s ./jdk-6u32-linux-x64.bin
[Tomcat7]雖然後來沒用~ 不過都已經試完了就記錄一下Orz...
1. Download/SFTP tar.gz to /home/hadoop
2. #move and unzip files
cd /etc
sudo mkdir tomcat
sudo chown -R hadoop tomcat
cd tomcat7
cp /home/hadoop/apache-tomcat-7.0.26.tar.gz .
tar -zxv -f apache-tomcat-7.0.26.tar.gz
3. #tomcat setting
change to port80 vim server.xml
open manager user vim tomcat-users.xml
envir var sudo vim environment
//有裝Sun-JDK也可以指過去~
JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
JRE_HOME="/usr/lib/jvm/java-6-openjdk/jre"
PATH="...(other path):$JAVA_HOME:$JRE_HOME"
#notice port server
cat /etc/services
4. #test single startup server
bin/startup.sh
bin/shupdown.sh
5. #start on boot
#create file script into init.d/tomcat.sh, notice +x and notice path
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
export JAVA_JRE=/usr/lib/jvm/java-6-openjdk/jre
cd /etc/tomcat7/apache-tomcat-7.0.26
bin/startup.sh
#add shell into init.d
update-rc.d -f tomcat defaults
//看到這我突然想起來~用apt-get的postgres owner比較不會有問題~ Option install的那個會好像沒辦法su~ 還是沒有postgres那個user..忘了XD..反正是apt-get安裝的比較正常...
不過apt-get都只會找最新版的~看他apt-get怎麼看~ 如果要指定某一版就要找一下指令位置
//另從9開始~ 他預設的語系並不是UTF-8..會"很有問題"~ 所以請在一開始對DB整個砍掉-->2
//預設的super user是沒有密碼的樣子~ 先處理之後才不會有管理問題
[PostgreSQL (DON'T use server disk install..user strange)]
1. #Install postgresql (You will get the newest 9.1)
#bin locate=/usr/lib/postgresql/9.1/bin/
#conf locate=/etc/postgresql/9.1/main/
sudo apt-get install postgresql
2. #create new Server to change encoding!!
cd /usr/lib/postgresql/9.1/bin/
sudo pg_dropcluster --stop 9.1 main
sudo pg_createcluster --start -e UTF-8 9.1 main
2. #Reset Password
sudo -u postgres psql postgres
\password postgres
\q
3. #allow ip access
cd /etc/postgresql/9.1/main/
sudo vim pg_hba.conf
#Add
host all all 192.168.{net}.1/24 trust
#listen for all
sudo vim postgresql.conf
#Update
listen_addresses='*'
4. #reStart Server
sudo /etc/init.d/postgresql restart
5. Use GUI Access..Check
[PostGIS]
0. #slove locale bug if needed
sudo locale-gen
sudo locale-gen --lang zh_TW.UTF-8
1. Install PostgreSQL down..
2. #apt-get install, according version of the postgreSQL
sudo apt-get install postgresql-9.1-postgis
# install path=/usr/share/postgresql/9.1/contrib
3. #crate template db
sudo su postgres
createdb template_postgis
createlang plpgsql template_postgis
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
4. #check database
select postgis_lib_version();
//要養成好習慣~ 反正先建個其他帳號來ACCESS...如果有GUI可以用gui玩比較順~當時是因為只有黑白畫面Orz...
[DB create]
1. #create a new database(roadinfo) and owner is {user}/{pwd}
sudo su postgres
psql postgres
CREATE USER {user} WITH PASSWORD ' {pwd} ' CREATEDB;
CREATE DATABASE {db} OWNER {user} ;
#or DB support postGIS
CREATE DATABASE {db} OWNER {user} TEMPLATE template_postgis;
2. dump DB from testing/dev
#move path into backup path
cd /etc/hadoop
#dump
pg_dump --host {ip} --username {user} {db2} > {db2 name}.backup
3. restore DB to database
psql {db} < {db2 name}.backup
4. If owner errors.. change table owner to its
psql {user}
ALTER TABLE {table} OWNER TO {user};
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言