- 浏览: 255130 次
- 性别:
- 来自: 大连
文章分类
最新评论
-
红小豆:
Criteria和Detachedcriteria的区别及应用 -
fjjiaboming:
那就稍微翻译一下 啊....
Mysql autoReconnect 的问题 -
woyaowenzi:
非常感谢,我正想做一个画线的控件,就和windows的画图板一 ...
一个简单的FLEX画图demo -
guzen:
可以用一下flash builder 4,现在支持绝对定位了, ...
how to use flex layouts -
suifeng:
好!
一个简单的FLEX画图demo
Subversion on CentOS
Subversion isn't just for coders and programmers...I know because I'm not one. I've begun to use it lately for many things, such as, backing up Nagios configurations, documents, and pretty much anything text based. I don't know why I didn't start using it sooner, but none the less, here I am. This document quickly explains how to install, configure, and use subversion locally, as well as across Apache on a network. For complete and complex configurations and installations seek the documentation provided. There is plenty of well written documentation on the subject, that far exceeds my knowlegde of the tool. This just helps get you started quickly, for those like me that just like to jump in head first into new things.
System:
CentOS 4.x/RHEL 4
CentOS 5.1/RHEL 5
References:
Subversion: http://subversion.tigris.org/
Version Control with Subversion: http://svnbook.red-bean.com/
When you install from yum, there's a longer list than the two packages above that will automatically resolve themselves. Some other things will be installed automatically. Depending on your packages, your mileage may vary.
1) Installation:
The first thing to do is to install the packages I mentioned above. If you don't have Apache installed already, it'll go ahead and drag that down as well.
[root@lucifer ~]# yum install mod_dav_svn subversion
2) Configurations:
a) Apache:
Before you delve into the deep end, you need to ensure Apache is set up first. I'm assuming this is a virgin installation, so if you already have Apache things going...be careful what you change. I'm also going to explain setting this up with basic password protection. You can easily let this out, however, if you want to allow access to the repos from everyone.
First thing is make sure you open up /etc/httpd/conf/httpd.conf and at least change the ServerName directive. If you need more help or more complex configurations, then consult the Apache docs please.
[root@lucifer ~] vim /etc/httpd/conf/httpd.conf -- Edit what you need and save the file [root@lucifer ~] service httpd start [root@lucifer ~] chkconfig httpd on
Browse to your machine on the network and see if you get your test page, which you should: http://yourmachine . Working? Great, let's move along to more fun things.
b) Subversion's Apache configs:
The next step is to setup some settings within Apache so Subversion and Apache play nice together. Get yourself to the example configuration file Subversion installed for you.
[root@lucifer ~] cd /etc/httpd/conf.d/ [root@lucifer ~] vim subversion.conf # Make sure you uncomment the following if they are commented out LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so # Add the following to allow a basic authentication and point Apache to where the actual # repository resides. <Location /repos> DAV svn SVNPath /var/www/svn/repos AuthType Basic AuthName "Subversion repos" AuthUserFile /etc/svn-auth-conf Require valid-user </Location>
The location is what Apache will pass in the URL bar. For instance: http://yourmachine/repos points to the SVNPath that you have specified. My examples are just that, so feel free to put things where you want. Make sure you save the file when you are finished editing.
Next we have to actually create the password file that you specified in the previous step. Initially you'll use the -cm arguments. This creates the file and also encrypts the password with MD5. If you need to add users make sure you simply use the -m flag, and not the -c after the initial creation.
[root@lucifer ~] htpasswd -cm /etc/svn-auth-conf yourusername New password: Re-type new password: Adding password for user yourusername [root@lucifer ~] htpasswd -m /etc/svn-auth-conf anotherusername New password: Re-type new password: Adding password for user anotherusername
c) Configure your repository
The next thing you need to do is to create the actual repository from which you will check in and out your files. This is simple to do with some of the included svn tools.
[root@lucifer ~] cd /var/www/ -- Or wherever you placed your path above [root@lucifer ~] mkdir svn [root@lucifer ~] cd svn [root@lucifer ~] svnadmin create repos [root@lucifer ~] chown -R apache.apache repos [root@lucifer ~] service httpd restart
Go test out whether or not you can access your repository from a web browser: http://yourmachine/repos . You should get a popup box asking for a username and password. If so, type in your credentials and you should be displayed with a Revision 0:/ page. If so, that's it for setting up a repo. If you want multiple repos, check out the docs from the links provides above. This sets up one repository and shows you how to start using them. Speaking of, let's move on to just that.
3) Using Subversion:
a) Layout Your Repo:
If all went well above, you're now ready to start using the repository that you created. Subversions svn tool is the command line client that you will use to talk to the database. To see the use of the tool:
[root@lucifer ~] svn --help
The most common arguments you will most likely be using are: svn import, svn commit (ci), and svn checkout (co). With these you will initially import files into your repository with import, you'll check them out to work on them with checkout, and you'll commit the changes back into the database with commit. It's pretty simple once you see them in use a few times.
Before I continue I'd like to explain about directory structure layouts. Almost all of the documentation talks about creating a certain layout for your directories. They specifically mention about making sure you have a branches, tags, and trunk underneath the root directory structure, where trunk holds all your files. For instance:
. |-- project1 | |-- branches | |-- tags | `-- trunk `-- project2 |-- branches |-- tags `-- trunk
The book explains why in a bit more detail, and I mainly don't bother using this type of layout...because I'm not doing coding and maintaining "projects" per se. I'm mainly using it to store configuration files, and text items that aren't as complex. Set things up for whatever works for you.
As an example, I'm going to just create some dummy directories and throw some files in them. This is from the actual SVN server. Play along.
[root@lucifer ~] cd /tmp [root@lucifer ~] mkdir mytestproj [root@lucifer ~] cd mytestproj [root@lucifer ~] mkdir configurations options main [root@lucifer ~] vim configurations/testconf1.cfg -- Add whatever you want to these files. [root@lucifer ~] vim options/testopts1.cfg [root@lucifer ~] vim main/mainfile1.cfg
Keep in mind that you can layout anything anyway you'd like. Once you have the initial layout of what you want, let's go ahead and import this up to Subversion.
b) Importing:
[root@lucifer ~] svn import /tmp/mytestproj/ file:///var/www/svn/repos/mytestproj -m "Initial repository layout for mytestproj" Adding /tmp/mytestproj/main Adding /tmp/mytestproj/main/mainfile1.cfg Adding /tmp/mytestproj/configurations Adding /tmp/mytestproj/configurations/testconf1.cfg Adding /tmp/mytestproj/options Adding /tmp/mytestproj/options/testopts1.cfg
c) Checking Out:
Now, just to check it out across the web browser: http://yourmachine/repos . You'll get whatever you have imported showing up to peruse. Once you upload your original layout from the local SVN server, you're now free to use it remotely on another machine. As long as you are connecting to the Subversion server with the user account(s) that you created earlier. Let's give it a shot.
[me@mylappy ~] cd /tmp [me@mylappy ~] svn co http://yoursvnserver/repos/mytestproj Authentication realm: <http://yoursvnserver:80> Subversion repos Password for 'youruser': A mytestproj/main A mytestproj/main/mainfile1.cfg A mytestproj/configurations A mytestproj/configurations/testconf1.cfg A mytestproj/options A mytestproj/options/testopts1.cfg Checked out revision 1.
d) Edit & Commit
As you can see, you've checked out revision 1 from the Subversion server. Now you can edit some things and commit the changes back to the Subversion server.
[me@mylappy ~] cd mytestproj [me@mylappy ~] vim configurations/testconf1.cfg -- Add or delete something and save. [me@mylappy ~] svn commit -m "Added a line to testconf1.cfg." Sending configurations/testconf1.cfg Transmitting file data . Committed revision 2.
The nice thing about this then, is that you can delete all of the directories that you just checked out on your machine. The only reason you checked them out, was to edit them, and then send them back up the line. Web browse to your server to check out the different files.
e) Adding/Deleting Items
Now this is all fine and dandy, but how do you add more files to an already existing repo directory? Easy, with the add argument. Go ahead and checkout your latest and greatest, copy a file over to a directory, add, then commit the changes.
[me@mylappy ~] svn co http://yoursvnserver/repos/mytestproj A mytestproj/main A mytestproj/main/mainfile1.cfg A mytestproj/configurations A mytestproj/configurations/testconf1.cfg A mytestproj/options A mytestproj/options/testopts1.cfg Checked out revision 2. [me@mylappy ~] cd mytestproj [me@mylappy ~] cp /etc/yum.repos.d/CentOS-Base.repo configurations/ [me@mylappy ~] svn add configurations/CentOS-Base.repo A configurations/CentOS-Base.repo [me@mylappy ~] svn commit -m "Added the CentOS Yum repo file." Adding configurations/CentOS-Base.repo Transmitting file data . Committed revision 3.
To delete items simply use delete instead of add. Commit your changes back up, and you're good to go. It's as simple as that. Go back over to your web browser again and you'll notice the revision number should say 3. You'll be able to click through the files to pick our your differences as well.
f) Reverting Back:
Ok, this is all great but how do I revert back to an older revision...isn't this the point of Subversion? Yep, it's easy. If you're not sure as to what revision you're at...check out the log command. This is why you put a message in every commit. Short and to the point, but enough information to ring a bell that you perhaps forgot about.
[me@mylappy ~] svn log http://yoursvnserver/repos -- For the entire repository [me@mylappy ~] svn log http://yoursvnserver/repos/mytestproj -- For the specific project
You'll get a nice complete list of revision numbers along with the comments, like I mentioned above. This allows you to pick which revision you want to check back out now.
[me@mylappy ~] svn co -r 1 http://yoursvnserver/repos/mytestproj
This command will drag down revision number 1.
4) Access control lists
Usually, you don't want to give every user access to every repository. You can restrict repository access per user by using ACLs. ACLs can be enabled with the AuthzSVNAccessFile file option, which takes a file name as its parameter. For instance:
AuthzSVNAccessFile /etc/svn-acl-conf
You can add this to the relevant Location section:
<Location /repos> DAV svn SVNParentPath /var/www/svn/repos AuthzSVNAccessFile /etc/svn-acl-conf AuthType Basic AuthName "Subversion repos" AuthUserFile /etc/svn-auth-conf Require valid-user </Location>
You can then create /etc/svn-acl-conf . This file consist of sections of the following form:
[reponame:repopath] user = access
Where access can be r (read), rw (read-write), or empty (no access at all). The default ACL is to give users no access to a repository. Suppose that there is a repository named framework to which you would like to give john read access, and joe read and write access. You could then add the following section:
[framework:/] john = r joe = rw
It is also possible to create groups in a section named groups , groups are then prefixed with the 'at' sign (@ ) in the access control lists. For instance:
[groups] staff = joe, george [framework:/] john = r @staff = rw
If you would like to make all repositories readable to all users, you can add a section for the root directory of every repository:
[/] * = r
5) Afterthought:
This is only a very very small part of the power of what Subversion can offer you. This quick guide will get you going, and show you how to use it a bit to understand how it's working. You can do all kinds of things with the Subversion tools, so make sure you check the docs out to learn about different options that might assist you in your tasks. Also remember that the Apache installation might be overkill for your needs. You can completely use the Subversion tools locally on a machine by specifying file:///path/to/repo , instead of my examples across Apache as http://yoursvnserver/repos/whatever . From what I read, many folks use it on their local boxes just to keep their minds straight for huge projects and configurations file. Good luck
Further reading
Version Control with Subversion
发表评论
-
redhat as5.4 安装网站截图软件CutyCapt
2012-02-23 09:21 2080先安装Qt47 Java代码 收藏代码 增加qt4 ... -
linux中将前台进程转入后台的方法
2011-09-07 17:31 2764今天在网上偶然看到一个不错的建议。先更新一下: 以前在使用no ... -
Vnstat: 简单实用的网络流量统计工具
2011-05-18 22:02 1468http://www.linuxeden.com/html/s ... -
视频网站架构
2011-01-23 01:01 1582http://www.doorsolutions.cn/ 概述 ... -
how to install ffmpeg
2011-01-23 00:33 1540A little while back, I posted a ... -
CentOS安装MPlayer
2010-05-31 14:36 1507http://wiki.centos.org/TipsAndT ... -
linux下tomcat启动80端口不能访问的问题
2009-06-15 21:18 7069service iptables save [code=&a ... -
Understanding memory usage on Linux
2009-06-12 10:50 1158This entry is for those people ... -
上传文件到linux时出现的乱码
2009-04-30 16:32 2125遇到见很郁闷的事。 维护一个很老的代码,编码都是gbk的,别 ... -
gdb 使用手册
2009-04-28 16:46 2095简述 一 列文件清单 二 ... -
OOM 机制
2009-03-26 21:40 1221When a system runs out of memor ... -
OOM killer "Out of Memory: Killed process SOLUTION
2009-03-26 21:39 1858Since this problem seems to pop ... -
A Quick Benchmark: Gzip vs. Bzip2 vs. LZMA
2009-03-09 09:50 1475How the test files were selecte ... -
linux 网络配置
2009-03-03 15:54 1153网络信息查看 查看网路接口信息 1.了解lin ... -
linux下删除文件出错
2009-01-12 16:27 2086今天忘记把程序停止, ... -
linux下自动备份mysql数据库
2009-01-12 16:22 1131新建文件: vi /home/bzhang/mysql_aut ... -
计划任务工具 cron 的配置和说明
2009-01-12 10:01 1107计划任务工具 cron 的配置和说明 作者: 北南南 ... -
用vsFTPd自架Linux网络安装服务器,以及Redhat局域网安装的解决办法
2009-01-05 12:06 1311ZZ FROM: http://www.linuxsir.or ... -
Clock in a Linux Guest Runs More Slowly or Quickly
2009-01-04 10:55 2074Clock in a Linux Guest R ... -
IPTABLE 学习
2008-12-30 15:40 960To be continued...
相关推荐
Windows下Subversion安装使用 Windows下Subversion安装使用
### Subversion 安装为 Windows 服务 #### 概述 在早期的 Subversion 版本中,若想将其作为 Windows 服务运行,则通常需要借助第三方工具如 svnservice 或其他方式来实现这一功能。然而从 Subversion 1.4 版本开始...
CollabNet-SubversionSubversion安装配置,非常详细的介绍了安装过程
### Subversion (SVN) 安装与配置详解 #### 一、Subversion 简介 Subversion(简称SVN)是一种集中式版本控制系统,用于管理软件开发过程中的源代码版本控制。它通过记录每次对文件或目录所做的更改来追踪项目的...
### Subversion安装配置知识点 #### 一、Subversion简介 Subversion(简称SVN)是一种分布式版本控制系统,广泛应用于软件开发领域。它可以帮助团队管理源代码,并跟踪每一处更改及其作者,支持多人协作开发。 ###...
### Subversion 安装与配置详解 #### 一、Subversion 概述 Subversion (SVN) 是一种广泛使用的版本控制系统,它被设计用来替代早期的版本控制系统如 VSS 和 CVS。相比于 VSS 和 CVS,Subversion 提供了更加强大、...
### Subversion安装手记 #### 一、概述 本文档主要记录了Subversion(简称SVN)在Windows环境下的安装步骤及其配置流程。Subversion是一款非常流行的版本控制系统,广泛应用于软件开发过程中的代码版本管理。它...
Subversion(SVN)工具及安装教程 Subversion是一个强大的版本控制系统,被广泛应用于软件开发领域,特别是多人协作的项目中。它允许开发者们在不同的时间、地点对同一份代码库进行修改,同时还能追踪每一次修改,...
### Subversion (SVN) 服务器端安装及配置详解 #### 一、概述 Subversion (SVN) 是一种集中式版本控制系统,广泛应用于软件开发过程中。本文将详细介绍如何在Windows环境下安装和配置SVN服务器。 #### 二、安装...
验证Subversion安装 安装完成后,可以通过命令行工具验证Subversion是否安装成功。打开命令提示符,输入以下命令: ```batch svn --version ``` 如果安装成功,将会显示Subversion的版本信息。例如: ``` svn, ...
本文将详细讲解如何在Linux系统上安装和配置Apache Web服务器以及Subversion版本控制系统。 首先,Linux作为开源操作系统,是许多服务器的基础,其稳定性和安全性深受开发者喜爱。在本案例中,我们将使用它作为平台...
subversion tar安装 编译subversion tar安装 编译subversion tar安装 编译
配置Subversion安装,确保它与系统环境兼容,并指定安装路径: ```bash ./configure --prefix=/usr/local/svn ``` 编译和安装Subversion: ```bash make sudo make install ``` 安装完成后,我们需要创建一个SVN...
### Subversion Server(1.4.3)安装与配置详细指南 #### 一、概述 本文档详细介绍了如何安装和配置Subversion Server(版本1.4.3),这对于团队协作开发项目的版本控制非常有帮助。Subversion(简称SVN)是一种...
这个文件通常位于Subversion安装目录下的conf子目录。 6. **创建服务**: 使用`sc`命令创建一个新的系统服务,例如: ``` sc create SVNService binPath= "C:\Program Files\Subversion\svnserve.exe --service ...
1. **Subversion安装**: `Setup-Subversion-1.6.3.msi` 是Subversion 1.6.3的安装程序,它包含了服务器和客户端组件。安装过程中,你需要选择安装路径,配置服务器端(如Apache或VisualSVN)和客户端工具(如...
2. **安装 Subversion**: 获取适用于您操作系统的 Subversion 安装包,安装过程中注意配置选项,确保与 Apache 版本兼容。 3. **配置 Apache**: 打开 Apache 的配置文件(通常为 httpd.conf),添加 SVN 相关模块。...
用`make install`命令将编译好的Subversion安装到系统路径中: ``` sudo make install ``` 7. **设置环境变量**: 如果需要,更新你的`~/.bashrc`或`~/.bash_profile`,添加Subversion到PATH环境变量中。 8. ...