7.6 yum replace domestic source 7.7 yum download rpm package 7.8/7.9 source package installation

7.6 yum replaces domestic source

  • Restore the system default yum source configuration:
    [root@cham3 yum.repos.d]# cd /etc/yum.repos.d
    [root@cham3 yum.repos.d]# ls
    dvd.repo
    [root@cham3 yum.repos.d]# rm -f dvd.repo
    [root@cham3 yum.repos.d]# ls
    [root@cham3 yum.repos.d]# cp ../yum.repos.d.bak/* .
    [root@cham3 yum.repos.d]# ls
    CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
    CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo

     

  • Custom yum source:

[root@cham3 yum.repos.d]# rm -fv CentOS-Bace.repo
先删除默认yum源,然后使用wget命令建立新yum源:
[root@cham3 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-base-163.repo
-bash: wget: 未找到命令
此时wget命令未安装,同时删除了yum源文件,无法安装wget包。
所以用下面的方法:“curl命令”
[root@cham3 yum.repos.d]# curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1572  100  1572    0     0  17686      0 --:--:-- --:--:-- --:--:-- 17662
[root@cham3 yum.repos.d]# ls
CentOS7-base-163.repo  CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS7-Base-163.repo  CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo

[root@cham3 yum.repos.d]# ls
CentOS7-Base-163.repo  CentOS-CR.repo         CentOS-fasttrack.repo  CentOS-Sources.repo
CentOS-Base.repo       CentOS-Debuginfo.repo  CentOS-Media.repo      CentOS-Vault.repo

Note:  After executing the curl command, the original yum source file CentOS-Base.repo is replaced with CentOS7-Base-163.repo. Check out the yum source file:

Its mirror file address is replaced with: "baseurl= http://mirrors.163.com/centos/

Note:  The yum source used in this process needs to be downloaded in advance.

 

7.7 yum download rpm package

Install the extension source epel

Install an extension source file (epel-release):

[root@cham3 yum.repos.d]# yum clean all
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
正在清理软件源: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@cham3 yum.repos.d]# yum install wget
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
base                                                                                             | 3.6 kB  00:00:00     
extras                                                                                           | 3.4 kB  00:00:00     
updates                                                                                          | 3.4 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                                                    | 156 kB  00:00:00     
(2/4): extras/7/x86_64/primary_db                                                                | 129 kB  00:00:00     
(3/4): updates/7/x86_64/primary_db                                                               | 3.6 MB  00:00:03     
(4/4): base/7/x86_64/primary_db                                                                  | 5.7 MB  00:02:45     
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.zju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 wget.x86_64.0.1.14-15.el7_4.1 将被 安装
--> 解决依赖关系完成

依赖关系解决

========================================================================================================================
 Package                 架构                      版本                                源                          大小
========================================================================================================================
正在安装:
 wget                    x86_64                    1.14-15.el7_4.1                     updates                    547 k

事务概要
========================================================================================================================
安装  1 软件包

总下载量:547 k
安装大小:2.0 M
Is this ok [y/d/N]: n
Exiting on user command
您的事务已保存,请执行:
 yum load-transaction /tmp/yum_save_tx.2017-11-13.17-50.OIpKT3.yumtx 重新执行该事务
[root@cham3 yum.repos.d]# ls
CentOS7-Base-163.repo  CentOS-CR.repo         CentOS-fasttrack.repo  CentOS-Sources.repo
CentOS-Base.repo       CentOS-Debuginfo.repo  CentOS-Media.repo      CentOS-Vault.repo
[root@cham3 yum.repos.d]# yum install -y epel-release
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.zju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-9 将被 安装
--> 解决依赖关系完成

依赖关系解决

=======================================================================================================================
 Package                          架构                       版本                     源                          大小
=======================================================================================================================
正在安装:
 epel-release                     noarch                     7-9                      extras                      14 k

事务概要
=======================================================================================================================
安装  1 软件包

总下载量:14 k
安装大小:24 k
Downloading packages:
epel-release-7-9.noarch.rpm                                                                     |  14 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : epel-release-7-9.noarch                                                                            1/1 
  验证中      : epel-release-7-9.noarch                                                                            1/1 

已安装:
  epel-release.noarch 0:7-9                                                                                            

完毕!
[root@cham3 yum.repos.d]# ls
CentOS7-Base-163.repo  CentOS-CR.repo         CentOS-fasttrack.repo  CentOS-Sources.repo  epel.repo
CentOS-Base.repo       CentOS-Debuginfo.repo  CentOS-Media.repo      CentOS-Vault.repo    epel-testing.repo

After the installation is complete, add two files "epel.repo" and "epel-testing.repo" under yum.repos.d/:

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

Added a lot of rpm packages from the epel library.

download rpm package

download

Command: yum install -y [package name] --downloadonly

[root@cham3 yum.repos.d]# yum install zsh --downloadonly
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirror01.idc.hinet.net
 * extras: mirrors.aliyun.com
 * updates: mirrors.zju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 zsh.x86_64.0.5.0.2-28.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=======================================================================================================================
 Package                 架构                       版本                                源                        大小
=======================================================================================================================
正在安装:
 zsh                     x86_64                     5.0.2-28.el7                        base                     2.4 M

事务概要
=======================================================================================================================
安装  1 软件包

总下载量:2.4 M
安装大小:5.6 M
Background downloading packages, then exiting:
zsh-5.0.2-28.el7.x86_64.rpm                                                                     | 2.4 MB  00:00:01     
exiting because "Download Only" specified
[root@cham3 yum.repos.d]# rpm -q zsh
未安装软件包 zsh 

That is, the meaning of this command is to only download but not install.
The default save location of the downloaded package is:

[root@cham3 yum.repos.d]# ls /var/cache/yum/x86_64/7/updates/packages
zsh-5.0.2-25.el7_3.1.x86_64.rpm

Custom download directory

Command: yum install -y [package name] --downloadonly --downloaddir=/tmp/ (custom directory)

[root@cham3 yum.repos.d]# yum install zsh --downloadonly --downloaddir=/tmp/
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirror01.idc.hinet.net
 * extras: mirrors.aliyun.com
 * updates: mirrors.zju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 zsh.x86_64.0.5.0.2-28.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=======================================================================================================================
 Package                 架构                       版本                                源                        大小
=======================================================================================================================
正在安装:
 zsh                     x86_64                     5.0.2-28.el7                        base                     2.4 M

事务概要
=======================================================================================================================
安装  1 软件包

总下载量:2.4 M
安装大小:5.6 M
Background downloading packages, then exiting:
exiting because "Download Only" specified
[root@cham3 yum.repos.d]# ls /tmp/
1.txt      ping
1.txt.bz2  systemd-private-5e7aac884de0454ba5ebd5bd9d00d313-vmtoolsd.service-uIAz6R
1.txt.gz   systemd-private-8ec0e8c254d142359576e2a0e2bfe61a-vmtoolsd.service-LyBTUz
1.txt.xz   systemd-private-a02183c10a59447b842c913b6dc422af-vmtoolsd.service-rIsyod
88.txt     yum_save_tx.2017-11-13.17-33.m0bd_Z.yumtx
cham       yum_save_tx.2017-11-13.17-43.dn3y8u.yumtx

Note:  The system will not perform any operation when the next package has been installed. At this time, you can use "reinstall" to download the package.

Download an already installed package:

[root@cham3 yum.repos.d]# yum reinstall -y vim-enhanced  --downloadonly --downloaddir=/tmp/
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirror01.idc.hinet.net
 * extras: mirrors.aliyun.com
 * updates: mirrors.zju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.160-2.el7 将被 已重新安装
--> 解决依赖关系完成

依赖关系解决

=======================================================================================================================
 Package                       架构                    版本                                源                     大小
=======================================================================================================================
重新安装:
 vim-enhanced                  x86_64                  2:7.4.160-2.el7                     base                  1.0 M

事务概要
=======================================================================================================================
重新安装  1 软件包

总下载量:1.0 M
安装大小:2.2 M
Background downloading packages, then exiting:
vim-enhanced-7.4.160-2.el7.x86_64.rpm                                                           | 1.0 MB  00:00:00     
exiting because "Download Only" specified
[root@cham3 yum.repos.d]# ls /tmp/
1.txt      systemd-private-5e7aac884de0454ba5ebd5bd9d00d313-vmtoolsd.service-uIAz6R
1.txt.bz2  systemd-private-8ec0e8c254d142359576e2a0e2bfe61a-vmtoolsd.service-LyBTUz
1.txt.gz   systemd-private-a02183c10a59447b842c913b6dc422af-vmtoolsd.service-rIsyod
1.txt.xz   vim-enhanced-7.4.160-2.el7.x86_64.rpm
88.txt     yum_save_tx.2017-11-13.17-33.m0bd_Z.yumtx
cham       yum_save_tx.2017-11-13.17-43.dn3y8u.yumtx
cham1      yum_save_tx.2017-11-13.17-50.OIpKT3.yumtx
chamlinux  yum_save_tx.2017-11-13.20-17.M797gr.yumtx
ch.log     yum_save_tx.2017-11-13.20-28.vE5oCa.yumtx
d6z        yum_save_tx.2017-11-13.20-31.IAN7EJ.yumtx
ping       zsh-5.0.2-28.el7.x86_64.rpm

7.8-7.9 Source package installation

Download a source package first!
Note:  In the future, all source code packages will be placed in the directory "/usr/local/src/"! ! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

[root@cham3 src]#  wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.32.tar.gz  
下载Apache!该地址来自于“阿铭码市”。
下载完后解压该文件:
[root@cham3 src]#  tar zxvf httpd-2.2.32.tar.gz
[root@cham3 src]# ls
httpd-2.2.32  httpd-2.2.32.tar.gz
查看文件httpd-2.2.32的内容:
[root@cham3 src]# cd httpd-2.2.34
[root@cham3 httpd-2.2.34]# ls
ABOUT_APACHE  BuildBin.dsp   configure.in  httpd.mak       LAYOUT        Makefile.in    os                server
acinclude.m4  buildconf      docs          httpd.spec      libhttpd.dep  Makefile.win   README            srclib
Apache.dsw    CHANGES        emacs-style   include         libhttpd.dsp  modules        README.platforms  support
build         config.layout  httpd.dep     INSTALL         libhttpd.mak  NOTICE         README-win32.txt  test
BuildAll.dsp  configure      httpd.dsp     InstallBin.dsp  LICENSE       NWGNUmakefile  ROADMAP           VERSIONING

 Install Apache:

[root@cham3 httpd-2.2.34]# 
 ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
……
checking for chosen layout... apr
checking for gcc... no
checking for cc... no

当某命令运行结束后,使用"echo $?"检验其是否正确:

[root@cham3 httpd-2.2.34]#  echo $?
1
当该值为0时表示上一条命令正确,如果值为1则错误。
此处值为1,即上面命令错误,查看其安装过程发现“checking for gcc... no”——表示“gcc”编译器不存在,所以需要先安装gcc编译器:
[root@cham3 httpd-2.2.34]#  yum install -y gcc
…………
完毕!
[root@cham3 httpd-2.2.34]# ./configure --prefix=/usr/local/apache2
再次安装。
[root@cham3 httpd-2.2.34]# echo $?
0
检测,正确。
[root@cham3 httpd-2.2.34]# make   编译!
……
[root@cham3 httpd-2.2.34]# echo $?
0

[root@cham3 httpd-2.2.34]# make install
……
[root@cham3 httpd-2.2.34]# echo $?
0
每次命令执行完后用“echo $?”进行检测,确保其正确。
安装完成!
查看其安装目录的内容:
[root@cham3 httpd-2.2.34]# ls /usr/local/apache2/
bin  build  cgi-bin  conf  error  htdocs  icons  include  lib  logs  man  manual  modules

Note:  To download the source package, go to the official website or a trusted site - safe!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325334067&siteId=291194637