文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Linux下SVN+apache简单安装与配置

Linux下SVN+apache简单安装与配置

时间:2009-04-20  来源:liaosnet

前言:

   最近整理以前写的一些SHELL脚本,总是发现改得一踏糊涂.于是乎决定找个工具来管理一下,在需要更改的时候更改,改完保存起来.以防止使用了错误的版本,保证版本最新..
   在网上找到了SVN这样人东东,觉得功能还好.同时搜索了安装方式,竟然都是configure && make && make install的方式.我这样的懒人可不喜欢为了那些依赖关系而烦恼,于是找到了一下编译好了的版本.^_^
 

相关平台软件:

这里使用的操作系统是suse10(虽然CollabNet Subversion是在rhel4/5下编译的,但仍可在suse10上使用).

CollabNet Subversion v1.5.6
CollabNetSubversion-client-1.5.6-1.i386.rpm   --客户端
CollabNetSubversion-server-1.5.6-1.i386.rpm   --服务端
CollabNetSubversion-extras-1.5.6-1.i386.rpm   --扩展件
下载地址:
http://www.open.collab.net/downloads/subversion/

TortoiseSVN 1.6.1
TortoiseSVN-1.6.1.16129-win32-svn-1.6.1.msi   --TortoiseSVN,这里当做windows客户端使用
下载地址:
http://tortoisesvn.net/downloads

安装过程:

安装已经编译的rpm即可,很容易.(这也是我偷懒的原因,省事! ^_^).
先安装client,然后server,最后是extras.
# rpm -ivh CollabNetSubversion-client-1.5.6-1.i386.rpm
warning: CollabNetSubversion-client-1.5.6-1.i386.rpm: V3 DSA signature: NOKEY, key ID 35bcca43
Preparing...                ########################################### [100%]
   1:CollabNetSubversion-cli########################################### [100%]

# rpm -ivh CollabNetSubversion-server-1.5.6-1.i386.rpm
warning: CollabNetSubversion-server-1.5.6-1.i386.rpm: V3 DSA signature: NOKEY, key ID 35bcca43
Preparing...                ########################################### [100%]
   1:CollabNetSubversion-ser########################################### [100%]

# rpm -ivh CollabNetSubversion-extras-1.5.6-1.i386.rpm
warning: CollabNetSubversion-extras-1.5.6-1.i386.rpm: V3 DSA signature: NOKEY, key ID 35bcca43
Preparing...                ########################################### [100%]
   1:CollabNetSubversion-ext########################################### [100%]

三个rpm安装安装完成了..系统增加了一个csvn用户/组.
# more /etc/passwd
csvn:x:1000:1000:CollabNet Subversion:/opt/CollabNet_Subversion:/bin/bash
# more /etc/group
csvn:!:1000:

创建了目录/opt/CollabNet_Subversion 用于存放SVN相关的程序.
# ll /opt/CollabNet_Subversion
drwxr-xr-x   4 root root  960 Apr 20 14:25 bin
drwxr-xr-x   2 root root  312 Apr 20 14:24 build
drwxr-xr-x   2 root root  216 Apr 20 14:24 docs
drwxr-xr-x   6 root root 3424 Apr 20 14:25 lib
drwxr-xr-x   2 root root  232 Apr 20 14:24 licenses
drwxr-xr-x   2 root root  184 Apr 20 14:25 modules
drwxr-xr-x   2 root root  208 Apr 20 14:25 sbin
drwxr-xr-x   4 root root   96 Feb 27 01:17 share

配置SVN:

    编译好的SVN配置起来也很简单(感谢编译人员辛勤的劳动).在/opt/CollabNet_Subversion/bin目录下执行Configure-CollabNet-Subversion ,按照提示做就行了.(表示操作)

# ./Configure-CollabNet-Subversion

CollabNet Subversion Server is a free download of open-source Subversion,
compiled and tested by CollabNet. For more information about CollabNet
Subversion, visit the CollabNet community at http://open.collab.net.

Would you like to configure the CollabNet Subversion Server now? [yes] (回车)

Welcome to CollabNet Subversion Server setup.

You will now be asked some questions to configure CollabNet Subversion.
Defaults are given in square brackets. If a default is okay for you
Just hit [Enter] to continue.

This setup can configure either Apache or svnserve as Subversion
server, for you. Would you like to configure Apache as your
Subversion server now? [yes] (回车)

Continuing with apache Subversion server configuration ...

Specify the base directory for Subversion repositories: [/var/svn/repositories] /opt/svn/repositories (这里我更改了路径,不使用默认的.)

Non-existing base path, Let me create and continue [yes] (回车)

Base path created.
Would you like to create a new Subversion repository? [yes] (回车)

What should be your new Subversion repository name? test (这里建立一个名为test的库)

New repository created.
Would you like to initialize the repository with trunk/branches/tags folders? [no] (回车)

Done.

Would you like to create another Subversion repository? [yes] (回车)

What should be your new Subversion repository name? test2 (这里再建立一个名为test的库)

New repository created.
Would you like to initialize the repository with trunk/branches/tags folders? [no](回车)(暂时不导入初始数据)

Done.

Would you like to create another Subversion repository? [yes] no (已经建立了2个库,不建了.)

Would you like to give the name and port that the server uses to identify itself? [yes]

Registered DNS name or IP address: 192.168.80.100 (这里是apache的配置,apache的服务IP)

Server port number: 8000 (apache的服务端口号)

Allow anonymous read access? [no] (回车)

0 users currently have access to this repository:

Would you like to create a new Subversion account? [yes] (回车)

Account username
(To re-create or delete a Subversion account, enter an existing username): svn (建立一个SVN帐号)

Account password: (密码)

Retype account password: (重复密码)

Adding password for user svn
Account created

Would you like to create another user account? [yes] no (不建立另一用户)

Would you like to configure ViewVC?  [yes] (启用VierVC,回车)

Stopping CollabNet Subversion: httpd (no pid file) not running
                                                                      done
Starting CollabNet Subversion:                                        done

(完成,最后的提示信息)
  Congratulations! You have successfully configured the CollabNet
  Subversion server.

  You can access your repositories at the following URL:
  http://192.168.80.100:8000/svn/YOUR-REPOS-NAME
  http://192.168.80.100:8000/viewvc/YOUR-REPOS-NAME

配置完成后检查:

与SVN相关的APACHE已经起来了.
# ps -ef | grep httpd
root      6989     1  2 14:28 ?        00:00:00 /opt/CollabNet_Subversion/bin/httpd -D csvn_installed -D viewvc_installed -k start
csvn      6990  6989  0 14:28 ?        00:00:00 /opt/CollabNet_Subversion/bin/httpd -D csvn_installed -D viewvc_installed -k start
csvn      6991  6989  0 14:28 ?        00:00:00 /opt/CollabNet_Subversion/bin/httpd -D csvn_installed -D viewvc_installed -k start
csvn      6992  6989  0 14:28 ?        00:00:00 /opt/CollabNet_Subversion/bin/httpd -D csvn_installed -D viewvc_installed -k start
csvn      6993  6989  0 14:28 ?        00:00:00 /opt/CollabNet_Subversion/bin/httpd -D csvn_installed -D viewvc_installed -k start
csvn      6994  6989  0 14:28 ?        00:00:00 /opt/CollabNet_Subversion/bin/httpd -D csvn_installed -D viewvc_installed -k start
csvn      6995  6989  0 14:28 ?        00:00:00 /opt/CollabNet_Subversion/bin/httpd -D csvn_installed -D viewvc_installed -k start

在浏览器中,YOUR-REPOS-NAME换成建立的库名,这里为test,test2..
http://192.168.80.100:8000/svn/YOUR-REPOS-NAME
http://192.168.80.100:8000/viewvc/YOUR-REPOS-NAME

注意浏览器上的地址栏.
test:
500)this.width=500;" border="0">
test2:
500)this.width=500;" border="0">
ViewVC test:
500)this.width=500;" border="0">
ViewVC test2:
500)this.width=500;" border="0">

个人感觉还是ViewVC实用些...
这时,由于还没有导放初始数据..所以这里的显示均为0.

库导入:

在/root/tmp/下建了一个测试脚本test.sh,内容很简单.
#!/bin/sh
echo "test"

现在把/root/tmp导入到SVN库test里
# /opt/CollabNet_Subversion/bin/svn import /root/tmp file:///opt/svn/repositories/test -m "SVN test"

Adding         /root/tmp/test.sh

Committed revision 1.

导入完成,增加一个文件.当前的版本为1.

检查导入
# /opt/CollabNet_Subversion/bin/svn list file:///opt/svn/repositories/test

test.sh

在浏览器中查看.
test:
500)this.width=500;" border="0">

ViewVc test:
500)this.width=500;" border="0">

点开test.sh,可以看到一些信息.
500)this.width=500;" border="0">

OKey..SVN库建立,数据初始化算是完成了..下面来点简单点的更改..这里就用到了TortoiseSVN这个windows版的svn工具当客户端用(linux也有客户端,也就是刚我们安装的那个client,可是那个command line....呵呵).
TortoiseSVN 的安装就不说了,windows下的东东,基本上一路next..完成后,重启一下系统,然后就OK了.

现在右键看一下..^_^ ,这就是增加的TortoiseSVN的功能..我们这用到的要少些(当客户端用嘛). 500)this.width=500;" border="0">

1.检出(SVN checkout).
    点SVN Checkout,输出要检出的库/目录/文件
500)this.width=500;" border="0">
使用SVN帐号(上面建立的svn帐号)
500)this.width=500;" border="0">
完成.OK
在Checkout目录生成一个指定目录...包含里初始的test.sh.
500)this.width=500;" border="0">

2.更改
修改test.sh文件内容后,保存..图标变了,表示已经更改了..
500)this.width=500;" border="0">

3.确认提交(SVN Commit)
    右键SVN Commit
500)this.width=500;" border="0">

500)this.width=500;" border="0">

500)this.width=500;" border="0">
完成后,本地恢复..

4.检查更新.
    在浏览器上查看更新..已经变成版本2.
500)this.width=500;" border="0">

test.sh更改详细信息.
500)this.width=500;" border="0">

小结:

    SVN 是个很好的版本控制软件.使用它后,可以容易的保证是在最新的版本上更改...


排行榜 更多 +
超凡先锋网易正版手游

超凡先锋网易正版手游

飞行射击 下载
超凡先锋测试版(badlanders)

超凡先锋测试版(badlanders)

飞行射击 下载
2025正版pubg mobile国际服

2025正版pubg mobile国际服

飞行射击 下载