真正做起來開發工作,才發現一台CVS服務器是必不可少的,即使是很少的開發人員的項目, 使用CVS也會起到很大的作用,具體什麼作用,大家去體會:) 下面就把我架設CVS服務器的過程說說,和諸位前輩的不同之處在於我架設了一個WEB界面, 所以說是"友好的",通過WEB界面可以非常直觀的浏覽代碼,查看圖形化的修改記錄,(提交 可以log到mysql數據庫--This feature is a clone of the Mozilla Projects Bonsai database.),目前SourceForge正在使用此界面的較低版本. 功能簡介: 1:Base CVS Server; 2:repository browsing. 3:SQL checkin database. 4:Colorize sourcecode. 5:Can display a clickable, graphical of files in a CVS repository. 6:generate tarball from a repository on the fly. OK,Lets go! 1:初始化環境 #groupadd cvs #mkdir /home2/cvsroot #useradd -g cvs -G cvs -d /home2/cvsroot cvsroot #su - cvsroot $chmod 775 . OK! 2:啟動CVS Server 諸位大蝦已經有了很精辟的說明,拿來就是了!:P #more /etc/servicesgrep cvspserver cvspserver 2401/tcp # CVS client/server operations cvspserver 2401/udp # CVS client/server operations OK,RedHat系統不傻,可以寫腳本了. #vi /etc/xinetd.d/cvspserver service cvspserver { disable = no flags = REUSE socket_type = stream wait = no user = root server = /usr/bin/cvs server_args = -f --allow-root=/home2/cvsroot pserver log_on_failure += USERID } :wq #ls /etc/xinetd.d/cvspserver /etc/xinetd.d/cvspserver 腳本好了! #su - cvsroot $cvs -d /home2/cvsroot init #service xinetd restart 看看有沒有? #netstat -l grep cvspserver tcp 0 0 *:cvspserver *:* LISTEN Great! 3:Add a Web Interface,viewcvs-0.9.2 URL:http://viewcvs.sourceforge.net/ 要求比較個性,很多很多!列表: a: Python 1.5 or later(http://www.python.org/) Rh7.2竟然有兩個python,1.5和2.1,更加有個性! b: RCS, Revision Control System(http://www.cs.purdue.edu/homes/trinkle/RCS/) Rh7.2自帶. c: read-only, physical Access to a CVS repository(See http://www.cvshome.org/ for more information) Rh7.2自帶. d: a web server capable of running CGI programs(for example, Apache at http://httpd.apache.org/) viewcvs-0.9.2文檔竟然說apache是可選項:( e: GNU-diff to replace broken diff implementations(http://www.gnu.org/software/diffutils/diffutils.Html) Rh7.2自帶. f:MySQL to create and query a commit database(http://www.mysql.com/) Rh7.2自帶. g:(http://sourceforge.net/projects/mysql-python)(and Python 1.5.2 or later) 去拉 h:Enscript to colorize code displayed from the CVS repository(http://people.ssh.com/mtr/genscript/) 去拉 i:CvsGraph for a graphical representation of the CVS revisions(http://www.akhphd.au.dk/~bertho/cvsgraph/) 去拉 #tar zxvf cvsgraph-1.1.3.tar.gz #cd cvsgraph-1.1.3 #./configure #make #cp cvsgraph /usr/bin #mkdir /etc/cvsgraph #cp cvsgraph.conf /etc/cvsgraph #rpm -ivh egenix-mx-base-2.0.3-py2.1_1.i386.rpm #rpm -ivh MySQL-python-0.9.1-1py2.i386.rpm #tar zxvf viewcvs-0.9.2.tar.gz #cd viewcvs-0.9.2 #./viewcvs-install #cp /usr/local/viewcvs-0.9.2/cgi/viewcvs.cgi /var/www/cgi-bin #cp /usr/local/cvsview-0.9.2/PyFontify* /usr/lib/python2.1/ #cp /usr/local/cvsview-0.9.2/py2html* /usr/lib/python2.1/ OK! /**********MySQL****************/ 建兩個用戶,cvsroot(passWord:cvsroot)使用root權限,cvsread(password:cvsread) 使用只讀權限. #/usr/local/cvsview-0.9.2/make-datebase OK! #vi /usr/local/viewcvs-0.9.2/viewcvs.conf cvs_roots = Development : /home2/cvsroot rcs_path = /usr/bin/ address = [email protected] [cvsdb] host = localhost database_name = ViewCVS user = cvsroot passwd = cvsroot readonly_user = cvsread readonly_passwd = cvsread row_limit = 1000 py2html_path = /usr/lib/python2.1 enscript_path = /usr/bin/ allow_tar = 1 use_cvsgraph = 1 ******************************************************** ***如果同時安裝python-1.x和python-2x(比如RedHat7.2) ***以下千萬注意(我們使用python-2.x) ******************************************************** cd /usr/local/viewcvs-0.9.2 loginfo-handler,standalone.py,cvsdbadmin 以及 cd /usr/local/viewcvs-0.9.2/cgi下的所有文件, 首行改為:#!/usr/bin/python2 #cp /usr/local/viewcvs-0.9.2/cgi/viewcvs.cgi /var/www/cgi-bin http://127.0.0.1/cgi-bin/viewcvs.cgi/ OK了! 4:Add user #usermod -G cvs username #使用系統驗證 OK,enjoy CVS! 5:微調 #mkdir /var/lock/cvs #mkdir /var/lock/cvs/CVSROOT #chmod -R 775 /var/lock/cvs #chown -R cvsroot.cvs /var/lock/cvs #su - hleil $eXPort CVSROOT=:pserver:[email protected]:/home2/cvsroot $cvs login $cvs checkout CVSROOT $cd CVSROOT $vi loginfo ALL (echo %{sVv}; cat) /usr/local/viewcvs-0.9.2/loginfo-handler #SQL checkin :wq $vi config SystemAuth=yes #使用系統驗證 LockDir=/var/lock/cvs #for security LogHistory=all :wq $cvs commit #service xinetd restart Great!終於好了! 呵呵,下面就開始你的代碼之旅吧!