Chủ Nhật, 8 tháng 2, 2009

Install CVS + SSH on Ubuntu

1. Installation
Install CVS server:
$ sudo apt-get install cvsd
When prompted in the cvsd installation process for Repository, type in “/cvsroot”.

2. Configuration
goto /var/lib/cvsd and build the cvsroot:
$ sudo cvsd-buildroot /var/lib/cvsd
create the folder cvsroot:
$ sudo mkdir cvsroot
and then initilize the repository
$ sudo cvs -d /var/lib/cvsd/cvsroot init
$ sudo chown -R cvsd:cvsd cvsroot


3. Add user and password:
$ sudo cvsd-passwd /var/lib/cvsd/cvsroot +YOUR_USER_HERE
(Repeat this line for each user)
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
# vi /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.
and then change the AUTH type:
$ sudo vi /var/lib/cvsd/cvsroot/CVSROOT/config
uncomment the “SystemAuth=no” line.

4.Test it
On client side, install cvs
$ sudo apt-get install cvs and run
$ cvs -d :pserver:YOUR_USER_HERE@YOUR_HOST_NAME:/cvsroot login
$ cvs -d :pserver:YOUR_USER_HERE@YOUR_HOST_NAME:/cvsroot checkout.

If Windows client side, just download cvs.exe to use.

5. SSH Mode
Install: $ sudo apt-get install openssh-server
# chmod -R 775 /var/lib/cvsd/cvsroot
# useradd USERNAME (create system user on server)
# gpasswd -a USERNAME cvsd (grant the user by adding him to the cvsd group)

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/cvsroot; export CVSROOT
Test: cvs rls

6. SSH without password prompt
On client side, generate DSA key pair:
$ ssh-keygen -t dsa
Setting up passphrase access:
$ scp ~/.ssh/id_dsa.pub YOUR_USER_HERE@YOUR_HOST_NAME:.
$ ssh -l YOUR_USER_HERE -L 2401:localhost:2401 YOUR_HOST_NAME
% mkdir ~/.ssh
% chmod 700 ~/.ssh
% cat ~/id_dsa.pub >> ~/.ssh/authorized_keys2
% rm ~/id_dsa.pub
% chmod 600 ~/.ssh/*
% exit

(You can also send the .pub file to your CVS Server's administrator to config)
Now test this by enter:
ssh YOUR_USER_HERE@YOUR_HOST_NAME
If now you are logged in to the to the CVS machine without entering the password then everything's Ok.
NOTE: If the client side using Windows, please use puttygen to generate the key pair.
Check here for using PuTTY and SSH + JDev: http://www.oracle.com/technology/products/jdev/howtos/other/jdev10g_cvs_putty.html

Không có nhận xét nào:

Đăng nhận xét