欢迎来到CentOS问吧,从这里您能进入CentOS世界!

CentOS问吧

当前位置: 主页 > CentOS服务器 > 目录服务器 >

CentOS 5.3配置软件源以及CVS服务器

时间:2011-07-08 14:24来源:未知 作者:admin 点击:
1 、安装完 CentOS 5.3 之后,首先要保证可以上网,安装完 SSH ,并且打开。 2 、设置软件源 1 )、 CentOS 的网络源配置文件是: /etc/yum.repos.d/ 下的 CentOS-Base.repo 本文提供其 5.3 版本的:网

1 、安装完 CentOS 5.3 之后,首先要保证可以上网,安装完 SSH ,并且打开。

2 、设置软件源

1 )、 CentOS 的网络源配置文件是:

/etc/yum.repos.d/ 下的 CentOS-Base.repo

本文提供其 5.3 版本的:网通,电信,第三方,163 源各一个

 

配置方法一般是:

① . 进入到repos.d 目录

$ cd /etc/yum.repos.d
$ ls -l
总计 24
-rw-r--r-- 1 root root  802 2009-09-02 CentOS-Base.repo
-rw-r--r-- 1 root root  626 03-17 09:30 CentOS-Media.repo

② . 备份原来的源

$ mv CentOS-Base.repo CentOS-Base.repo.backup

③ . 用下面的内容,重新生成CentOS-Base.repo

④ .$ yum update

2 )、广泛应用的 CentOS 的软件源

① . 国内某大学源(电信网通皆可使用)

[base]
name=CentOS-5 – Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5.3/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos6

#released updates
[update]
name=CentOS-5 – Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5.3/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#packages used/produced in the build but not released
[addons]
name=CentOS-5 – Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons

baseurl=http://ftp.sjtu.edu.cn/centos/5.3/addons/$basearch/

② . 国内电信源

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever – Base
baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever – Updates
baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever – Addons
baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever – Extras
baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever – Plus
baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

③ . 第三方源配置

在服务器构建的过程中,我们将要用到的一些工具不存在于CentOS 中yum 的官方库中,所以需要定义yum 的非官方库文件,让一些必需的工具通过yum 也能够安装。

 

[root@bestcar ~]# vi /etc/yum.repos.d/dag.repo ← 建立dag.repo ,定义非官方库,内容如下5 行:

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

[root@bestcar ~]# rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt ← 导入非官方库的GPG

或者有下面这种方式
# 设置rpmforge 源
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*

 

④ .163 的源也还不错,网易网聚人的力量,确实是我们的好朋友

# 添加163 源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.save
mv /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo.save
cp /etc/yum.repos.d/CentOS-Base.repo.save /etc/yum.repos.d/163.repo
sed -i "s/mirror.centos.org/mirrors.163.com/g" /etc/yum.repos.d/163.repo
sed -i "s/^mirrorlist/#mirrorlist/g" /etc/yum.repos.d/163.repo
sed -i "s/^#baseurl/baseurl/g" /etc/yum.repos.d/163.repo

3 )、问题

       在配置过程中,有可能会出现

GPG key retrieval failed: [Errno 14] HTTP Error 404: Not Found

这个问题,这时只要修改 repo 使所有的 gpgcheck=0 就可以了。

3 、安装版本服务器 ---CVS

1 )、检查 CVS 软件默认是否安装好了。

       通过使用 rpm –qi cvs 来查看

2 )、如果没有安装,那么就需要安装

软件管理器 yum 的安装方式

              yum install cvs

3) 、 创建用户和用户组

root 用户下执行以下命令:
#adduser cvsbestcar

#passwd cvsbestcar  输入新密码

这里创建了 bestcar 这个用户,同时创建了 bestcar 这个用户组。

4 )、 创建 CVS 资源库的根目录

root 用户下执行:
#mkdir /bestcar  此处可改为你想要的 cvsroot 路径
#chown cvsbestcar.cvsbestcar  /bestcar 把 cvs 根目录的所属用户设置为 cvsbestcar ,所属组设为 cvsbestcar 。

5) 、 初始化 cvs 资源库

       #su – cvsbestcar  切换到 cvsbestcar 这个用户

#cvs -d /bestcar init

在 / bestcar 目录下会生成 CVSROOT 这个子目录

<!-- [if gte vml 1]><v:shape id="_x0000_i1027" type="#_x0000_t75" style=\'width:415.5pt;height:112.5pt\'> <v:imagedata src="file:///C:DOCUME~1ADMINI~1LOCALS~1Tempmsohtml110clip_image003.png" o:title=""/> </v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->

6) 、 修改环境变量 CVSROOT

#exit  

从 cvsbestcar 用户退回到 root 用户,只有 root 用户才有权限修改 /etc/profile

#vim /etc/profile

编辑 /etc/profile 文件,在末尾加上以下两句:

CVSROOT=/cvsroot

export CVSROOT

#source  /etc/profile

更新环境变量,此时系统已经认识 $CVSROOT 这样的环境变量

#echo $CVSROOT

检查是否设置成功,如果出现自己设置的路径,表示成功。

7 )、修改服务器配置

       在 /etc/xinetd.d/ 下找到 cvs 文件,修改成下面这样

service cvspserver

{

port                    = 2401
        socket_type             = stream
        protocol                = tcp
        wait                    = no
        user                    = root
        passenv                 = PATH
        server                  = /usr/bin/cvs
        env                     = HOME=/bestcar
        server_args             = -f --allow-root=/bestcar pserver
     # bind                    = 127.0.0.1
}

8 )、 启动 cvs 服务

# /etc/rc.d/init.d/xinetd restart 重启动 xinetd 服务,需要注意,这个服务 centos5 默认并不安装,需要定制安装一下。

# netstat -lnp|grep 2401

tcp 0 0 0.0.0.0:2401 0.0.0.0:* LISTEN xxxxxx/xinetd

则说明 cvs 服务器已经运行。

PS. 如果发现没有输出,那么就证明配置有问题,可通过如下方式:

    ① . 将第七步里面的disable=yes 更改成disable=no

    ② . #/etc/rc.d/init.d/xinetd restart

    ③ . 通过 chkconfig --list 查看运行状态

④ . 通过进程是看不到的,因为你的是通过 xinitd 来运行   ,也就是只有当客户端连接这个端口时 cvs 才会启动,所以通常是通过 netstat -an | less 来查看端口的状态的。

9 )、 注意要打开防火墙的 2401 端口,否则客户端还是连不上这个cvs 的服务器。

10 )、 增加新用户。

用 root

#cd /

#chmod -R 775 cvsroot  让 cvsroot 组的所有成员都可以对 cvs 资源库目录的读写权限

#useradd -g cvsroot user0   创建新用户 user0 ,并且将其添加进入 cvsroot 用户组

#passwd user0    设置好密码

11 )、客户端连接

       在客户端安装 CVS ,服务器端的 IP 为: 192.168.12.241 ,然后在客户端输入

       cvs -d :pserver:user0@192.168.12.241/bestcar login

    ① . 错误提示为/bestcar /CVSROOT/config: Permission denied

           自己本身的用户 user0 已经加入到组中,并且组对 /bestcar 文件可读可写

    ② . 错误提示为:

cvs login: CVS password file /home/wq/.cvspass does not exist - creating a new file

该问题就是在客户端登录时要在 HOME 目录下有个 .cvspass 的文件即可。

(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
验证码: 点击我更换图片
栏目列表
推荐内容