yum本地源创建

1 安装yum-utils包,yum-utils可以将需要的包下载在本地,安装后可以使用yumdownloader
 
yum -y install yum-utils*
2 建立目录/yum/yum-custom存放yum包。
 
mkdir -p /yum/yum-custom
mkdir -p /yum/yum-custom/packages
3 安装createrepo
 
yum install yum-utils createrepo yum-plugin-priorities
4 下载相关yum数据包到/yum/yum-custom,并创建本地源
 
yumdownloader --resolve --destdir=/yum/yum-custom/packages httpd
yumdownloader --resolve --destdir=/yum/yum-custom/packages vsftpd
createrepo /yum/yum-custom/
5 建立目录备份原来的yum源。
 
mkdir /yum/yumbackup
mv /etc/yum.repos.d/* /yum/yumbackp/
6 编辑yum源
 
[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]# cat /etc/yum.repos.d/local.repo
[local-base]
name=local-base
baseurl=file:///yum/yum-custom/
gpgcheck=0
enabled=1
7 制作cache
 
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror, priorities
正在清理软件源: local-base
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum repolist
已加载插件:fastestmirror, priorities
Determining fastest mirrors
local-base | 2.9 kB 00:00:00
local-base/primary_db | 7.1 kB 00:00:00
源标识 源名称 状态
local-base local-base 6
repolist: 6
8 安装本地源的数据包
 
[root@localhost yum.repos.d]# yum install -y vsftpd
已加载插件:fastestmirror, priorities
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 vsftpd.x86_64.0.3.0.2-25.el7 将被 安装
--> 解决依赖关系完成
 
依赖关系解决
 
======================================================================================================================================
Package 架构 版本 源 大小
======================================================================================================================================
正在安装:
vsftpd x86_64 3.0.2-25.el7 local-base 171 k
 
事务概要
======================================================================================================================================
安装 1 软件包
 
总下载量:171 k
安装大小:353 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : vsftpd-3.0.2-25.el7.x86_64 1/1
验证中 : vsftpd-3.0.2-25.el7.x86_64 1/1
 
已安装:
vsftpd.x86_64 0:3.0.2-25.el7
 
完毕!
[root@localhost yum.repos.d]# yum install -y wget
已加载插件:fastestmirror, priorities
Loading mirror speeds from cached hostfile
没有可用软件包 wget。
错误:无须任何处理
[root@localhost yum.repos.d]# yum install -y httpd
已加载插件:fastestmirror, priorities
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-90.el7.centos 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-90.el7.centos,它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 apr.x86_64.0.1.4.8-5.el7 将被 安装
---> 软件包 apr-util.x86_64.0.1.5.2-6.el7 将被 安装
---> 软件包 httpd-tools.x86_64.0.2.4.6-90.el7.centos 将被 安装
---> 软件包 mailcap.noarch.0.2.1.41-2.el7 将被 安装
--> 解决依赖关系完成
 
依赖关系解决
 
======================================================================================================================================
Package 架构 版本 源 大小
======================================================================================================================================
正在安装:
httpd x86_64 2.4.6-90.el7.centos local-base 2.7 M
为依赖而安装:
apr x86_64 1.4.8-5.el7 local-base 103 k
apr-util x86_64 1.5.2-6.el7 local-base 92 k
httpd-tools x86_64 2.4.6-90.el7.centos local-base 91 k
mailcap noarch 2.1.41-2.el7 local-base 31 k
 
事务概要
======================================================================================================================================
安装 1 软件包 (+4 依赖软件包)
 
总下载量:3.0 M
安装大小:10 M
Downloading packages:
--------------------------------------------------------------------------------------------------------------------------------------
总计 132 MB/s | 3.0 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : apr-1.4.8-5.el7.x86_64 1/5
正在安装 : apr-util-1.5.2-6.el7.x86_64 2/5
正在安装 : httpd-tools-2.4.6-90.el7.centos.x86_64 3/5
正在安装 : mailcap-2.1.41-2.el7.noarch 4/5
正在安装 : httpd-2.4.6-90.el7.centos.x86_64 5/5
验证中 : apr-1.4.8-5.el7.x86_64 1/5
验证中 : mailcap-2.1.41-2.el7.noarch 2/5
验证中 : httpd-tools-2.4.6-90.el7.centos.x86_64 3/5
验证中 : apr-util-1.5.2-6.el7.x86_64 4/5
验证中 : httpd-2.4.6-90.el7.centos.x86_64 5/5
 
已安装:
httpd.x86_64 0:2.4.6-90.el7.centos
 
作为依赖被安装:
apr.x86_64 0:1.4.8-5.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-90.el7.centos mailcap.noarch 0:2.1.41-2.el7
 
完毕!
9 开启服务并检查服务开启情况
 
[root@localhost yum.repos.d]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:httpd(8)
man:apachectl(8)
[root@localhost yum.repos.d]# systemctl start httpd
[root@localhost yum.repos.d]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since 六 2020-02-01 15:52:27 CST; 1s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 1932 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─1932 /usr/sbin/httpd -DFOREGROUND
├─1933 /usr/sbin/httpd -DFOREGROUND
├─1934 /usr/sbin/httpd -DFOREGROUND
├─1935 /usr/sbin/httpd -DFOREGROUND
├─1936 /usr/sbin/httpd -DFOREGROUND
└─1937 /usr/sbin/httpd -DFOREGROUND
 
2月 01 15:52:27 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
2月 01 15:52:27 localhost.localdomain httpd[1932]: AH00558: httpd: Could not reliably determine the server's fully qualified...essage
2月 01 15:52:27 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost yum.repos.d]# ss -lntp | grep 80
LISTEN 0 128 :::80 :::* users:(("httpd",pid=1937,fd=4),("httpd",pid=1936,fd=4),("httpd",pid=1935,fd=4),("httpd",pid=1934,fd=4),("httpd",pid=1933,fd=4),("httpd",pid=1932,fd=4))


原文地址:https://www.cnblogs.com/cloud-datacenter/p/12248795.html