Globus 4.0.1安裝指南
Globus 4.0.1安裝指南作者:施宇光
本文首發(fā)在cublog,轉(zhuǎn)載請注名原貼地址如下: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 |
出現(xiàn)jdk安裝協(xié)議,看完后鍵入 y 同意。注:空格鍵翻頁
root# rpm -ivh j2sdk-1_4_2_11-linux-i586.rpm |
程序解包安裝,成功。默認(rèn)安裝路徑為/usr/java/j2sdk
設(shè)置環(huán)境變量,打開~/.bash_profile文件,可以用gedit打開
root# gedit ~/.bash_profile |
在文件中加入
export JAVA_HOME=/usr/java/j2sdk export CLASSPATH=/usr/java/j2sdk |
如果你使用的是Fedora Core系統(tǒng),那么你還需要做如下設(shè)置,以便使系統(tǒng)默認(rèn)使用我們剛剛安裝的jdk。
root# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/j2sdk root# /usr/sbin/alternatives --config java
共有 2 個程序提供“java”。
選擇 命令 ----------------------------------------------- *+ 1 /usr/lib/jvm/jre- 2 /usr/java/j2sdk
按 Enter 來保存當(dāng)前選擇[+],或鍵入選擇號碼:2
|
—————————————————————————————————————
root# /usr/sbin/alternatives --install /usr/bin/javac javac /usr/java/j2sdk root# /usr/sbin/alternatives --config javac
共有 2 個程序提供“javac”。
選擇 命令 ----------------------------------------------- *+ 1 /usr/lib/jvm/java- 2 /usr/java/j2sdk
按 Enter 來保存當(dāng)前選擇[+],或鍵入選擇號碼: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 ........................................ .......................... ...............
|
出現(xiàn)以上信息表示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 ........................................ .......................... ...............
|
出現(xiàn)以上信息表示javac可用
安裝ANT
到http://jakarta.apache.org下載ant壓縮文件apache-ant-
解壓后,將所有文件復(fù)制到 /usr/local/ant下
然后設(shè)置環(huán)境變量
root# gedit ~/.bash_profile |
在文件中加入
export ANT_HOME=/usr/local/ant |
在終端運(yùn)行
root# ant
Buildfile: build.xml does not exist! Build failed |
顯示如上結(jié)果即表示ant設(shè)置成功。
安裝PostgreSQL
注:按照本文使用命令時注意用戶身份,root#表示根用戶
創(chuàng)建安裝文件放置路徑
創(chuàng)建用戶并授權(quán)給安裝文件路徑
root# mkdir /usr/post_install root# adduser postgres root# chown postgres:postgres /usr/post_install |
下載程序源代碼文件到存放路徑
下載地址為ftp://ftp.postgresql.org/pub/source
本文使用的文件為postgresql-
解壓軟件
root# su postgres postgres$ tar -jxvf /usr/post_install/postgresql- |
進(jìn)入源代碼目錄
postgres$ cd /usr/pos_install/postgresql- |
配置編譯選項(xiàng)
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. |
創(chuàng)建數(shù)據(jù)庫存儲目錄
root# mkdir -p /etc/database/pgsql_data/ root# chown postgres:postgres /etc/database/pgsql_data/ |
初始化數(shù)據(jù)庫
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 |
設(shè)置共享庫
root# /sbin/ldconfig /usr/local/pgsql/lib |
設(shè)置環(huán)境變量
root# gedit ~/.bash_profile |
啟動數(shù)據(jù)庫服務(wù)
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 |
創(chuàng)建測試庫
postgres$ /usr/local/pgsql/bin/createdb test |
成功后顯示
CREATE DATABASE |
試用測試庫
postgres$ /usr/local/pgsql/bin/psql test |
成功后顯示
Welcome to psql
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=#
|
啟動腳本,以便系統(tǒng)啟動時自動加載PostgreSQL服務(wù)
將源碼文件夾下的linux文件拷貝到init.d下
root# cp /usr/post_install/postgresql- |
編輯此文件
root# gedit /etc/init.d/postgresql |
更改參數(shù)為自己安裝時設(shè)定的目錄
# Installation prefix prefix=/usr/local/pgsql 注:安裝目錄
# Data directory PGDATA="/etc/database/pgsql_data" 注:數(shù)據(jù)庫目錄
|
如果需要通過遠(yuǎn)程網(wǎng)絡(luò)訪問數(shù)據(jù)庫,同時修改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" ;; |
最后修改權(quán)限
root# chmod a+x /etc/init.d/postgresql root# chkconfig --add postgresql |
安裝zlib庫
下載zlib-
編譯準(zhǔn)備
root# ./configure --prefix=/usr --shared |
編譯
root# make |
測試共享庫
root# make check |
成功后顯示
*** zlib test OK *** |
安裝共享庫
root# make install |
編譯并安裝靜態(tài)庫
root# make clean root# ./configure --prefix=/usr root# make root# make check root# make install |
修改靜態(tài)庫權(quán)限
root# chmod 644 /usr/lib/libz.a |
我們可以將庫轉(zhuǎn)移到通常的/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-
root# rpm -ivh lam-
root# lamboot |
顯示提示信息即表示安裝成功
lam-mpi安裝完畢
至此前提軟件安裝完畢
安裝GT
用root用戶創(chuàng)建 globus 用戶,并創(chuàng)建安裝目錄,將權(quán)限付給globus
root# mkdir /usr/local/globus- root# chown globus:globus /usr/local/globus- |
下載GT
注:安裝用原文件應(yīng)該用globus用戶解壓到一個權(quán)限歸globus用戶所有的文件夾,否則下邊的命令將出現(xiàn)權(quán)限錯誤
進(jìn)入解壓目錄后,進(jìn)行編譯設(shè)置
globus$ export GLOBUS_LOCATION=/usr/local/globus- globus$ ./configure --prefix=$GLOBUS_LOCATION |
注:為了方便執(zhí)行,可以將export GLOBUS_LOCATION=/usr/local/globus-
無錯誤出現(xiàn)后即可進(jìn)行編譯
globus# make 2>&1 | tee build.log |
也可以不加參數(shù),直接make,不同在于上邊參數(shù)可以生成編譯日志文件build.log,如果編譯失敗可疑分析原因。
接下來就是漫長的編譯過程。
編譯成功后即可進(jìn)行安裝
globus# make install |
無錯誤提示即表示安裝完成。下邊我們進(jìn)行GT4的配置
----------------------------------------------
配置GT4
作為globus登錄,設(shè)置GLOBUS_LOCATION指向GT4的安裝路徑
globus$ export GLOBUS_LOCATION=/usr/local/globus- globus$ . GLOBUS_LOCATION/etc/globus-user-env.sh |
注:在“.”的后邊有一個空格。
申請主機(jī)證書
為了運(yùn)行GT4,必須為主機(jī)分配證書。其中:
證書必須包含兩個文件:hostcert.pem和hostkey.pem
這兩個文件必須必須在正確的路徑下 /etc/grid-security/
主機(jī)在DNS上必須有一個固定的域名,不可以運(yùn)行在DHCP服務(wù)的服務(wù)器上。
為此,可以選擇:
從一個以及存在的CA處申請一個證書。
安裝SimpleCA,并使之為我們分配證書。
使用globus提供的low-trust證書。
這里,我們選擇一個比較容易實(shí)現(xiàn)的方法,就是安裝SimpleCA。在下面一節(jié)里面我們將介紹如何安裝和配置SimpleCA。
如果是在第一臺機(jī)器上安裝也應(yīng)該安裝SimpleCA,以便以后為其他多臺機(jī)器提供服務(wù)。
安裝和配置SimpleCA
1.創(chuàng)建用戶
保證系統(tǒng)中存在這樣的用戶:
l 普通的用戶賬號,用來執(zhí)行客戶端的程序。
l 一個globus賬號,用來執(zhí)行管理的任務(wù)。如啟動、停止容器,部署服務(wù)等。同時,這個用戶還負(fù)責(zé)管理SimpleCA。為此,需要保證該用戶對$GLOBUS_LOCATION目錄有讀寫權(quán)限。在第1章中我們以及創(chuàng)建了這樣一個用戶。
注:如果編譯安裝的時候沒有正確的設(shè)定權(quán)限,可以用chown命令來修改
root# chown globus:globus -R /usr/local/globus- |
注:參數(shù)-R表示遞歸的將目錄下所有的子目錄及文件同時更改權(quán)限
2.運(yùn)行安裝腳本
對每個網(wǎng)格,只需運(yùn)行一次下面的腳本即可。
globus$ export GLOBUS_LOCATION=/usr/local/globus- globus$ GLOBUS_LOCATION/setup/globus/setup-simple-ca |
在此過程中,程序會提醒你關(guān)于你想創(chuàng)建的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-
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]: |
推薦默認(rèn)選項(xiàng),按y繼續(xù)。接下來,會提示你輸入用來發(fā)送證書的email地址:
Enter the email of the CA (this is the email where certificate requests will be sent to be signed by the CA): |
其實(shí)會在本地產(chǎn)生認(rèn)證文件,也可以任意輸入email地址
這時,系統(tǒng)提示你輸入證書過期的時間。默認(rèn)是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)]: |
緊接著,系統(tǒng)提示輸入生成密鑰的短語,即密碼。正確輸入并牢記,不得包含空格。
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_ |
這里顯示的信息對于以后在其它機(jī)器上進(jìn)行安裝你的網(wǎng)格是十分重要的。在最后一行的數(shù)字
******************************************************************
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 |
如果出現(xiàn)問題,可以嘗試以下命令
root# GPT_LOCATION=/usr/local/globus- root# /usr/local/globus-
root# $GLOBUS_LOCATION/sbin/gpt-postinstall root# $GLOBUS_LOCATION/sbin/gpt-build /home/globus/.globus/simpleCA//globus_simple_ca_ |
3.安裝GSI
以root用戶登錄,運(yùn)行:
root# $GLOBUS_LOCATION/setup/globus_simple_ca_CA_Hash_setup/setup-gsi -default |
其中,Hash表示你的CA Hash,應(yīng)該用
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 Running grid-security-config... Installing Installing setup-gsi: Complete |
顯示如上即表示GSI安裝正確。
-----------------------------------------------------
證書的申請和發(fā)放
host證書
1.申請一個host證書
這個證書應(yīng)該是給服務(wù)器申請的,這樣才可以向用戶發(fā)放證書。首先,使用root用戶登錄,運(yùn)行命令:
root# grid-cert-request –host ‘hostname’ |
這里的hostname是服務(wù)器的主機(jī)名,比如“mci.uestc.edu.cn”。該命令會在服務(wù)器上創(chuàng)建3個文件,分別是:
l /etc/grid-security/hostkey.pem
l /etc/grid-security/hostcert_request.pem
l /etc/grid-security/hsotcert.pem(這是一個空的文件)
之后,會通過郵件的方式將hostcert_request.pem發(fā)送給CA的管理員,即globus用戶。如果hostname寫本機(jī)地址,則在本機(jī)的/etc/grid-security下尋找到三個文件,自行拷貝出來,進(jìn)行下邊的簽名步驟
2.對host證書簽名
作為globus用戶登錄,并運(yùn)行如下命令:
globus$ grid-ca-sign –in hostcert_request.pem –out hostsigned.pem |
這個命令是對接受到的host證書進(jìn)行簽名,從而生成hostsigned.pem文件。在此過程中,系統(tǒng)提示globus用戶輸入最初安裝SimpleCA時輸入的短語。
3.獲得簽名證書
作為root用戶登錄,將剛才生成的hostsinged.pem文件移到/etc/grid-security/目錄下并改名為hostcert.pem,從而覆蓋原先的空文件。這時,該文件的所有者是root,同時對其它用戶是只讀的權(quán)限。
用戶證書
1.申請證書
首先,用一個普通用戶登錄。然后在命令行輸入如下命令:
user$ grid-cert-request |
在此過程中,會提示你輸入passphrase。這個是用來生成密鑰的短語,要牢記。否則只能重新申請證書。
最后,系統(tǒng)中會生成如下三個文件:
· ~$USER/.globus/usercert.pem (empty)
· ~$USER/.globus/userkey.pem
· ~$USER/.globus/usercert_request.pem
其中usercert.pem是空文件,需要另外獲得。此時,會用email方式將usercert_request.pem給SimpleCA的管理員。同樣,如果host配置時使用本機(jī)地址,則在本地的~$USER/.globus/下即可找到文件,拷貝出來簽名。
2.對申請的證書進(jìn)行簽名
SimpleCA的管理員賬號globus登錄,并運(yùn)行如下命令
globus$ grid-ca-sign -in usercert_request.pem -out signed.pem |
對通過email收到的usercert_request.pem進(jìn)行簽名。這時,系統(tǒng)會提示globus用戶輸入在安裝SimpleCA過程中輸入的passphrase。正確輸入后就會根據(jù)usercert_request.pem生成一個signed.pem文件,并通過email將其發(fā)送給申請證書的用戶。
3.獲得簽名證書
用普通用戶登錄,并接收來自email的經(jīng)過簽名的signed.pem文件,將其拷貝到~$USRE/.globus/目錄下,并改名為usercert.pem。從而覆蓋原先生成的空文件。
測試
為了對安裝在/etc/grid-security/certificates的證書進(jìn)行校驗(yàn),需要運(yùn)行如下命令:
user$ grid-proxy-init –debug –verify |
如果一切正確,輸出的結(jié)果類似下面的內(nèi)容:
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用戶身份運(yùn)行(可能使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
|
執(zhí)行結(jié)束后,/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
|
添加授權(quán)
為用戶添加授權(quán),使之可以訪問服務(wù)。首先,需要作為root用戶登錄,創(chuàng)建/etc/grid-security/grid-mapfile文件。這時,你需要兩部分信息:
l 用戶的主體名(subject name)
l 這個主體名應(yīng)該映射到的賬號(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 |
結(jié)果grid-mapfile看起來應(yīng)該像這樣:
"/O=Grid/OU=GlobusTest/OU=simpleCA-hostname/OU=hostname/CN=user" user
注:主體名兩側(cè)的雙引號是必須的,因?yàn)檫@樣可以忽略其中包含的空格。其中hostname即申請host證書時的服務(wù)器名。user是普通用戶名。
基本安裝結(jié)束。
posted on 2007-06-20 10:21 狼愛上貍 閱讀(2279) 評論(2) 編輯 收藏 所屬分類: Globus