狼愛上貍

          我胡漢三又回來了

          Globus 4.0.1安裝指南

          Globus 4.0.1安裝指南 

                               作者:施宇光 

                     

                  

               本文首發在cublog,轉載請注名原貼地址如下:http://blog.chinaunix.net/u/21765/showart.php?id=170690

                 

                       

           

          安裝JDK

          假如jdk安裝文件j2sdk-1_4_2_11-linux-i586-rpm.bin放在/usr/i_files/

           

          root# /usr/i_files/j2sdk-1_4_2_11-linux-i586-rpm.bin

           

          出現jdk安裝協議,看完后鍵入 y 同意。注:空格鍵翻頁

          root# rpm -ivh j2sdk-1_4_2_11-linux-i586.rpm

          程序解包安裝,成功。默認安裝路徑為/usr/java/j2sdk1.4.2_11

           

           

          設置環境變量,打開~/.bash_profile文件,可以用gedit打開

          root# gedit ~/.bash_profile

           

          在文件中加入

          export JAVA_HOME=/usr/java/j2sdk1.4.2_11

          export CLASSPATH=/usr/java/j2sdk1.4.2_11/lib/dt.jar:/usr/java/j2sdk1.4.2_11/jre/lib/rt.jar:.

           

          如果你使用的是Fedora Core系統,那么你還需要做如下設置,以便使系統默認使用我們剛剛安裝的jdk

          root#  /usr/sbin/alternatives --install /usr/bin/java java /usr/java/j2sdk1.4.2_11/bin/java 2

          root# /usr/sbin/alternatives --config java

           

          共有 2 個程序提供“java”。

           

           選擇    命令

          -----------------------------------------------

          *+ 1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java

             2           /usr/java/j2sdk1.4.2_11/bin/java

           

          Enter 來保存當前選擇[+],或鍵入選擇號碼:2

           

           

          —————————————————————————————————————

          root# /usr/sbin/alternatives --install /usr/bin/javac javac /usr/java/j2sdk1.4.2_11/bin/javac 2

          root# /usr/sbin/alternatives --config javac

           

          共有 2 個程序提供“javac”。

           

           選擇    命令

          -----------------------------------------------

          *+ 1           /usr/lib/jvm/java-1.4.2-gcj/bin/javac

             2           /usr/java/j2sdk1.4.2_11/bin/javac

           

          Enter 來保存當前選擇[+],或鍵入選擇號碼:2

           

           

          這里都選擇2,即我們自己剛剛安裝的jdk路徑。

           

          測試jdk是否安裝成功,打開終端

          root# java

          Usage: java [-options] class [args...]

                     (to execute a class)

             or java [-options] -jar jarfile [args...]

                     (to execute a jar file)

           

          where options include:

              -client       to select the "client" VM

              -server       to select the "server" VM

          ........................................

          ..........................

          ...............

           

          出現以上信息表示java可用

           

          root# javac

          Usage: javac <options> <source files>

          where possible options include:

           -g                        Generate all debugging info

           -g:none                   Generate no debugging info

           -g:{lines,vars,source}    Generate only some debugging info

           -nowarn                   Generate no warnings

          ........................................

          ..........................

          ...............

           

          出現以上信息表示javac可用

          安裝ANT

           

          http://jakarta.apache.org下載ant壓縮文件apache-ant-1.6.0-bin.tar.gz,這里使用的版本是1.6.0

           

          解壓后,將所有文件復制到 /usr/local/ant

           

          然后設置環境變量

           

          root# gedit ~/.bash_profile

           

          在文件中加入

          export ANT_HOME=/usr/local/ant

           

          在終端運行

           

          root# ant

           

          Buildfile: build.xml does not exist!

          Build failed

           

          顯示如上結果即表示ant設置成功。

          安裝PostgreSQL

           

          :按照本文使用命令時注意用戶身份,root#表示根用戶

           

          創建安裝文件放置路徑

          創建用戶并授權給安裝文件路徑

          root# mkdir /usr/post_install

          root# adduser postgres

          root# chown postgres:postgres /usr/post_install

           

          下載程序源代碼文件到存放路徑

          下載地址為ftp://ftp.postgresql.org/pub/source

           

          本文使用的文件為postgresql-8.1.3.tar.bz2

           

          解壓軟件

           

          root# su postgres

          postgres$ tar -jxvf /usr/post_install/postgresql-8.1.3.tar.bz2

           

          進入源代碼目錄

           

          postgres$ cd /usr/pos_install/postgresql-8.1.3

           

          配置編譯選項

          postgres$ mkdir /usr/local/pgsql

          root# chown postgres:postgres /usr/local/pgsql

          postgres$ ./configure --prefix=/usr/local/pgsql

           

          其中/usr/local/pgsql使我們指定的將要安裝的目錄

           

          編譯

          postgres$ gmake

           

          成功后顯示

          All of PostgreSQL successfully made. Ready to install.

           

          安裝

          postgres$ gmake install

           

          成功后顯示

          PostgreSQL installation complete.

           

          創建數據庫存儲目錄

          root# mkdir -p /etc/database/pgsql_data/

          root# chown postgres:postgres /etc/database/pgsql_data/

           

          初始化數據庫

          postgres$ /usr/local/pgsql/bin/initdb -D /etc/database/pgsql_data/

           

          成功后顯示如下

          Success. You can now start the database server using:

           

              /usr/local/pgsql/bin/postmaster -D /etc/database/pgsql_data

          or

              /usr/local/pgsql/bin/pg_ctl -D /etc/database/pgsql_data -l logfile start

           

          設置共享庫

          root# /sbin/ldconfig /usr/local/pgsql/lib

           

          設置環境變量

          root# gedit ~/.bash_profile

           

          啟動數據庫服務

          postgres$ /usr/local/pgsql/bin/pg_ctl -D /etc/database/pgsql_data -l logfile start

           

          成功后顯示

          postmaster starting

          You have mail in /var/spool/mail/root

           

          創建測試庫

          postgres$ /usr/local/pgsql/bin/createdb test

           

          成功后顯示

          CREATE DATABASE

           

          試用測試庫

          postgres$ /usr/local/pgsql/bin/psql test

           

          成功后顯示

          Welcome to psql 8.1.3, the PostgreSQL interactive terminal.

           

          Type: \copyright for distribution terms

                 \h for help with SQL commands

                 \? for help with psql commands

                 \g or terminate with semicolon to execute query

                 \q to quit

           

          test=#

           

           

          啟動腳本,以便系統啟動時自動加載PostgreSQL服務

           

          將源碼文件夾下的linux文件拷貝到init.d

          root# cp /usr/post_install/postgresql-8.1.3/contrib/start-scripts/linux /etc/init.d/postgresql

           

          編輯此文件

          root# gedit /etc/init.d/postgresql

           

          更改參數為自己安裝時設定的目錄

          # Installation prefix

          prefix=/usr/local/pgsql   :安裝目錄

           

          # Data directory

          PGDATA="/etc/database/pgsql_data"   :數據庫目錄

           

           

          如果需要通過遠程網絡訪問數據庫,同時修改start,restart如下

           

          start)

              $ECHO_N "Starting PostgreSQL: "$ECHO_C

              su - $PGUSER -c "$DAEMON -i -D '$PGDATA' &" >>$PGLOG 2>&1

              echo "ok"

              ;;

          -----------------------------

           restart)

              echo -n "Restarting PostgreSQL: "

              su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"

              su - $PGUSER -c "$DAEMON -i -D '$PGDATA' &" >>$PGLOG 2>&1

              echo "ok"

              ;;

           

          最后修改權限

          root# chmod a+x /etc/init.d/postgresql

          root# chkconfig --add postgresql

           

           

          安裝zlib

          下載zlib-1.2.3.tar.gz,解壓縮到目錄

           

          編譯準備

          root# ./configure --prefix=/usr --shared

           

          編譯

          root# make

           

          測試共享庫

          root# make check

           

          成功后顯示

          *** zlib test OK ***

           

          安裝共享庫

          root# make install

           

          編譯并安裝靜態庫

          root# make clean

          root# ./configure --prefix=/usr

          root# make

          root# make check

          root# make install

           

          修改靜態庫權限

          root# chmod 644 /usr/lib/libz.a

           

          我們可以將庫轉移到通常的/lib目錄下

          root# mv /usr/lib/libz.so.* /lib

          root# ln -sf ../../lib/libz.so.1 /usr/lib/libz.so

           

          zlib安裝完畢

           

          安裝lam-mpi

           

          http://www.lam-mpi.org下載文件,本文使用lam-7.1.2-1.i586.rpm

           

          root# rpm -ivh lam-7.1.2-1.i586.rpm

           

          root# lamboot

           

          顯示提示信息即表示安裝成功

           

          lam-mpi安裝完畢

           

          至此前提軟件安裝完畢

           

          安裝GT4.0.1

           

          root用戶創建 globus 用戶,并創建安裝目錄,將權限付給globus

          root# mkdir /usr/local/globus-4.0.1

          root# chown globus:globus /usr/local/globus-4.0.1

           

          下載GT4.0.1原文件包, globus 用戶解壓并進行配置。

          注:安裝用原文件應該用globus用戶解壓到一個權限歸globus用戶所有的文件夾,否則下邊的命令將出現權限錯誤

           

          進入解壓目錄后,進行編譯設置

          globus$ export GLOBUS_LOCATION=/usr/local/globus-4.0.1

          globus$ ./configure --prefix=$GLOBUS_LOCATION

           

          注:為了方便執行,可以將export GLOBUS_LOCATION=/usr/local/globus-4.0.1加入到/etc/profile~/.bash_profile

           

          無錯誤出現后即可進行編譯

          globus# make 2>&1 | tee build.log

           

          也可以不加參數,直接make,不同在于上邊參數可以生成編譯日志文件build.log,如果編譯失敗可疑分析原因。

           

          接下來就是漫長的編譯過程。

           

          編譯成功后即可進行安裝

          globus# make install

           

          無錯誤提示即表示安裝完成。下邊我們進行GT4的配置

           

          ----------------------------------------------

           

          配置GT4

           

          作為globus登錄,設置GLOBUS_LOCATION指向GT4的安裝路徑

          globus$ export GLOBUS_LOCATION=/usr/local/globus-4.0.1

          globus$ . GLOBUS_LOCATION/etc/globus-user-env.sh

           

          注:在“.”的后邊有一個空格。

           

          申請主機證書

           

          為了運行GT4,必須為主機分配證書。其中:

          證書必須包含兩個文件:hostcert.pemhostkey.pem

          這兩個文件必須必須在正確的路徑下 /etc/grid-security/

          主機在DNS上必須有一個固定的域名,不可以運行在DHCP服務的服務器上。

           

          為此,可以選擇:

           

          從一個以及存在的CA處申請一個證書。

           

          安裝SimpleCA,并使之為我們分配證書。

           

          使用globus提供的low-trust證書。

           

          這里,我們選擇一個比較容易實現的方法,就是安裝SimpleCA。在下面一節里面我們將介紹如何安裝和配置SimpleCA。

           

          如果是在第一臺機器上安裝也應該安裝SimpleCA,以便以后為其他多臺機器提供服務。

           

          安裝和配置SimpleCA

           

          1.創建用戶

           

                 保證系統中存在這樣的用戶:

           

          l           普通的用戶賬號,用來執行客戶端的程序。

           

          l           一個globus賬號,用來執行管理的任務。如啟動、停止容器,部署服務等。同時,這個用戶還負責管理SimpleCA。為此,需要保證該用戶對$GLOBUS_LOCATION目錄有讀寫權限。在第1章中我們以及創建了這樣一個用戶。

           

          注:如果編譯安裝的時候沒有正確的設定權限,可以用chown命令來修改

          root# chown globus:globus -R /usr/local/globus-4.0.1

           

          注:參數-R表示遞歸的將目錄下所有的子目錄及文件同時更改權限

           

          2.運行安裝腳本

           

                 對每個網格,只需運行一次下面的腳本即可。

          globus$ export GLOBUS_LOCATION=/usr/local/globus-4.0.1

          globus$ GLOBUS_LOCATION/setup/globus/setup-simple-ca

           

          在此過程中,程序會提醒你關于你想創建的CA的信息,如:

          C e r t i f i c a t e    A u t h o r i t y    S e t u p

           

          This script will setup a Certificate Authority for signing Globus

          users certificates. It will also generate a simple CA package

          that can be distributed to the users of the CA.

           

          The CA information about the certificates it distributes will

          be kept in:

           

          /home/globus/.globus/simpleCA/

          /usr/local/globus-4.0.1/setup/globus/setup-simple-ca: line 250: test: res: integer expression expected

           

          The unique subject name for this CA is:

           

          cn=Globus Simple CA, ou=simpleCA-syg.localdomain, ou=GlobusTest, o=Grid

           

          Do you want to keep this as the CA subject (y/n) [y]:

           

          推薦默認選項,按y繼續。接下來,會提示你輸入用來發送證書的email地址:

          Enter the email of the CA (this is the email where certificate requests will be sent to be signed by the CA):

           

          其實會在本地產生認證文件,也可以任意輸入email地址

          這時,系統提示你輸入證書過期的時間。默認是5年,接受即可。

          The CA certificate has an expiration date. Keep in mind that                 once the CA certificate has expired, all the certificates                 signed by that CA become invalid. A CA should regenerate                 the CA certificate and start re-issuing ca-setup packages                 before the actual CA certificate expires. This can be done                 by re-running this setup script. Enter the number of DAYS                 the CA certificate should last before it expires.

           

          [default: 5 years (1825 days)]:

           

          緊接著,系統提示輸入生成密鑰的短語,即密碼。正確輸入并牢記,不得包含空格。

          Generating a 1024 bit RSA private key

           

                          ........++++++

           

                          ................++++++

           

                          writing new private key to '/home/globus/.globus/simpleCA//private/cakey.pem'

           

                          Enter PEM pass phrase:

           

          最后,你會看見下面的提示:

          A self-signed certificate has been generated for the Certificate Authority with the subject:                            /O=Grid/OU=GlobusTest/OU=simpleCA-mayed.mcs.anl.gov/CN=Globus Simple CA

           

          If this is invalid, rerun this script

           

          setup/globus/setup-simple-ca

           

          and enter the appropriate fields.

           

          ------------------------------------------------------------------

           

          The private key of the CA is stored in /home/globus/.globus/simpleCA//private/cakey.pem

           

          The public CA certificate is stored in /home/globus/.globus/simpleCA//cacert.pem

           

          The distribution package built for this CA is stored in

           

          /home/globus/.globus/simpleCA//globus_simple_ca_82c6af8a_setup-0.17.tar.gz

           

          這里顯示的信息對于以后在其它機器上進行安裝你的網格是十分重要的。在最后一行的數字82c6af8a是你的CA hash,它是一個8位的十六進制的字符串。安裝繼續進行,直到你看到類似下面的內容,證明安裝以及結束。

           

          ******************************************************************

           

          Note: To complete setup of the GSI software you need to run the following script as root to configure your security configuration directory:

           

          /opt/gt4/setup/globus_simple_ca_68ea3306_setup/setup-gsi

           

          For further information on using the setup-gsi script, use the -help option. The -default option sets this security configuration to be the default, and -nonroot can be used on systems where root access is not available.

           

          ******************************************************************

           

          setup-ssl-utils: Complete

           

          如果出現問題,可以嘗試以下命令

          root# GPT_LOCATION=/usr/local/globus-4.0.1

          root# /usr/local/globus-4.0.1//sbin/gpt-build -force /home/globus/.globus/simpleCA//globus_simple_ca_82c6af8a_setup-0.18.tar.gz

           

          root# $GLOBUS_LOCATION/sbin/gpt-postinstall

          root# $GLOBUS_LOCATION/sbin/gpt-build /home/globus/.globus/simpleCA//globus_simple_ca_82c6af8a_setup-0.18.tar.gz

           

          3.安裝GSI

           

                 root用戶登錄,運行:

          root# $GLOBUS_LOCATION/setup/globus_simple_ca_CA_Hash_setup/setup-gsi -default

           

          其中,Hash表示你的CA Hash,應該用82c6af8a代替。這里每次安裝時獲得的CA Hash是不一樣的,應該注意。

          setup-gsi: Configuring GSI security

          Making /etc/grid-security...

          mkdir /etc/grid-security

          Making trusted certs directory: /etc/grid-security/certificates/

          mkdir /etc/grid-security/certificates/

          Installing /etc/grid-security/certificates//grid-security.conf.82c6af8a...

          Running grid-security-config...

          Installing Globus CA certificate into trusted CA certificate directory...

          Installing Globus CA signing policy into trusted CA certificate directory...

          setup-gsi: Complete

           

          顯示如上即表示GSI安裝正確。

          -----------------------------------------------------

           

          證書的申請和發放

           

          host證書

           

          1.申請一個host證書

           

                 這個證書應該是給服務器申請的,這樣才可以向用戶發放證書。首先,使用root用戶登錄,運行命令:

          root# grid-cert-request –host ‘hostname’

           

          這里的hostname是服務器的主機名,比如“mci.uestc.edu.cn”。該命令會在服務器上創建3個文件,分別是:

           

          l           /etc/grid-security/hostkey.pem

           

          l           /etc/grid-security/hostcert_request.pem

           

          l           /etc/grid-security/hsotcert.pem(這是一個空的文件)

           

          之后,會通過郵件的方式將hostcert_request.pem發送給CA的管理員,即globus用戶。如果hostname寫本機地址,則在本機的/etc/grid-security下尋找到三個文件,自行拷貝出來,進行下邊的簽名步驟

           

          2.對host證書簽名

           

                 作為globus用戶登錄,并運行如下命令:

          globus$ grid-ca-sign –in hostcert_request.pem –out hostsigned.pem

           

          這個命令是對接受到的host證書進行簽名,從而生成hostsigned.pem文件。在此過程中,系統提示globus用戶輸入最初安裝SimpleCA時輸入的短語。

           

          3.獲得簽名證書

           

          作為root用戶登錄,將剛才生成的hostsinged.pem文件移到/etc/grid-security/目錄下并改名為hostcert.pem,從而覆蓋原先的空文件。這時,該文件的所有者是root,同時對其它用戶是只讀的權限。

           

          用戶證書

           

          1.申請證書

           

          首先,用一個普通用戶登錄。然后在命令行輸入如下命令:

           

          user$ grid-cert-request

           

          在此過程中,會提示你輸入passphrase。這個是用來生成密鑰的短語,要牢記。否則只能重新申請證書。

           

                 最后,系統中會生成如下三個文件:

           

          ·         ~$USER/.globus/usercert.pem (empty)

           

          ·         ~$USER/.globus/userkey.pem

           

          ·         ~$USER/.globus/usercert_request.pem

           

          其中usercert.pem是空文件,需要另外獲得。此時,會用email方式將usercert_request.pemSimpleCA的管理員。同樣,如果host配置時使用本機地址,則在本地的~$USER/.globus/下即可找到文件,拷貝出來簽名。

           

          2.對申請的證書進行簽名

           

                 SimpleCA的管理員賬號globus登錄,并運行如下命令

           

          globus$ grid-ca-sign -in usercert_request.pem -out signed.pem

           

          對通過email收到的usercert_request.pem進行簽名。這時,系統會提示globus用戶輸入在安裝SimpleCA過程中輸入的passphrase。正確輸入后就會根據usercert_request.pem生成一個signed.pem文件,并通過email將其發送給申請證書的用戶。

           

          3.獲得簽名證書

           

                 用普通用戶登錄,并接收來自email的經過簽名的signed.pem文件,將其拷貝到~$USRE/.globus/目錄下,并改名為usercert.pem。從而覆蓋原先生成的空文件。

           

          測試

           

                 為了對安裝在/etc/grid-security/certificates的證書進行校驗,需要運行如下命令:

          user$ grid-proxy-init –debug –verify

           

          如果一切正確,輸出的結果類似下面的內容:

           

          user$ grid-proxy-init -debug -verify

           

                  User Cert File: /home/user/.globus/usercert.pem

           

                  User Key File: /home/user/.globus/userkey.pem

           

                  Trusted CA Cert Dir: /etc/grid-security/certificates

           

                  Output File: /tmp/x509up_u1817

           

                  Your identity: /O=Grid/OU=GlobusTest/OU=simpleCA-mayed.mcs.anl.gov/OU=mcs.anl.gov/CN=User Name

           

                  Enter GRID pass phrase for this identity:

           

                  Creating proxy ..............................++++++++++++

           

                  ...............++++++++++++

           

                  Done

           

                  Proxy Verify OK

           

                  Your proxy is valid until: Sat Mar 20 03:01:46 2006

          使容器可以訪問證書

           

                 通過上述方法獲得證書的host key文件(/etc/grid-security/hostkey.pem)對于root用戶使只讀的。而此時容器會以非root用戶身份運行(可能使globus用戶)。為了讓容器也可以訪問證書,必須使用root賬號登錄并做如下改動:

          root# cd /etc/grid-security

           

          root# cp hostkey.pem containerkey.pem

           

          root# cp hostcert.pem containercert.pem

           

          root# chown globus.globus containerkey.pem containercert.pem

           

           

          執行結束后,/etc/grid-security目錄看起來像下面這樣:

          root# ls -l *.pem

           

          -rw-r--r-- 1 globus globus 1785 Oct 14 14:47 containercert.pem

           

          -r-------- 1 globus globus 887 Oct 14 14:47 containerkey.pem

           

          -rw-r--r-- 1 root root 1785 Oct 14 14:42 hostcert.pem

           

          -r-------- 1 root root 887 Sep 29 09:59 hostkey.pem

           

           

          添加授權

           

          為用戶添加授權,使之可以訪問服務。首先,需要作為root用戶登錄,創建/etc/grid-security/grid-mapfile文件。這時,你需要兩部分信息:

           

          l           用戶的主體名(subject name

           

          l           這個主體名應該映射到的賬號(account name

           

          這個文件的語法是每個用戶使用一行來表示,前面是用戶的主體名,后面跟著用戶的賬號。

           

                 為了得到這兩部分信息,可以使用grid-cert-info命令得到用戶的主體名,并用whoami命令得到用戶的賬號。例如:

           

          user$ grid-cert-info -subject

           

          /O=Grid/OU=GlobusTest/OU=simpleCA-hostname/OU=mcs.anl.gov/CN=user

           

          user$ whoami

           

          user

          可以使用grid-mapfile-add-entry命令向grid-mapfile文件中添加用戶。例如:

           

          root# $GLOBUS_LOCATION/sbin/grid-mapfile-add-entry -dn "/O=Grid/OU=GlobusTest/OU=simpleCA-mayed.mcs.anl.gov/OU=hostname/CN=user" -ln user

          結果grid-mapfile看起來應該像這樣:

           

          "/O=Grid/OU=GlobusTest/OU=simpleCA-hostname/OU=hostname/CN=user" user

           

          注:主體名兩側的雙引號是必須的,因為這樣可以忽略其中包含的空格。其中hostname即申請host證書時的服務器名。user是普通用戶名。

           

          基本安裝結束。

          posted on 2007-06-20 10:21 狼愛上貍 閱讀(2286) 評論(2)  編輯  收藏 所屬分類: Globus

          評論

          # re: Globus 4.0.1安裝指南[未登錄] 2007-10-20 15:29 劉偉

          你好 ,首先感謝 ,我看這你的blog裝上了globus但問題是 只要重啟就要重新安裝 [root@localhost ~]# globus-start-container -nosec
          bash: globus-start-container: command not found
          謝謝幫忙   回復  更多評論   

          # re: Globus 4.0.1安裝指南[未登錄] 2007-12-19 11:47 蝦米

          能不能幫幫我 我是普通二本學校的研究生 我想在我電腦上裝Globus 4.0.1 但是一點頭緒都沒有能不能幫幫我 可以吧你的QQ給我嗎?!有時間的話請回復,謝謝!  回復  更多評論   

          主站蜘蛛池模板: 弋阳县| 通江县| 会昌县| 邮箱| 东宁县| 彰武县| 昌黎县| 新郑市| 裕民县| 彰化市| 祁门县| 沈丘县| 铁岭县| 蒙城县| 龙门县| 辰溪县| 会同县| 兰溪市| 闸北区| 鄱阳县| 容城县| 连山| 东兰县| 三门峡市| 阿巴嘎旗| 兴国县| 河北区| 大余县| 商南县| 义乌市| 黄冈市| 涟水县| 曲松县| 柳林县| 浮山县| 启东市| 星子县| 清丰县| 永宁县| 平遥县| 凤城市|