CENTOS7 配置本地yum源

captains 2021-07-26 AM 1077℃ 0条

yum.jpg

centos7 配置本机yum源

概述

  • 本地文件的rpm配置yum源

1. 上传rpm文件到服务器任意目录

# 上传所需的rpm文件到服务器该目录下
$ /home/server/repo_package

2. 生成repodata

# 在上传目录下执行createrepo .
$ pwd
/home/server/repo_package
$ createrepo .
Spawning worker 0 with 4 pkgs
Spawning worker 1 with 3 pkgs
Spawning worker 2 with 3 pkgs
Spawning worker 3 with 3 pkgs
Spawning worker 4 with 3 pkgs
Spawning worker 5 with 3 pkgs
Spawning worker 6 with 3 pkgs
Spawning worker 7 with 3 pkgs
Spawning worker 8 with 3 pkgs
Spawning worker 9 with 3 pkgs
Spawning worker 10 with 3 pkgs
Spawning worker 11 with 3 pkgs
Spawning worker 12 with 3 pkgs
Spawning worker 13 with 3 pkgs
Spawning worker 14 with 3 pkgs
Spawning worker 15 with 3 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

3.配置yum源

$ cd /etc/yum.repos.d/
$ mkdir bk
$ mv *.repo bk
$ vim local.repo
[local_repo]
name=local-repo
baseurl=file:///home/server/repo_package
gpgcheck=0
enabled=1

4.验证

$ yum clean all && yum repolist
标签: LINUX

非特殊说明,本博所有文章均为博主原创。

评论啦~