Red Hat Training
A Red Hat training course is available for Red Hat Satellite
章 6. 手動式編寫配置
請注意,本章節提供了另一個使用 RHN Bootstrap 來產生 bootstrap script 的方式。透過這些指南,您應該能夠從頭建立您自己的 bootstrap script。
所有初始的技巧皆持有一個共同點:位於中央位置的必要檔案之建置,會透過在各個客戶端上,藉由執行簡易、可編寫的指令來進行檢索與安裝。在本章節中,我們即將探索如何將所有這些點點滴滴結合在一起,以建立一個可讓您組織中的任何系統所引動的單獨 script。
當我們藉由最適當的順序,來將先前章節中的這些指令結合在一起時,我們會得到下列 script。請記住,
rhn_register
並不存在 Red Hat Enterprise Linux 3 或 4 這兩個版本上:
# First, install the latest client RPMs to the system. rpm -Uvh \ http://proxy-or-sat.example.com.com/pub/rhn_register-2.8.27-1.7.3.i386.rpm \ http://proxy-or-sat.example.com.com/pub/rhn_register-gnome-2.8.27-1.7.3.i386.rpm \ http://proxy-or-sat.example.com.com/pub/up2date-3.0.7-1.i386.rpm \ http://proxy-or-sat.example.com.com/pub/up2date-gnome-3.0.7-1.i386.rpm # Second, reconfigure the clients to talk to the correct server. perl -p -i -e 's/s/www\.rhns\.redhat\.com/proxy-or-sat\.example\.com/g' \ /etc/sysconfig/rhn/rhn_register \ /etc/sysconfig/rhn/up2date # Third, install the SSL client certificate for your company's # RHN Satellite Server or RHN Proxy Server. rpm -Uvh http://proxy-or-sat.example.com/pub/rhn-org-trusted-ssl-cert-*.noarch.rpm # Fourth, reconfigure the clients to use the new SSL certificate. perl -p -i -e 's/^sslCA/#sslCA/g;' \ /etc/sysconfig/rhn/up2date /etc/sysconfig/rhn/rhn_register echo "sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" \ >> /etc/sysconfig/rhn/up2date echo "sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" \ >> /etc/sysconfig/rhn/rhn_register # Fifth, download the GPG key needed to validate custom packages. wget -O - -q http://proxy-or-sat.example.com.com/pub/YOUR-RPM-GPG-KEY # Sixth, import that GPG key to your GPG keyring. rpm --import /path/to/YOUR-RPM-GPG-KEY
請記得第六步驟記載在此,因為它與執行 Red Hat Linux 3 或更新版本的系統相關。
這個 script 構成了一個乾淨並可重複的程序,它能完整地配置任何潛在的 Red Hat Network 客戶端,以便為註冊至一個 RHN Proxy Server 或 RHN Satellite Server 作準備。請記住,關鍵值(例如您 RHN 伺服器的網址、它的公用目錄以及您的真實 GPG 金鑰)必須被插入列在 script 中的佔位符之中。還有,隨著您環境的不同,您可能需要進行額外的修改。雖然此 script 可能就算逐字地使用也能運作,不過您應將它視為參考指南。
就和它的元件一樣,這個 script 能被至於中央。透過將此 script 放置在伺服器的
/pub/
目錄中、對它執行 wget -O-
,然後將輸出以管線傳輸至 shell session。您能夠藉由各個客戶端,以一項單獨的指令執行所有的 bootstrap 程序。
wget -O - http://proxy-or-sat.example.com.com/pub/bootstrap_script | bash
警告
透過網站連結來直接由管線所傳輸進來的輸入執行 shell script,明顯上含有一些固有的危險性。因此,請務必確認在此情況下的來源伺服器安全性。
之後,這項單行的指令便能在一個網路上的所有系統上引動。在此情況下,若系統管理員持有所有這些系統的 SSH 存取權限,他便能輕易重複性地透過遠端的方式來在這些系統上執行指令。這個 script 也能夠被當作是既有 kickstart script 的 %post 部份的完美附加功能。