萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 作業系統 >  >> Solaris 介紹

Solaris 10 CVS 伺服器部署:inetd/SMF 服務整合實戰

安裝 CVS 套件

# 從 Sunfreeware 或 Blastwave 下載對應 Solaris 10 架構套件
pkgadd -d CVSpkg

服務註冊與啟動 (SMF 架構)

Solaris 10 使用 SMF 管理 inetd 服務,需建立 Manifest 並匯入。

1. 註冊埠號

vi /etc/services
cvspserver  2401/tcp   # CVS pserver 模式

2. 配置 inetd 服務定義

vi /etc/inetd.conf
cvspserver  stream  tcp  nowait  root  /usr/local/cvs/bin/cvs  cvs --allow-root=/export/home/cvs pserver
  • nowait:inetd 等待服務結束再處理下一個連線 (適用 CVS)。
  • --allow-root:指定 CVS 儲存庫根目錄。

3. 轉換為 SMF Manifest 並匯入

# 轉換 inetd.conf 產生 manifest
inetconv -i /etc/inetd.conf
# 輸出: cvspserver -> /var/svc/manifest/network/cvspserver-tcp.xml

# 若已存在舊 manifest 需先移除
rm /var/svc/manifest/network/cvspserver-tcp.xml
inetconv -i /etc/inetd.conf

# 重新整理 inetd 服務
svcadm restart svc:/network/inetd:default

4. 驗證服務狀態

svcs -l cvspserver
# 或
inetadm | grep cvs

CVS 儲存庫初始化

# 建立儲存庫目錄
mkdir -p /export/home/cvs
chown -R cvsuser:cvs /export/home/cvs

# 初始化
cvs -d /export/home/cvs init

# 建立 CVS 專用用戶 (安全性)
groupadd cvs
useradd -g cvs -d /export/home/cvs -s /bin/false cvsuser

用戶端連線測試

# 客戶端設定環境變數
export CVSROOT=:pserver:user@cvs_server:/export/home/cvs
export CVS_RSH=ssh   # 建議使用 SSH 隧道加密

# 登入
cvs login
# Logging in to :pserver:user@cvs_server:2401/export/home/cvs
# CVS password: ********

# 檢出模組
cvs checkout myproject

安全性建議

  • 生產環境強制使用 SSH 隧道:CVS_RSH=ssh,避免明文傳輸密碼與代碼。
  • 限制 --allow-root 僅指向特定儲存庫路徑。
  • 配合 /etc/hosts.allow/deny 限制來源 IP。
  • 定期備份 /export/home/cvs (含 CVSROOT 管理目錄)。
copyright © 萬盛學電腦網 all rights reserved