1 | #!/bin/bash |
---|
2 | # |
---|
3 | |
---|
4 | # 變數宣告 |
---|
5 | Work_Path="./" |
---|
6 | Work_Path_J=0 |
---|
7 | |
---|
8 | # Work Path setup |
---|
9 | echo $0 | grep '/' || Work_Path_J=1 |
---|
10 | if [ "$Work_Path_J" == "0" ]; then |
---|
11 | Work_Path=$(echo $0 | sed 's/install//') |
---|
12 | fi |
---|
13 | |
---|
14 | # Source functions |
---|
15 | source $Work_Path/install_func.sh |
---|
16 | source $Work_Path/install_lang.zh |
---|
17 | ### real code ##### |
---|
18 | |
---|
19 | # 前置作業 |
---|
20 | # *.sh及nutchez-0.2-0531.tar.gz均在同一目錄下 |
---|
21 | |
---|
22 | function show_info () { |
---|
23 | if [ $? -eq 0 ]; then |
---|
24 | echo -e "\033[1;32;40m $1 \033[0m" |
---|
25 | fi |
---|
26 | } |
---|
27 | |
---|
28 | main () { |
---|
29 | check_info |
---|
30 | show_info $main_echo_1 |
---|
31 | # show_info "歡迎使用NutchEZ, 此安裝程序會為您新建一個nutchuser帳號並協助您設定密碼" |
---|
32 | set_install_information |
---|
33 | read -p "$main_echo_2" confirm |
---|
34 | # read -p "Please confirm your install infomation: 1.Yes 2.No " confirm |
---|
35 | if [ $confirm -eq 1 ]; then |
---|
36 | creat_nutchuser_account $Nutchuser_Passwd |
---|
37 | make_ssh_key |
---|
38 | |
---|
39 | # 解壓縮 |
---|
40 | tar -zxvf nutchezV2-current.tar.gz -C /opt/ |
---|
41 | Install_Nutch |
---|
42 | mkdir /var/nutchez |
---|
43 | chown -R nutchuser:nutchuser /opt/nutchez |
---|
44 | chown -R nutchuser:nutchuser /var/nutchez |
---|
45 | su nutchuser -c "mkdir /home/nutchuser/nutchez" |
---|
46 | su nutchuser -c "mkdir /home/nutchuser/nutchez/urls" |
---|
47 | su nutchuser -c "touch /home/nutchuser/nutchez/urls/urls.txt" |
---|
48 | su nutchuser -c "mkdir /home/nutchuser/nutchez/search" |
---|
49 | su nutchuser -c "mkdir /home/nutchuser/nutchez/source" |
---|
50 | su nutchuser -c "mkdir /home/nutchuser/nutchez/system" |
---|
51 | make_client_install |
---|
52 | |
---|
53 | # 啟動系統 |
---|
54 | format_HDFS |
---|
55 | start_up_NutchEZ |
---|
56 | start_up_tomcat |
---|
57 | # 安裝流程結束,並進入網頁管理頁面設定爬網網址...等 |
---|
58 | show_info $main_echo_3 |
---|
59 | # show_info "Install Successfully!!" |
---|
60 | show_info $main_echo_4 |
---|
61 | # show_info "Visit http://$MasterIP_Address:8080" |
---|
62 | client_install_commands |
---|
63 | elif [ $confirm -eq 2 ]; then |
---|
64 | main |
---|
65 | fi |
---|
66 | } |
---|
67 | |
---|
68 | main |
---|