当前位置首页 > Fedora知识

技术文档1--VMWARE-Fedora下的APACHE整合subversion(局域网内搭建可实现外网访问)

阅读次数:249 次  来源:admin  发布时间:

VMWARE-Fedora 11 下的APACHE整合subversio

目录:

1. 环境和软件准备

2. 配置网络

3. Apache的安装与配置(略)

4. Subversion的安装与配置

5. Subversion的使用(略)

附录1:subversion提供的简单服务器配置参考

附录2:软件包管理器YUM

1. 环境和软件准备

主机操作系统:Windows XP

VMware Workstation : V6.5完整版(即带网络连接)

VMware 操作系统: Fedora 11

Linux –Subversion:在fedora里使用rpm包管理方式安装,最新版即可

以上配置我配置通过的清单。其他版本以及操作系统只要兼容以上软件,配置类似。

2. 配置网络

若主机为公网地址

则直接使用NAT或者Bridge方式配置VMware网络连接。然后进行下面第3步的配置。

若主机为局域网,需要做一次映射或者搭建VPN服务器,使外网能够访问主机。

若用的TP-LINK路由器,具体做法是:

在虚拟主机操作中选择增加一个条目,输入URL以及端口号。并配置立即生效。

测试:外网ping通内网主机即可。

然后用NAT或者Bridge方式配置VMware网络连接。使VMware的IP地址作为一个内网的一个独立地址。

如内外网段为:192.168.1.0

主机IP:192.168.1.137

VMware虚拟机IP为:192.168.133

3.Apache的安装与配置:

略。可参考http://man.ddvip.com/linux/debian/apache2/debian-apache2-4.html

4.  Subversion安装与配置

a)        在Fedora下的安装过程:(直接使用YUM包管理安装,手动安装亦可但要处理好配置文件位置,一般讲Subversion.conf放于/etc/httpd/conf.d)

#yum install apr

#yum install mod_dav_sv

)       Apache整合SVN的通用配置:

首先,安装完成后在/etc/httpd/conf.d中找到subversion.conf,若无则建立。修改或新建配置文档如下:

----------------------------------------------------------------------------------------------------------

LoadModuledav_svn_module     modules/mod_dav_svn.so

LoadModule authz_svn_module  modules/mod_authz_svn.so

lt;Location /repos>

DAV sv

SVNParentPath/public/svn/

#

#   # Limit write permission to list ofvalid users.

#   <LimitExcept GET PROPFIND OPTIONSREPORT>

#      # Require SSLconnection for password protection.

#      # SSLRequireSSL

#

AuthzSVNAccessFile/etc/httpd/authz.conf

AuthType Basic

AuthName"Please enter your name and password"

AuthUserFile/etc/httpd/conf.d/authfile

Require valid-user

#   </LimitExcept>

lt;/Location>

----------------------------------------------------------------------------------------------------------

注:

SVNParentPath指明svn数据库的路径,如果有多个项目,则指向多个项目的父目录,用户可以通过http://ip_addr/repos/project_1来访问。

AuthUserFile指明http访问用户名,密码验证文件路径,如果不设置用户名,密码则该部分可以注释掉。添加用户用如下命令:

htpasswd-c /etc/httpd/conf.d/authfile sxr

-c表示创建,以后添加则不需此参数。

AuthzSVNAccessFile指明详细权限设置文件路径,该文件可以进一步指明不同项目的访问权限,该文件的格式如下(需要注意每行前面不能有空格 ):

---------------------------------------------------------------------------------------------------------

[groups] 

usr = usr

tb_usr = stb_usr

[AR6k:/]

usr = rw

[linux-2.6.30:/]

tb_usr = rw

---------------------------------------------------------------------------------------------------------

然后重新启动apache服务

#apachectlrestart

附录:设置subversion库

用如下命令创建subversion管理库

#mkdir/public/svn/AR6k

#svnadmincreate /public/svn/AR6k

参考如下内容编辑配置文件

#cat/public/svn/AR6k/conf/svnserve.conf

###This file controls the configuration of the svnserve daemon, if you

### use it to allow access to this repository.  (If you only allow

### access through http: and/or file: URLs, then this file i

### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

[general]

### These options control access to the repository for unauthenticated

### and authenticated users.  Valid values are "write","read",

### and "none".  The sample settings below are the defaults.

anon-access = read

auth-access = write

### The password-db option controls the location of the password

### database file.  Unless you specify a path starting with a /,

### the file\'s location is relative to the directory containing

### this configuration file.

### If SASL is enabled (see below), this file will NOT be used.

### Uncomment the line below to use the default password file.

assword-db = passwd

### The authz-db option controls the location of the authorizatio

### rules for path-based access control.  Unless you specify a path

### starting with a /, the file\'s location is relative to the the

### directory containing this file.  If you don\'t specify a

### authz-db, no path-based access control is done.

### Uncomment the line below to use the default authorization file.

authz-db = authz

### This option specifies the authentication realm of the repository.

### If two repositories have the same authentication realm, they should

### have the same password database, and vice versa.  The default realm

### is repository\'s uuid.

# realm = My First Repository

导入工程文件

#svnimport AR6k files:///public/svn/AR6k -m "original"

完成

现在即可使用Http远程访问。若要更改端口号则只需在/etc/httpd/conf中配置httpd.conf的端口号。通常替换为一个不常用端口。则在路由器上映射时不会冲突。

5.  Subversion的使用(略)

可参考 http://www.cnblogs.com/freeliver54/archive/2010/06/22/1762469.html

附录1:subversion提供的简单服务器配置参考

如果想直接使用subversion提供的简单服务器,即用svn:方式访问版本库。

可以参考示例配置以下两个文件

#vi /public/svn/AR6k/conf/authz

###This file is an example authorization file for svnserve.

[aliases]

# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=ResearchInstitute/CN=Joe Average

[groups]

xr = sxr

cvs = cvsroot

[repository:/public/svn/AR6k]

@sxr = rw

# @harry_and_sally = rw

# * = r

[AR6k:/]

@sxr = rw

@cvs = rw

其中@sxr表示sxr组

#vi/public/svn/AR6k/conf/passwd

###This file is an example password file for svnserve.

### Its format is similar to that of svnserve.conf. As shown in the

### example below it contains one section labelled [users].

### The name and password for each user follow, one account per line.

[users]

# harry = harryssecret

# sally = sallyssecret

xr = sxr

cvsroot = cvsroot

启动subversion服务器

#svnserve-d -r /public/svn/

然后就可以通过svn://ip_addr/AR6k 来访问代码库。

附录2:

软件包管理器YUM

Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。基於RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。

软体包来源

可供Yum下载的软体包包括Fedora本身的软体包以及源自rpmfusion和rpm.livna.org的Fedora Extras,全部是由Linux社区维护的,并且基本是自由软体。所有的包都有一个独立的GPG签名,主要是为了您的系统安全。而对於Fedora core 4.0 的用户,rpm.livna.org 的签名是自动导入并安装的。

图形化前端

Yum的图形化前端主要有yumex和kyum。它们并不是独立於Yum的,而是Yum的图形前端,也就是说在安装和使用Yumex和kyum同时,都是以Yum的安装和配置为基础;所以在用Yumex或kyum 时,必须先安装配置Yum。

常用命令行命令

安装软件(以foo-x.x.x.rpm为例):yum install foo-x.x.x.rpm

yum常用命令

删除软件:yum removefoo-x.x.x.rpm或者yum erasefoo-x.x.x.rpm

升级软件:yum upgrade foo或者yum update foo

查询信息:yum info foo

搜索软件(以包含foo字段为例):yum search foo

其它参数参见man yum

上一篇:fedora不启动X11界面;跨平台开发环境的搭建
下一篇:Fedora25和win10双系统安装及使问题汇总