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


    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

    . 第三方源配置

    在服务器构建的过程中,我们将要用到的一些工具不存在于CentOSyum 的官方库中,所以需要定义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='415.5pt;height:112.5pt'> <v:imagedata src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/10/clip_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
    }

     

    <!-- [if gte vml 1]><v:shape id="_x0000_i1028" type="#_x0000_t75" style='414.75pt;height:206.25pt'> <v:imagedata src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/10/clip_image005.png" o:title=""/> </v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->

    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 查看运行状态

                  <!-- [if gte vml 1]><v:shape id="_x0000_i1029" type="#_x0000_t75" style='387pt;height:227.25pt'> <v:imagedata src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/10/clip_image007.png" o:title=""/> </v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->

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

    <!-- [if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75" style='415.5pt;height:187.5pt'> <v:imagedata src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/10/clip_image009.png" o:title=""/> </v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->

    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 的文件即可。因此,解决方法就是在 /home/wq/ 下。 

  • 相关阅读:
    解决Scala Play框架在Git Bash运行的异常:Could not find configuration file ../framework/sbt/sbt.boot.properties
    Envoy的线程模型[翻译]
    解决Minikube start卡住的方法
    Jade To Pug过程中的一个小问题
    python如何获取变量的变量名
    python数字图像处理(五) 图像的退化和复原
    从1<2<3的语法糖说起
    在CNN上增加一层CAM告诉你CNN到底关注什么
    python数字图像处理(四) 频率域滤波
    windows linux子系统(Windows Subsystem for Linux)的存放目录
  • 原文地址:https://www.cnblogs.com/shakin/p/3714873.html
Copyright © 2020-2023  润新知