Linux Server Deployment(I)cvs and iptables

ourtimes 2011-06-08

LinuxServerDeployment(I)cvsandiptables

1.preparetheusersandgroups

>adduserluohua

>passwdluohua

>vi/etc/passwd

changetheidandgroupto0

luohua:x:0:0::/home/luohua:/bin/bash

itisnotagoodwaytodoso.SoIchangetheright.

>groupaddgroupname

>usermod-ggroupnameluohua

checktheusergroup

>groupsluohua

changetherelationsofthedirectorytooneperson

>chownluohua:groupnamesoftware-R

>chownluohua:groupnametmp-R

>chownluohua:groupnametools-R

changetherelationsofthedirectorytoagroup

>chgrp-Rgroupnamesoftware

>chgrp-Rgroupnametmp

>chgrp-Rgroupnametools

changtherightsofthedirectory,makeallgroupmemberxwr

>chmod-Rg+xwrsoftware

>chmod-Rg+xwrtmp

>chmod-Rg+xwrtools

-Rdirectoriesanditssubdirectories

gmembersinthesamegroup

xexecute

rread

wwrite

2.Installcvsinoursystem

verifythatwehaveinstalledcvsalready

>rpm-qcvs

cvs-1.11.17-11.e14

findtheinstalllocationofthebinfile

>whichcvs

/usr/bin/cvs

wecandownloadthesoftwarefromherehttp://www.cvshome.org/

createthecvsgroupanduser

>groupaddcvs

>addusercvsroot

>passwdcvsroot

>usermod-gcvscvsroot

createthecvsroot

>mkdir/opt/cvsroot

>chowncvsroot.cvs/opt/cvsroot

>chmod-Rg+xwrcvsroot

initialCVS

>sucvsroot

>cvs-d/opt/cvsrootinit

returntothelastuserroot

>exit

modifytheenrionment

>vi/etc/profile

CVSROOT=/opt/cvsroot

exportCVSROOT

>./etc/profile

startthecvsserver

>vi/etc/xinetd.d/cvspserver

#default:on

#description:Thecvsserversessions;

servicecvspserver

{

port=2401

socket_type=stream

protocol=tcp

wait=no

user=root

passenv=PATH

server=/usr/bin/cvs

server_args=-f--allow-root=/opt/cvsrootpserver

disable=no

}

checkalltheconfiguration

>manxinetd.conf

>chmod644cvspserver

>/etc/rc.d/init.d/xinetdrestart

checktheserverisrunning

>netstat-lnp|grep2401

>netstat-l|grepcvspserver

3.ManagetheCVS

createfilespasswd,readers,writers

>cd/opt/cvsroot/CVSROOT

>vipasswd

luohua:xxxxxx:cvsroot

createthepassword

>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";

>chmod777passwdgen.pl

>./passwdgen.pl"mypasswod"

insertmyusernameinreadersandwriters

>vireaders

>viwriters

addtheuserluohua,forexample,tothecvsgroup

>usermod-gcvsluohua

4.cvsclientcommand

loginandusethesystem

>exportCVSROOT=:pserver:username@ip:/cvspath

>cvslogin

importtheproject

>cvsimport-m"comments"-kopath1/path2/project_namevendor_tagrelease_tag

checkouttheproject

>cvscheckoutpath1/project_name

5.Problemshooting

myiptablesisrunning.

>/etc/init.d/iptablesstatus

>vi/etc/sysconfig/iptables

addonelinetotheconfiguration

-ARH-Firewall-1-INPUT-mstate--stateNEW-mtcp-ptcp--dport2401-jACCEPT

errormessage:

cvs[serveraborted]:"import"requireswriteaccesstotherepository

solution:

iftheusernameisinwriters,removeitinreaders

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

相关推荐

xylin / 0评论 2014-03-26