返回列表 发帖

CentOS6_Yum仓库

笺注:CentOS6已经停止更新支持,默认Yum源已不能使用,要更换Yum源。


新Yum源文件:
[root@localhost ~]# cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# 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
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://vault.centos.org/6.10/os/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://vault.centos.org/6.10/updates/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://vault.centos.org/6.10/extras/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://vault.centos.org/6.10/centosplus/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=https://vault.centos.org/6.10/contrib/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6



############



[root@localhost ~]# cat /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=0

[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=0



[root@localhost ~]# yum makecache


接着连接公网就可以使用Yum安装软件包了^_^^_^


测试:

[root@localhost ~]# yum -y install wget

[root@localhost ~]# yum -y install httpd*












############
############

Yum-server:(192.168.168.130)

备注:假设已经插上了系统光盘

mkdir -p /mnt/cdrom
mount -t auto /dev/cdrom /mnt/cdrom/

## 以本地光盘作为Yum源
cat << EOF > /etc/yum.repos.d/local.repo
[base]
name=yum-server
baseurl=file:///mnt/cdrom/
enabled=1
gpgcheck=0
EOF

## 重命名原来的Yum源文件,以便使用以本地光盘作为Yum源的文件(Redhat默认没有Yum源文件的)
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bak
mv epel.repo epel.repo.bak

## 清除Yum缓存
yum clean all


使用Yum安装FTP服务:
[root@localhost ~]# yum -y install vsftpd

运行FTP服务:
[root@localhost ~]# service vsftpd start

开机自动运行FTP服务:
[root@localhost ~]# chkconfig --level 35 vsftpd on

关闭防火墙:
[root@localhost ~]# service iptables stop



新建本地文件夹,用以存放软件包
[root@localhost ~]# mkdir -p /var/ftp/yum_base

将光盘的软件包复制到新建的本地文件夹
[root@localhost ~]# cp -rfp /mnt/cdrom/* /var/ftp/yum_base/

复制完成:
[root@localhost ~]# du -sh /var/ftp/yum_base/
3.8G    /var/ftp/yum_base/


## 以本地文件夹作为Yum源
cat << EOF > /etc/yum.repos.d/local.repo
[base]
name=yum-server
baseurl=file:///var/ftp/yum_base/
enabled=1
gpgcheck=0
EOF


## 清除Yum缓存
[root@localhost ~]# yum clean all


至此,可以把光盘去掉了。








############

Yum-client:(192.168.168.131)

备注:无需插上系统光盘了

## 以远程FTP目录作为Yum源
cat >/etc/yum.repos.d/local.repo<< eof
[base]
name=yum-client
baseurl=ftp://192.168.168.130/yum_base/
enabled=1
gpgcheck=0
eof


## 重命名原来的Yum源文件,以便使用以远程FTP目录作为Yum源的文件(Redhat默认没有Yum源文件的)
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bak
mv epel.repo epel.repo.bak

## 清除Yum缓存
yum clean all



测试:

[root@client ~]# yum -y install ftp

[root@client ~]# yum -y install lftp






相关文章:
vsftpd匿名用户
PureFTPd虚拟用户验证

Oracle Linux6.9的安装
最小化安装CentOS7.8
CentOS8_Yum仓库

返回列表