1 安装,解压缩下载的svn压缩包到对应文件夹(建议路径不要有空格与中文)
假设是/opt/subversion/
2 建立版本库,
建立 /home/svndata 空文件夹作为所有版本库的根目录。
#mkdir /home/svndata
进入命令行并切换到安装subversion的bin目录
(建议将此目录设为path)。
#vi /etc/profile
添加以下内容
SVN_HOME=/opt/subversion/
SVN_EDITOR=vim
PATH=$PATH:$SVN_HOME/bin
export SVN_HOME SVN_EDITOR PATH
按 shift+Z+Z退出
#source /etc/profile 使环境变量 生效
然后创建版本库
#svnadmin create /home/svndata/repos
配置svnserve
#cd /home/svndata/repos/conf
打开 conf/svnserve.conf 文件
[general] anon-access = read #去掉注释,不能在行首留有空格,切记,下同 auth-access = write password-db = passwd authz-db = authz打开 conf/passwd 文件
[users] niy = 123456 #不能在行首留有空格,切记,等号左边为用户名,右边为密码
# [groups] # harry_and_sally = harry,sally admin = niy //不能在行首留有空格,切记, # [/foo/bar] # harry = rw # * = # [repository:/baz/fuz] # @harry_and_sally = rw # * = r [/] @admin = rw * = r
3 运行服务
#svnserve -d -r /home/svndata/repos --listen-port=3690 --listen-host=127.0.0.1
在某文件夹下建立test.txt文件
#mkdir ~/testsvn
#vim test.txt
保存test.txt
#cd ~/testsvn
#svn import svn://localhost
[niy@niy-computer testsvn]$ svn import svn://127.0.0.1/ 日志信息未修改,或未指定 a)终止,c)继续,e)编辑: c 认证领域: <svn://127.0.0.1:3690> repos “niy”的密码: ----------------------------------------------------------------------- 注意! 你的密码,对于认证域: <svn://127.0.0.1:3690> repos 只能明文保存在磁盘上! 如果可能的话,请考虑配置你的系统,让 Subversion 可以保存加密后的密码。请参阅文档以获得详细信息。 你可以通过在“/home/niy/.subversion/servers”中设置选项“store-plaintext-passwords”为“yes”或“no”, 来避免再次出现此警告。 ----------------------------------------------------------------------- 保存未加密的密码(yes/no)?yes 增加 svn-commit.tmp 增加 test.txt 提交后的版本为 1。
搞定