SVN for RedHat 安装手册Word下载.docx

上传人:b****8 文档编号:22870137 上传时间:2023-02-05 格式:DOCX 页数:29 大小:27.20KB
下载 相关 举报
SVN for RedHat 安装手册Word下载.docx_第1页
第1页 / 共29页
SVN for RedHat 安装手册Word下载.docx_第2页
第2页 / 共29页
SVN for RedHat 安装手册Word下载.docx_第3页
第3页 / 共29页
SVN for RedHat 安装手册Word下载.docx_第4页
第4页 / 共29页
SVN for RedHat 安装手册Word下载.docx_第5页
第5页 / 共29页
点击查看更多>>
下载资源
资源描述

SVN for RedHat 安装手册Word下载.docx

《SVN for RedHat 安装手册Word下载.docx》由会员分享,可在线阅读,更多相关《SVN for RedHat 安装手册Word下载.docx(29页珍藏版)》请在冰豆网上搜索。

SVN for RedHat 安装手册Word下载.docx

2.1.2.确认内核版本

#uname–a

本机内核是:

Linuxsvn#1SMPTueAug1815:

51:

48EDT2009x86_64x86_64x86_64GNU/Linux

2.1.3.发行版本

lsb_release–a

目前本机安装版本是:

RedHatEnterpriseLinuxServerrelease5.4(Tikanga)

2.1.4.确定主机名

#hostname

本主机名目前是:

svn

2.1.5.字符集

将”/etc/sysconfig/i18n”内容改为

LANG="

zh_CN"

1.2Apacha检查与确认

1.2.1.检查apache是否安装

#rpm-qhttpd

1.2.2.查看httpd是否启动

#servicehttpdstatus

重启httpd,查看启动是否正常

#servicehttpdrestart

刚安装的apache一般都会报下列信息:

Startinghttpd:

httpd:

Couldnotreliablydeterminetheserver'

sfullyqualifieddomainname,using127.0.0.1forServerName

说明:

没有在httpd.conf文件中配置ServerName项

#vi/etc/httpd/conf/httpd.conf

添加

ServerName主机名(地址):

端口/*端口缺省是80*/

1.2.3.查看apache所占的端口

#netstat–lnp|grephttpd

二、SVN服务器的安装

2.1安装

2.1.1.安装包清单

postgresql-libs-

perl-URI-1.35-3

2.1.2.查询和安装

安装这些包之前,检查一下这些安装包是否已经存在和它的版本。

例:

#rpm–qapr

没安装的,用rpm命令安装,如

#rpm–ivh/mnt/CentOS/apr-1.2.7-11.i386.rpm

注意:

sqlite安装

#rpm-Uvh

2.2检查

2.2.1.安装版本

#svnserve--version

#svn--version

2.2.2.mod_dav_svn

mod_dav_svn.so是SVN与HTTP通信的插件,它需mod_dav.so的配合。

要安装成功后,存放在/etc/httpd/modules目录下.

#ls/etc/httpd/modules/mod_dav_svn.so

#ls/etc/httpd/modules/mod_dav.so

2.3.配置

2.3.1.SVN配置

1.将仓库目录所有权赋于svn组和用户

#chown–Rapache:

apache/svn

2.启动SVN服务

su-apache-c"

svnserve-d-r/repository"

其中:

su–svn表示以用户svn的身份启动svn

-d表示以daemon方式(后台运行)运行

-r/opt/svndata指定根目录是/opt/svndata

检查:

ps–ef|grepsvnserve

如果显示如下,即为启动成功:

svn 6941  1 015:

07?

    00:

00:

00svnserve-d-r/repository

3.开机时自动启动

在/etc/init.d/新建一文件,如svn_sany,文件内容如下

#/etc/rc.d/init.d/svn_sany

#chkconfig:

3452080

#description:

SVNserverstartstoprestart

if[!

-f"

/usr/bin/svnserve"

]

then

echo"

svnserverstartup:

cannotstart"

exit

fi

case"

$1"

in

start)

Startingsvnserve..."

/usr/bin/svnserve-d-r/svn

Finished!

"

;

stop)

Stopingsvnserve..."

killallsvnserve

restart)

$0stop

$0start

*)

Usage:

svn{start|stop|restart}"

exit1

esac

4.将该文件的属性改为可执行

#chmod755/etc/rc.d/init.d/svn_sany

5.增加svn服务

chkconfig--addsvn_sany

6.建测试库:

test,test1

#su–lapache

$svnadmincreate/svn/test

7.配置用户权限

来到/svn/库名/conf目录,

修改svnserve.conf,修改结果如下

[general]

anon-access=none

auth-access=write

password-db=passwd

authz-db=authz

#realm=MyFirstRepository

修改passwd,修改结果如下

[users]

harry=123456

sally=123456

修改authz,修改结果如下

[groups]

manager=harry,sally##定义用户组

[/]#源码库的根目录

harry=rw#用户harry有读写权限

*=#其它用户的权限为空

[/trunk]#源码库的根目录下的trunk目录,可通过客户端工具新建

@harry_and_sally=rw#用户组harry_and_sally

[/tag]#源码库的根目录下的tag目录,可通过客户端工具新建

sally=rw#用户sally有读写权限

注:

SVN权限能继承,但是通过权限重新定义来取消继承,通过上面实例可以看出。

2.3.2.Apache配置

1.mod_dav_svn.so检测

●模块加载

让Apache在启动的时候加载上述"mod_dav_svn.so"和"mod_dav.so"模块。

LoadModuledav_modulemodules/mod_dav.so

#vi/etc/httpd/conf.d/subversion.conf

LoadModuledav_svn_modulemodules/mod_dav_svn.so

<

Location/svn>

DAVsvn

SVNPath/svn/test1

/Location>

●重启Httpd服务

打开浏览器,输入/svn将会看到如下画面:

这表示Apache的dav_svn模块已经可以正常工作了。

用户可以使用任何一种Subversion的客户端通过Http协议访问你的版本库。

2.多个版本库

如果想要指定多个版本库,可以用多个Location标签,也可以使用SVNParentPath代替SVNPath,例如在/svn下有多个版本库repos1,repos2等等,用如下方式指定:

SVNParentPath/svn

SVNListParentPathon

重启apache,打开浏览器,输入/svn将会看到如下画面:

表示配置成功.现在你的版本库任何人都可以访问,并且有完全的写操作权限。

也就是说任何人都可以匿名读取,修改,提交,以及删除版本库中的内容。

3.用户访问限制

首先需要创建一个用户文件。

Apache提供了一个工具htpasswd,用于生成用户文件,可以在Apache的安装目录下找到。

具体使用方法如下:

htpasswd–c/svn/passwd.confusername

htpasswd新建一个用户文件。

创建好的文件内容是用户名加上密码的MD5密文。

接下来修改subversion.conf,在Location标签中加入如下内容:

AuthTypeBasic

AuthName"

SanySVNUserValidate"

AuthuserFile/svn/passwd.conf

Requirevalid-user

重新启动Apache,打开浏览器访问版本库。

Apache会提示你输入用户名和密码来认证登陆了,现在只有passwd.conf文件中设定的用户才可以访问版本库。

也可以配置只有特定用户可以访问,替换上述"

Requirevalid-user"

为"

Requireusertonyrobert"

将只有tony和robert可以访问该版本库。

有的时候也许不需要这样严格的访问控制,例如大多数开源项目允许匿名的读取操作,而只有认证用户才允许写操作。

为了实现更为细致的权限认证,可以使用Limit和LimitExcept标签。

例如:

LimitExceptGETPROPFINDOPTIONSREPORT>

requirevalid-user

/LimitExcept>

如上配置将使匿名用户有读取权限,而限制只有passwordfile中配置的用户可以使用写操作。

如果这还不能满足你的要求,可以使用Apache的mod_authz_svn模块对每个目录进行认证操作。

4.用mod_authz_svn进行目录访问控制

首先需要让Apache将mod_authz_svn模块加载进来。

subversion.conf修改如下:

LoadModuleauthz_svn_modulemodules/mod_authz_svn.so

Location/svn/>

AuthzSVNAccessFile/svn/svn_authz

SatisfyAny

由于公司按DSS(决策支持系统板块)、ERP(ERP运营管理板块)、PLM(研发管理板块)、SCM(供应链管理板块)、ISMIS(信息安全管理体系)、ITSP(IT支撑平台),即四个板块一个体系和一个平台来分类存放,外加一个exercise(学习),因此最后的subversion.conf配置内容如下:

Location/svn/dss/>

SVNParentPath/svn/dss

Location/svn/erp/>

SVNParentPath/svn/erp

Location/svn/exercise/>

SVNParentPath/svn/exercise

Location/svn/ismis/>

SVNParentPath/svn/ismis

Location/svn/itsp/>

SVNParentPath/svn/itsp

Location/svn/plm/>

SVNParentPath/svn/plm

三、设计远程修改密码程序

3.1.代码开发

1.在/var/www/cgi-bin目录下新增ChangePasswd.cgi和ChangePasswd.ini两文件。

#touch/var/www/cgi-bin/ChangePasswd.cgi

#touch/var/www/cgi-bin/ChangePasswd.ini

2.赋权

#chmod755#touch/var/www/cgi-bin/ChangePasswd.*

3.编程

ChangePasswd.cgi

#!

/usr/bin/perl-w

usestrict;

useCGI;

my$time=localtime;

my$remote_id=$ENV{REMOTE_HOST}||$ENV{REMOTE_ADDR};

my$admin_email=$ENV{SERVER_ADMIN};

my$cgi=newCGI;

my$pwd_not_alldiginal="

密码不能全为数字"

my$pwd_not_allchar="

密码不能全为字符"

my$user_not_exists="

该用户不存在"

my$file_not_found="

文件不存在,请联系管理员"

my$authuserfile;

my$logfile;

my$pwdminlen;

my$title;

my$description;

my$yourname;

my$oldpwd;

my$newpwd1;

my$newpwd2;

my$btn_change;

my$btn_reset;

my$changepwdok;

my$changepwdfailed;

my$oldpwderror;

my$passmustgreater;

my$twopassnotmatched;

my$entername;

my$enterpwd;

my$errorpwd;

my$back;

&

IniInfo;

if($cgi->

param())

{#8

my$User=$cgi->

param('

UserName'

);

my$UserPwd=$cgi->

OldPwd'

my$UserNewPwd=$cgi->

NewPwd1'

my$MatchNewPwd=$cgi->

NewPwd2'

if(!

$User)

{&

Writer_Log("

Enternousername"

otherhtml($title,$entername,$back);

}

elsif(!

$UserPwd)

EnternoOldPasswd"

otherhtml($title,$enterpwd,$back);

elsif(length($UserNewPwd)<

$pwdminlen)

Password'

slengthmustgreaterthan"

.$pwdminlen);

otherhtml($title,$passmustgreater.$pwdminlen,$back);

elsif($UserNewPwd=~/^\d+$/)

NewPasswdisn'

talldiginal"

otherhtml($title,$pwd_not_alldiginal,$back);

elsif($UserNewPwd=~/^[A-Za-z]+$/)

tallchar"

otherhtml($title,$pwd_not_allchar,$back);

elsif($UserNewPwdne$MatchNewPwd)

Twonewpasswordsarenotmatched"

otherhtml($title,$twopassnotmatched,$back);

else

{if($authuserfile)

{#6

openUserFile,"

$authuserfile"

ordie"

打开文件失败:

$!

while(<

UserFile>

{#5

my$varstr=$_;

if($varstr=~/($User)/)

{#3

my$eqpos=index($varstr,"

:

my$UserName=substr($varstr,0,$eqpos);

my$cryptpwd=substr($varstr,$eqpos+1,13);

nextif($UserNamene$User);

if(crypt($UserPwd,$cryptpwd)eq$cryptpwd)

{#a

my$rc=system("

/usr/bin/htpasswd-b$authuserfile$User$UserNewPwd"

if($rc==0)

{#1

Writer_Log($User."

ChangePasswd"

otherhtml($title,$changepwdok,$back);

}#1

{#2

ChangePasswdFailed"

otherhtml($title,$changepwdfailed,$back);

}#2

exit;

}#a

{#b

OldPasswdisIncorrect"

otherhtml($title,$errorpwd,$back);

}#b

}#3

{#4

if(eof)

nothisuser"

otherhtml($title,$user_not_exists,$back);

{next;

}#4

}#5

closeUserFile;

}#6

{#7

Writer_Log($authuserfile."

nofound"

otherhtml($title,$file_not_found,$back);

}#7

}#8

Index_Html;

subIniInfo{

my$inifile="

/var/www/cgi-bin/ChangePasswd.ini"

openCGI_INI_FILE,"

$inifile"

CGI_INI_FILE>

{

my$eqpos=index($_,'

='

my$le

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 卡通动漫

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1