`
marlgl
  • 浏览: 73497 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

HOWTO_CVS_Server

阅读更多

http://gentoo-wiki.com/HOWTO_CVS_Server 丢失了,做个备份

[edit ] Introduction

If you've ever had some sort of programming project where you didn't want to turn your code into a disorganized soup of text files, you probably have had the idea of setting up a CVS server. While I will not explain what CVS "is" (you can read all about it here ), what I will try to do here is tell you how to set up a CVS server from start to finish. A more modern orientated program which does virtually the same is Subversion also known as svn. For the gentoo-wiki entry click here

Remark, that this HOWTO describes how to access a CVS using the pserver protocol. This protocol is insecure, as it transfers passwords in plain text. A more secure approach is to access CVS via SSH with public key authorization.

[edit ] Installation

# USE="server" emerge cvs
# emerge cvsd

That took care of the installation part. You have a nice and operable CVS client ("cvs"), and the CVS daemon that will be running on your system in order to make it a functional CVS server. CVS must be built with the "server" USE flag or else CVSD will not work properly. Whenever someone attempts to connect, you will get this error:

 cvs [login aborted]: unrecognized auth response from <host> cvs: unrecognized option `--allow-root=/root'

[edit ] Create a CVS Jailroot

Now, you have to decide where you would like to place your CVS jailroot. This jailroot is a directory where the CVS repository will be held, and other things like configuration, (encrypted) CVS user passwords, etc. A good location to put your jailroot in is /var/lib/cvsd , which hereafter will be the meaning of "jailroot" in this document.

Let us set it up the CVS jailroot:

# mkdir /var/lib/cvsd
# cvs -d /var/lib/cvsd/root init
# cvsd-buildroot /var/lib/cvsd
# cd /var/lib/cvsd
# mkdir -p var/lock

Now our CVS jailroot is done. Our next task is to configure cvsd to run properly, and here is how it's done:

 

Tip: cvsd doesn't work correctly if its jail is on filesystem with nodev

Fire up your favourite editor (I like nano, very Gentoo-ish. And yes, still as root!):

# nano -w /etc/cvsd/cvsd.conf

Here is what you have to look for in the config and modify accordingly so the lines you modify look like this (Note - just modify the lines that look like the ones in the box to say exactly what they say in the box; do not make your whole file look like that! Also, make sure that the whole file ends in a newline):

File: /etc/cvsd/cvsd.conf
RootJail /var/lib/cvsd
Uid cvsd
Gid cvsd
Listen * 2401 # or whatever port you'd like it to listen on, up to you
Repos /root

When you're done modifying, press CTRL+O, then <ENTER>, and finally CTRL+X to quit nano.

[edit ] Add Users

There is one more thing you need to set up - users. CVS obviously has to have users, otherwise you will never know who is responsible for the various source files! So here it is:

# cvsd-passwd /var/lib/cvsd/root YOUR_USER_HERE

You will be prompted for a password, where I'm sure you know what to do. If you are extra-clever, you might realize that making the user name "anonymous" and not entering a password (just pressing ENTER will do) will create an anonymous CVS user. Woohoo!

  • NOTE: To create a user that has only read rights follow the next steps:
# touch /var/lib/cvsd/root/CVSROOT/readers
# chown cvsd:cvsd /var/lib/cvsd/root/CVSROOT/readers
# nano /var/lib/cvsd/root/CVSROOT/readers

Add the users you just created to this file, each user seperated by a new line. Do not forget to put a new line after the last user. This setting only allows readers to the repository, to allow writers, create a file writers on same path.

  • If a user is in the readers file the user is only allowed to read, regardless of whether or not they are in the writers file. If the user is in the writers file and not the readers file they can both read and write.

Example:

File: /var/lib/cvsd/root/CVSROOT/readers
guest
anonymous
john

[edit ] Apply Correct Permissions

Once you're done setting up your various users, there are three more things to do:

  1. Change the permissions/ownership of your cvs directory
  2. Restart cvsd
  3. Add cvsd to your runlevel (if you want to)

1. Changing permissions and ownership. As root:

# cd /var/lib
# chown -R cvsd:cvsd cvsd
# chmod -R 775 /var/lib/cvsd/root

2. (Re)starting cvsd, your CVS daemon. As root:

# /etc/init.d/cvsd restart

3. If you'd like to, we can set it up so your CVS daemon starts up whenever your system does:

# rc-update add cvsd default

And now you are done. Read up on how to use the CVS client ("man cvs"), and keep your code organized.

- Kirill Zorin.

[edit ] Quick local test

[edit ] Common method

1. Set your CVSROOT environment var (:pserver:<username>@<host>:/cvsdirectory)

# CVSROOT=:pserver:YOUR_USER_HERE:PASSWORD@localhost:/root; export CVSROOT

2. Login

# cvs login

3. Import/Checkout something (See below)

4. Logout

# cvs logout

[edit ] Import/Checkout something

1 . (Optional) Import your first project into cvs

# cvs import -m 'Example01 project' example01 vendor start

Note:
Make sure your cvs user name is in /var/lib/cvsd/root/CVSROOT/writers and not in "CVSROOT/readers".
example01 is the name of the project,vendor is the vendor tag (can be anything) start is the release tag (can be anything which identifies the release)

all 3 fields must be included

Also note that this command will import everything in your current working directory, so if you wanted to import all the files in ~/example1/, you should cd into that directory, then execute the cvs import command. When you check out the files later, cvs will create a directory with the same name as the project to keep things neat.

2 . (Optional) Checkout your first project from cvs

# cvs -d myExmp01 co -A example01

[edit ] Tips and Tricks

Delete all CVS Folders:

 # find ./* -type d | grep CVS | sed "s/^/rm -rf /" | sh


This variation will handle properly folders with spaces in their names and will handle hidden folders.

find -type d | grep CVS | sed "s/^/rm -rf \"/"|sed "s/$/\"/" | sh

[edit ] Finally

Don't forget to route the port 2401 into your firewall

[edit ] Potential Errors

The cvsd-1.0.2 build has a problem running the cvsd-buildroot command in which it does not copy all the libraries that are needed for the server to run correctly. If you are experiencing this error

cvs [login aborted]: reading from server: Connection reset by peer

Then use the following commands to fix this problem.

# cp /lib/ld-* /path/to/cvsdir/lib/
# cp /lib/libdl.so.2 /path/to/cvsdir/lib/
# cp /lib/ld.so.1 /path/to/cvsdir/lib/

(note: with the above setup /path/to/cvsdir/lib/ is /var/lib/cvs/lib/)

Related Bug Report: Bug 87124

Related Forum Discussion: CVSD help

[edit ] SSH Mode

[edit ] Access on a local server

You can very easily use cvsd in the more secure ssh mode if you already have sshd set up. You may want to skip the step where you create pserver users:

 # cvsd-passwd /var/lib/cvsd/root YOUR_USER_HERE

If you already did that, you can reverse it by simply editing the file CVSROOT/passwd so that it is blank. This disables the pserver mode.

To give users on your server access to the cvs repository, issue the following commands:

 # chmod -R 775 /var/lib/cvsd/root
 # gpasswd -a USERNAME cvsd

Repeat the second line for each user who needs access to cvs. Now any user that can access your server via ssh who also belongs to the cvsd group can access the cvs repository by setting CVSROOT as follows:

 # CVSROOT=:ext:YOUR_USER_HERE@YOUR_HOST_NAME:/var/lib/cvsd/root; export CVSROOT
Note: You cannot try ssh with command:
cvs login

because login command is enabled only for pserver protocol, you can try to list files in repository with command

cvs rls

(you have to have CVSROOT variable set)

If your client is not running a recent Gentoo version, you may also have to set CVS_RSH as follows:

 # CVS_RSH=ssh;export CVS_RSH

[edit ] Access through a gateway

In theory you can define CVS_RSH to be any valid command which gives you a remote command interpreter. Namely as long as this scheme works, then CVS can use this particular CVS_RSH as a means to perform the neccesary tasks:

 # $CVS_RSH YOUR_USER_HERE@YOUR_HOST_NAME SOME_COMMAND

Now suppose your cvs server is on a machine called INTERNAL, and you have to login to an ssh gateway machine called GATEWAY first. Then you can define CVS_RSH:

 # export CVS_RSH=gateway_ssh 

Now fireup your favorite editor, put these lines in your gateway_ssh file:

 # #!/bin/sh
 ssh -t user@gateway ssh "$@"

Now let's save it in a directory which is in your $PATH, and conduct a basic test:

 # gateway_ssh YOUR_USER_HERE@INTERNAL ls

You should see a list of files on INTERNAL.

Now edit your CVSROOT variable:

 # export CVSROOT=":ext:INTERNAL:/var/lib/cvsd/root"

And you should be able to use cvs from your home computer now!

[edit ] Combining pserver and SSH Mode

It is possible to use pserver mode and ssh mode at the same time. Just setup your server to use pserver. Create all pserver users with

 # cvsd-passwd /var/lib/cvsd/root YOUR_USER_HERE

and setup ssh like above:

 # chmod -R 775 /var/lib/cvsd/root
 # gpasswd -a USERNAME cvsd


Please note that the path to the repository is different for pserver and ssh.

 # CVSROOT=:pserver:YOUR_USER_HERE@YOUR_HOST_NAME:/root;
 export CVSROOT  #pserver
 # CVSROOT=:ext:YOUR_USER_HERE@YOUR_HOST_NAME:/var/lib/cvsd/root;
 export CVSROOT  #ssh
 
但在客户端连接服务器的时候碰上了大部分人都遇到的权限问题,在import时提示
"import" requires write access to the repository
在网上转了一圈,解决办法如下:
在CVSROOT目录下  将readers文件中用户名删除,建立或修改writers文件,将用户名添加至该文件即可
分享到:
评论

相关推荐

    CVS.rar_cvs_cvs Lin_cvs linux_linux c_linux c++

    标签“cvs_lin cvs_linux”强调了CVS在Linux环境中的特性和用法。在Linux中,CVS可以通过命令行方便地进行交互,这对于熟悉Unix/Linux shell的开发者来说非常高效。同时,由于CVS支持标准的Unix文件权限和访问控制,...

    cvs-linux-rpm.tar.gz_cvs r_cvs r_cvs rpm_cvs rpm linux_linux rp

    1. **客户端连接**:在客户端机器上,安装CVS或Cvsnt客户端,然后通过`cvs -d :pserver:username@hostname:/cvsroot checkout module`命令连接到服务器并检出代码。 2. **版本控制操作**:Cvsnt支持CVS的所有基本...

    TortoiseCVS_CVS客户端工具

    TortoiseCVS_CVS客户端工具

    OpenQVis_cvs_19_03_2003.tar

    《OpenQVis_cvs_19_03_2003.tar:探索量子可视化工具的奥秘》 OpenQVis_cvs_19_03_2003.tar 是一个历史版本的OpenQVis项目的源代码压缩包,发布于2003年3月19日。OpenQVis,全称Open Quantum Visualization,是一个...

    cvs.zip_WinCVS_cvs

    【cvs.zip_WinCVS_cvs】是一个包含有关CVS(Concurrent Versions System)技术文档的压缩包,特别强调了WinCVS的使用。这个压缩包中的资源可以帮助用户理解和掌握CVS的基本操作以及如何在Windows环境下通过WinCVS...

    cvsnt-server-2.5.05.3489.rar_cvs 2.5.05_cvsnt server_cvsnt-_cvsn

    开发者通常使用Cvsnt的客户端工具,如TortoiseCVS,与Cvsnt Server进行交互。这些客户端工具提供了图形化的操作界面,简化了版本控制操作,如检出、提交、更新和合并。 4. **协同开发实践** 在Java项目中,团队...

    cvs.rar_cvs

    【标题】"cvs.rar_cvs" 涉及的核心知识点是版本控制系统CVS(Concurrent Versions System),这是一个开源的版本控制系统,广泛用于软件开发项目,以管理代码的版本历史和协同开发。这个压缩包文件显然是为了帮助...

    CVS.rar_cvs

    4. **创建CVS仓库**:使用`cvs -d &lt;path_to_repository&gt; init`命令初始化一个新的CVS仓库。 5. **导入项目**:使用`cvs import`命令将现有项目导入到CVS仓库中。 **CVS基本操作**: 1. **检出(Checkout)**:使用`...

    Reahat_CVS安装配置过程

    - 修改`server_args`指定仓库路径,例如`--allow-root=/cvsroot`,并可以添加多个仓库路径。 - 可以通过`only_from`限制访问IP,不设置或设置为特定网络段允许访问。 - 保存文件后,使用`chmod 644 cvspserver`...

    NAMD_CVS_Source.tar.gz_NAMD

    NAMD_CVS_Source.tar.gz 文件包含了NAMD的源代码,是深入理解其工作原理、进行二次开发或定制化配置的重要资源。这个压缩包的核心在于CUDA编程的应用,CUDA(Compute Unified Device Architecture)是NVIDIA公司推出...

    CAV.rar_cstringarray*_cvs

    本文将详细解析"CAV.rar_cstringarray*_cvs"这一主题,主要关注`CStringArray`类的使用以及如何通过`DivideStr`函数处理分隔符字符串。 `CStringArray`是MFC(Microsoft Foundation Classes)库中的一个关键容器类...

    java_cvs_解析

    Java CVS 解析详解 在软件开发领域,版本控制系统(Version Control System, VCS)是不可或缺的工具,它帮助开发者管理代码的历史版本,协同合作。其中,CVS(Concurrent Versions System)是一个开源的、网络化的...

    cvs server安装与Eclipse简单使用

    4. **版本控制操作**:现在,你可以开始使用CVS的基本操作,如"Add to Version Control"(添加文件到版本库)、"Commit"(提交更改)、"Update"(更新到最新版本)等。 5. **协同工作**:当团队成员对同一文件进行...

    win_cvs 文档

    #### 一、CVS(Concurrent Versions System)简介 CVS 是一种广泛使用的开源版本控制系统,旨在帮助软件开发团队有效地管理代码版本和协同工作。该系统支持以下核心功能: 1. **代码备份**:CVS 作为一个服务器端...

    bsense_CVS+innoCVS.7z

    【bsense_CVS+innoCVS.7z】是一个包含多个组件的压缩包,主要用于 Delphi 开发环境中,提供CVS(Concurrent Versions System)版本控制系统的支持。CVS 是一个广泛使用的开源版本控制系统,它允许开发人员跟踪代码的...

Global site tag (gtag.js) - Google Analytics