1、前言
What is Blastwave.org ? 簡單來說 Blastwave 就是幫您把自由軟體收集起來讓 x86 及 Sparc 使用者容易安裝套件只要打 pkg-get install 套件名稱 就可清鬆安裝套件了;使用 pkg-get 安裝的套件開頭名稱為 CSW (Community Software for Solaris)。文章目錄
1、前言2、實作環境
3、安裝及設定
步驟1.安裝 pkg-get 套件
步驟2.修改 pkg-get 設定檔
步驟3.修改 $PATH
步驟4.安裝 gnupg 及 textutils
步驟5.匯入 PGP Public Key
步驟6.檢查 PGP 機制是否正常運作
4、補充 pkg-get 使用說明
5、參考
2、實作環境
- SunOS 5.10 (Solaris 10) i386
- CSWpkgget-3.7.2
3、安裝及設定
步驟1.安裝 pkg-get 套件
首先利用 pkgadd 指令來安裝 Blastwave 所提供的套件。# pkgadd -d http://www.blastwave.org/pkg_get.pkg //安裝 pkg-get
## Downloading...
.....25%.....50%.....75%.....100%
## Download Complete
The following packages are available:
1 CSWpkgget pkg_get - CSW version of automated package download tool
(all) 3.7.2
Select package(s) you wish to process (or 'all' to process all packages).(default: all) ?,??,q: //按下 enter 繼續安裝
Processing package instance <CSWpkgget> from <http://www.blastwave.org/pkg_get.pkg>
pkg_get - CSW version of automated package download tool(all) 3.7.2
You may use and copy this software without charge, as you see fit.The software is copyright (C) Philip Brown, Nov 2000-2006
Dont forget to update /opt/csw/etc/pkg-get.conf with your nearest archive site.(or /etc/opt/csw/pkg-get.conf)
Dont stick with the default of ibiblio.org: it's very slow!
The selected base directory </opt/csw> must exist before installation is attempted.
Do you want this directory created now y,n,?,q y //輸入 y 繼續安裝
Using </opt/csw> as the package base directory.
## Processing package information.
## Processing system information.
WARNING: setting mode of </opt/csw/bin> to default mode (755)
WARNING: setting mode of </opt/csw/etc> to default mode (755)
WARNING: setting mode of </opt/csw/share> to default mode (755)
WARNING: setting mode of </opt/csw/share/man> to default mode (755)
WARNING: setting mode of </opt/csw/share/man/man1m> to default mode (755)
1 package pathname is already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.
This package contains scripts which will be executed with super-user permission during the process of installing this package.
Do you want to continue with the installation of <CSWpkgget> y,n,? y
Installing pkg_get - CSW version of automated package download tool as <CSWpkgget>
## Installing part 1 of 1.
/opt/csw/bin/pkg-get
/opt/csw/etc/pkg-get.conf.csw
/opt/csw/share/man/man1m/pkg-get.1m
/var/pkg-get/admin-fullauto
verifying class <none>
## Executing postinstall script.
Installing /opt/csw/etc/pkg-get.conf.csw to pkg-get.conf
**** IMPORTANT ****
A default configuration file for pkg-get has been created in
/opt/csw/etc/pkg-get.conf
You should edit it to change the 'site' configuration, to point to
the most appropriate mirror for you, from the list at
http://www.blastwave.org/mirrors
Installation of <CSWpkgget> was successful. //安裝 pkg-get 完成
步驟2.修改 pkg-get 設定檔
安裝 pkg-get 完成後,我們必須修改 pkg-get 設定檔來指定安裝套件時是到哪個 Mirror Sites 去下載套件,下面二個連結是 Mirror Sites 列表、狀態。可以設定為台灣銘傳大學的 Mirror Sites 這樣才不用安裝套件就要出國比賽了。# vi /opt/csw/etc/pkg-get.conf
url=http://ibiblio.org/pub/packages/solaris/csw/unstable //預設站台是美國
url=ftp://ftp.mcu.edu.tw/pub/Sun/metalab.unc.edu/csw/stable //修改為台灣銘傳大學
Unstable 及 Stable 的差異性?
- Unstable:新加入的套件 (可能會踩到地雷)。
- Stable:在 Unstable 內測試過沒問題套件會轉到 Stable 內。
步驟3.修改 $PATH
因為 pkg-get 執行檔是安裝在 /opt/csw/bin 下,所以若是您只想打 pkg-get 來執行指令就必須修改您使用的 shell 內的 PATH。# vi ~/local.cshrc
set path=(/bin /usr/bin /usr/sbin /usr/local/bin /usr/ucb /etc /opt/csw/bin .) //加/opt/csw/bin
# source ~/local.cshrc //使修改生效
# echo $PATH //查看 PATH 變數內容
/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/ucb:/etc:/opt/csw/bin:.
步驟4.安裝 gnupg 及 textutils
怎知道您下載的套件沒有被人打包惡意程式在裡面?因此 pkg-get 便有了安全性設定來確定您安裝的套件是安全的、沒有問題的。# pkg-get install gnupg textutils //開始安裝 gnupg 跟 textutils
verifying class <none>
Installation of <CSWtextutils> was successful.
查看剛才安裝了哪些相關套件。
# ls -ladt /var/sadm/pkg/CSW* //列出剛才安裝的相關套件
# ls -1 /var/sadm/pkg/ | grep CSW | xargs pkginfo //查看相關套件的說明
步驟5.匯入 PGP Public Key
執行如下指令安裝 wget 套件,以及匯入 PGP Public Key。# pkg-get install wget //安裝 wget 套件
# /opt/csw/bin/wget --output-document=pgp.key http://www.blastwave.org/mirrors.html //下載 PGP Key
--16:22:37-- http://www.blastwave.org/mirrors.html
=> `pgp.key'
Resolving www.blastwave.org... 66.225.151.251
Connecting to www.blastwave.org|66.225.151.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18,937 (18K) text/html
100%====================================> 18,937 31.03K/s
16:22:38 (30.92 KB/s) - `pgp.key' saved 18937/18937
匯入 PGP Public Key。
# gpg --import pgp.key //匯入 PGP Public Key
gpg: Command not found.
# rehash //重建hash table,才不會出現找不到指令的情形
# gpg --import pgp.key
gpg: directory `/export/home/weithenn/.gnupg' created
gpg: can't open `/gnupg/options.skel': No such file or directory
gpg: keyring `/export/home/weithenn/.gnupg/secring.gpg' created
gpg: keyring `/export/home/weithenn/.gnupg/pubring.gpg' created
gpg: /export/home/weithenn/.gnupg/trustdb.gpg: trustdb created
gpg: key E12E9D2F: public key "Distribution Manager <dm@blastwave.org>" imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: no ultimately trusted keys found
確定 pkg-get 設定檔是否開啟 PGP 及 MD5 功能。
# vi /opt/csw/etc/pkg-get.conf
#use_gpg=false //預設使用 pgp
#use_md5=false //預設使用 md5
步驟6.檢查 PGP 機制是否正常運作
匯入 PGP Public Key 後如何知道機制是否正常運作呢? 可從二個方面下手。更新 catalog:若您未使用 pgp、md5 安全機制當您更新 catalog 時會發現有如下二行資訊。
# pkg-get -U
WARNING: gpg not found
WARNING: gpg not available.
更改安裝套件的 checksum:例如更改本機 catalog 內套件 top 的 checksum 當您準備安裝 top 套件時本機會跟遠端 Mirror Site 核對 checksum 是否符合,若不符合安裝動作會中止,並請您先更新 catalog 在試試看安裝一次。
# grep top-3.6 /var/pkg-get/catalog-ibiblio.org //查尋 top 套件的 checksum
top 3.6,REV=2007.01.01 CSWtop top-3.6,REV=2007.01.01-SunOS5.8-i386-CSW.pkg.gz 50c4a05275d3cd639db71764b4e2ee32
修改 catalog-ibiblio.org 內 checksum 值,將 checksum 值最後 32 改成 78。
# grep top-3.6 /var/pkg-get/catalog-ibiblio.org //本機 catalog checksum 已經改變top 3.6,REV=2007.01.01 CSWtop top-3.6,REV=2007.01.01-SunOS5.8-i386-CSW.pkg.gz 50c4a05275d3cd639db71764b4e2ee78
試著安裝 top 套件看看。
# pkg-get install top
No existing install of CSWtop found. Installing...
Trying http://ibiblio.org/pub/packages/solaris/csw/unstable/i386/5.10/top-3.6,REV=2007.01.01-SunOS5.8-i386-CSW.pkg.gz--17:23:56--
http://ibiblio.org/pub/packages/solaris/csw/unstable/i386/5.10/top-3.6,REV=2007.01.01-SunOS5.8-i386-CSW.pkg.gz
=> `top-3.6,REV=2007.01.01-SunOS5.8-i386-CSW.pkg.gz'
Resolving ibiblio.org... 152.46.7.80
Connecting to ibiblio.org|152.46.7.80|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 56,821 (55K) text/plain
100%==========================> 56,821 43.11K/s
17:23:58 (43.03 KB/s) - `top-3.6,REV=2007.01.01-SunOS5.8-i386-CSW.pkg.gz' saved 56821/56821
ERROR: checksum top-3.6,REV=2007.01.01-SunOS5.8-i386-CSW.pkg.gz does not match remote checksum //跟你說 checksum 不對
(perhaps you need to pkg-get -U ?) //叫你更新 catalog
4、補充 pkg-get 使用說明
- -i or install: 安裝套件。
- -u or upgrade: 升級已經安裝的套件。
- -a or available: 列出可安裝的套件及版本。
- -c or compare: 比對本地端(Lcalhost)跟遠端(Mirror Site)間套件(是否安裝、版本是否一樣)。
- -l or list: 列出本地端(Localhost)已安裝的套件名稱。
- -d or download: 僅下載套件而不執行安裝。
- -D or describe: 列出可安裝套件的功能說明。
- -U or updatecatalog: 更新套件安裝列表 catalog (/var/pkg-get/catalog-ibiblio.org、desc-ibiblio.org)。
- -S or sync: 將套件版本同步跟 Mirror Site 一樣。
- -f: 在安裝套件途中不尋問任何問題 (See /var/pkg-get/admin-fullauto)。
- -s ftp://site/dir -U: 若指定的 FTP/HTTP 站台無法連結可使用此參數改變連結的站台。