`
sillycat
  • 浏览: 2485531 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Linux Server Deployment(I)cvs and iptables

阅读更多
Linux Server Deployment(I)cvs and iptables

1. prepare the users and groups
>add user luohua
>passwd luohua
>vi /etc/passwd
change the id and group to 0
luohua:x:0:0::/home/luohua:/bin/bash

it is not a good way to do so. So I change the right.

>groupadd groupname
>usermod -g groupname luohua

check the user group
>groups luohua

change the relations of the directory to one person
>chown luohua:groupname software -R
>chown luohua:groupname tmp -R
>chown luohua:groupname tools -R

change the relations of the directory to a group
>chgrp -R groupname software
>chgrp -R groupname tmp
>chgrp -R groupname tools

chang the rights of the directory, make all group member xwr
>chmod -R g+xwr software
>chmod -R g+xwr tmp
>chmod -R g+xwr tools

-R directories and its sub directories
g   members in the same group
x   execute
r    read
w   write

2. Install cvs in our system
verify that we have installed cvs already
>rpm -q cvs
cvs-1.11.17-11.e14

find the install location of the bin file
>which cvs
/usr/bin/cvs

we can download the software from here http://www.cvshome.org/

create the cvs group and user
>groupadd cvs
>adduser cvsroot
>passwd cvsroot
>usermod -g cvs cvsroot

create the cvsroot
>mkdir /opt/cvsroot
>chown cvsroot.cvs /opt/cvsroot
>chmod -R g+xwr cvsroot

initial CVS
>su cvsroot
>cvs -d /opt/cvsroot init

return to the last user root
>exit

modify the enrionment
>vi /etc/profile
CVSROOT=/opt/cvsroot
export CVSROOT

>. /etc/profile

start the cvs server
>vi /etc/xinetd.d/cvspserver
# default: on
# description: The cvs server sessions;
service cvspserver
{
port              = 2401
socket_type = stream
protocol        = tcp
wait              = no
user              = root
passenv        = PATH
server           = /usr/bin/cvs
server_args  = -f --allow-root=/opt/cvsroot pserver
disable          = no
}

check all the configuration
>man xinetd.conf

>chmod 644 cvspserver
>/etc/rc.d/init.d/xinetd restart

check the server is running
>netstat -lnp|grep 2401
>netstat -l |grep cvspserver

3. Manage the CVS
create files passwd, readers, writers
>cd /opt/cvsroot/CVSROOT
>vi passwd
luohua:xxxxxx:cvsroot

create the password
>vi /opt/cvsroot/passwdgen.pl
#!/usr/bin/perl
srand (time());
my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
my $plaintext = shift;
my $crypttext = crypt ($plaintext, $salt);
print "${crypttext}\n";

>chmod 777 passwdgen.pl
>./passwdgen.pl "mypasswod"

insert my username in readers and writers
>vi readers
>vi writers

add the user luohua, for example, to the cvs group
>usermod -g cvs luohua

4. cvs client command
login and use the system
>export CVSROOT=:pserver:username@ip:/cvspath
>cvs login

import the project
>cvs import -m "comments" -ko path1/path2/project_name vendor_tag release_tag

check out the project
>cvs checkout path1/project_name

5. Problem shooting
my iptables is running.
>/etc/init.d/iptables status
>vi /etc/sysconfig/iptables
add one line to the configuration

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2401 -j ACCEPT

error message:
cvs [server aborted]: "import" requires write access to the repository

solution:
if the user name is in writers, remove it in readers

references:
http://www.linux520.net/file/2010091436.html
http://hi.baidu.com/luohuazju/blog/item/c94690e92887813ab80e2d86.html

http://www.cnblogs.com/markjiao/archive/2005/09/20/240190.aspx
http://blog.csdn.net/leonpard/archive/2005/01/22/264247.aspx

http://bbs.scmlife.com/thread-1767-1-1.html









分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics