rpm和yum軟件包管理,Linux編譯安裝及文本三劍客之sed

1、自建yum倉庫,分別爲網絡源和本地源

  1. 網絡源
    創建基於本地光盤OS yum源 和 基於阿里雲 yum 源 配置文件 base.repo
[root@repo-server ~]# cat /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=file:///misc/cd/
        https://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        https://repo.huaweicloud.com/centos/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[extras]
name=extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        https://repo.huaweicloud.com/centos/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[epel]
name=epel
baseurl=https://mirrors.aliyun.com/epel/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7

[root@repo-server ~]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
 * BaseOS: 
 * extras: mirrors.aliyun.com
BaseOS                                                              | 3.6 kB  00:00:00     
epel                                                                | 4.7 kB  00:00:00     
extras                                                              | 2.9 kB  00:00:00     
(1/6): BaseOS/7/x86_64/group_gz                                     | 153 kB  00:00:00     
(2/6): epel/7/x86_64/group_gz                                       |  95 kB  00:00:00     
(3/6): BaseOS/7/x86_64/primary_db                                   | 6.1 MB  00:00:01     
(4/6): extras/7/x86_64/primary_db                                   | 222 kB  00:00:00     
(5/6): epel/7/x86_64/updateinfo                                     | 1.0 MB  00:00:01     
(6/6): epel/7/x86_64/primary_db                                     | 6.9 MB  00:00:02     
repo id                                        repo name                             status
BaseOS/7/x86_64                                BaseOS                                10,072
epel/7/x86_64                                  epel                                  13,516
extras/7/x86_64                                extras                                   448
repolist: 24,036

[root@repo-server ~]# yum repolist all
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * BaseOS: 
 * extras: mirrors.aliyun.com
repo id                                   repo name                         status
BaseOS/7/x86_64                           BaseOS                            enabled: 10,072
epel/7/x86_64                             epel                              enabled: 13,516
extras/7/x86_64                           extras                            enabled:    448
repolist: 24,036

2.本地源
使用 httpd 搭建服務器端
安裝 httpd


[root@repo-server ~]# yum info httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * BaseOS: 
 * extras: mirrors.aliyun.com
Available Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 95.el7.centos
Size        : 2.7 M
Repo        : BaseOS/7/x86_64
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

[root@repo-server ~]# yum -y install httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * BaseOS: 
 * extras: repo.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-97.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================
 Package         Arch             Version                          Repository         Size
===========================================================================================
Installing:
 httpd           x86_64           2.4.6-97.el7.centos              updates           2.7 M

Transaction Summary
===========================================================================================
Install  1 Package

Total download size: 2.7 M
Installed size: 9.4 M
Downloading packages:
httpd-2.4.6-97.el7.centos.x86_64.rpm                                | 2.7 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : httpd-2.4.6-97.el7.centos.x86_64                                        1/1 
  Verifying  : httpd-2.4.6-97.el7.centos.x86_64                                        1/1 

Installed:
  httpd.x86_64 0:2.4.6-97.el7.centos                                                       

Complete!

把 httpd 設置爲開機啓動

[root@repo-server ~]# systemctl enable --now httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章