source: nutchez-0.2/src/test/client_install @ 191

Last change on this file since 191 was 191, checked in by rock, 14 years ago
  • Property svn:executable set to *
File size: 2.5 KB
RevLine 
[117]1#!/bin/bash
[122]2# Program:
3#   Check root identity and change root to exectue client_install.sh
4# Author:
5#   Waue, Shunfa, Rock {waue, shunfa, rock}@nchc.org.tw
6# History:
7#   2010/05/20  Rock    First release
[117]8
[123]9# 正式版之後,記的將不必要 read 拿掉 (trace 用的 read)
[122]10
11# 設定 functions
12. ./client_install_func.sh
13
[132]14# 需要 master_install 設定的參數區
[140]15# Master IP here
[169]16Master_IP_Address=input.your.master.ip_address
[152]17# Master Hostname here
[169]18Master_Hostname=input_your_master_hostname
[119]19# 此檔自己用的參數區
20Linux_Distribution="";
21Linux_Version="";
[135]22Nutchuser_Passwd="xxxxxxxxxx";
[119]23
[169]24###print function###
25function debug_info () {
26  if [ $? -eq 0 ]; then
27    echo -e "\033[1;35;40m info - $1 \033[0m"
28  fi
29}
30
31function show_info () {
32  if [ $? -eq 0 ]; then
33    echo -e "\033[1;32;40m $1 \033[0m"
34  fi
35}
36
[188]37# Language Choice
38choose_lang
39
[129]40# 參數詢問
[132]41yesno="no"
[188]42show_info "$par_echo_1 $Master_IP_Address"
43read -p "$par_echo_2" yesno
[129]44             
[132]45if [ "$yesno" == "yes" ] || [ "$yesno" == "y" ] ; then
[188]46    show_info "$par_echo_3"
[132]47else
[188]48    show_info "$par_echo_4"
[132]49    exit
[129]50fi
51
[119]52
53# 檢查執行這個程式的是否為root權限
[117]54check_root
[191]55read -p "continue.."
[117]56
[123]57# 查出此主機的作業系統,以及版本
[117]58check_systemInfo
[191]59read -p "continue.."
[117]60
[132]61# 安裝需要的套件 (目前只支援 deb 套件的系統自動安裝,yum或其他套件系統的則必須手動安裝)
62# 需要套件名稱 ssh, expect, dialog
63install_packages
[191]64read -p "continue.."
[132]65
[119]66# 檢查之前是否有安裝NutchEz
67# 目前先檢查是否有/opt/nutchez 這個資料夾即可
[117]68check_nez_installed
[191]69read -p "continue.."
[117]70
[119]71# 檢查是否有安裝sun java ,並檢查是否為jdk 1.6 以上版本
[135]72check_sunJava
[191]73read -p "continue.."
[117]74
[119]75# 檢查是否有安裝openssh, openssh-server
[123]76check_ssh
[191]77read -p "continue.."
[117]78
[123]79# 檢查是否有安裝dialog
80check_dialog
[191]81read -p "continue.."
[117]82
[142]83# 新增nutchuser 帳號時用 Nutchuser_Passwd 當密碼
84creat_nutchuser_account
[191]85read -p "continue.."
[142]86
[117]87# scp nutchuser@master_ip:~ 把.ssh/目錄複製下來
88# 當使用者輸入nutchuser 密碼時,將此密碼紀錄到Nutchuser_Passwd
89# 此步驟若無法連到 master 則跳出
[128]90scp_master_nutchuser_sshkey $Master_IP_Address
[191]91read -p "continue.."
[117]92
93# 用scp 複製 master 的設定與安裝資料
[119]94# 目前僅需做到能無礙的複製遠端的/opt/nutchez/到local的/opt/
[128]95scp_packages $Master_IP_Address
[191]96read -p "continue.."
[117]97
[146]98# 安裝及啟動
[144]99install_nutch_package
[191]100read -p "continue.."
[117]101
[147]102# 回覆 Hostname 和 IP 給 Master Server
103recall_hostname_ip $Master_IP_Address
[191]104read -p "continue.."
Note: See TracBrowser for help on using the repository browser.