日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

五周第二次课

發布時間:2025/4/5 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 五周第二次课 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業重金招聘Python工程師標準>>>

7.6 yum更換國內源
7.7 yum下載rpm包
7.8/7.9 源碼包安裝

7.6 yum更換國內源

更換yum倉庫源

有時候我們自帶的yum倉庫或者yum源不太好用,因為本身自帶的源網址資源是國外的,下載的rpm包很慢,那就很是影響我們的效率。這時候我們可以更改一下我們國內的源,像163的就很快。首先將之前備份的文件恢復,將dvd刪除,將之前拷貝的文件拷貝回來,將最核心的CentOS-Base.repo刪除。

[root@centos7 ~]# cd /etc/yum.repos.d
[root@centos7 yum.repos.d]# ls

dvd.repo
[root@centos7 yum.repos.d]# rm -f dvd.repo
[root@centos7 yum.repos.d]# cp ../yum.repos.d.bak/* .
[root@centos7 yum.repos.d]# ls

CentOS-Base.repo ?CentOS-CR.repo ?CentOS-Debuginfo.repo ?CentOS-fasttrack.repo ?CentOS-Media.repo ?CentOS-Sources.repo ?CentOS-Vault.repo
[root@centos7 yum.repos.d]# rm -f CentOS-Base.repo
[root@centos7 yum.repos.d]#?

改一個國內的163的源,去下載一個wget http://mirrors.163.com/.help/CentOS7-Base-163.repo,但是發現沒有wget命令,yum也不能安裝,因為剛才CentOS-Base.repo已經被刪了。

[root@centos7 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
-bash: wget: 未找到命令
[root@centos7 yum.repos.d]#?

此時可以借助curl命令,然后發現CentOS7-Base-163.repo已下載。

[root@centos7 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
? 0 ? ? 0 ? ?0 ? ? 0 ? ?0 ? ? 0 ? ? ?0 ? ? ?0 --:--:-- --:--: ?0 ? ? 0 ? ?0 ? ? 0 ? ?0 ? ? 0 ? ? ?0 ? ? ?0 --:--:-- --:--:100 ?1572 ?100 ?1572 ? ?0 ? ? 0 ? 6031 ? ? ?0 --:--:-- --:--:-- --:--:-- ?6022
[root@centos7 yum.repos.d]# ls
CentOS7-Base-163.repo ?CentOS-Media.repo
CentOS-CR.repo ? ? ? ? CentOS-Sources.repo
CentOS-Debuginfo.repo ?CentOS-Vault.repo
CentOS-fasttrack.repo
[root@centos7 yum.repos.d]#?

打開CentOS7-Base-163.repo看一下內容。

[root@centos7 yum.repos.d]# vim CentOS7-Base-163.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 - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/? #它的url
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1

然后再yum list看一下,會發現有base倉庫。

[root@centos7 yum.repos.d]# yum list

zlib.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1.2.7-17.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? base ? ??
zlib-devel.i686 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1.2.7-17.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? base ? ??
zlib-devel.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1.2.7-17.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? base ? ??
zlib-static.i686 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1.2.7-17.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? base ? ??
zlib-static.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1.2.7-17.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? base ? ??
zsh.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 5.0.2-28.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? base ? ??
zsh-html.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?5.0.2-28.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? base ? ??
zziplib.i686 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0.13.62-5.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?base ? ??
zziplib.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0.13.62-5.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?base ? ??
zziplib-devel.i686 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0.13.62-5.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?base ? ??
zziplib-devel.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0.13.62-5.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?base ? ??
zziplib-utils.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0.13.62-5.el7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?base ? ??
[root@centos7 yum.repos.d]#?

現在安裝一個軟件,安裝OK。沒有問題,此時已經更換了國內的yum源。

[root@centos7 yum.repos.d]# yum install -y wget
已加載插件:fastestmirror
base ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| 3.6 kB ?00:00:00 ? ??
extras ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| 3.4 kB ?00:00:00 ? ??
updates ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | 3.4 kB ?00:00:00 ? ??
Loading mirror speeds from cached hostfile
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 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
Downloading packages:
wget-1.14-15.el7_4.1.x86_64.rpm ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | 547 kB ?00:00:01 ? ??
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
? 正在安裝 ? ?: wget-1.14-15.el7_4.1.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1/1?
? 驗證中 ? ? ?: wget-1.14-15.el7_4.1.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1/1?

已安裝:
? wget.x86_64 0:1.14-15.el7_4.1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

完畢!
[root@centos7 yum.repos.d]#?

如果懷疑這個不是163的源,可以改一下名字,然后再清除一下緩存。

[root@centos7 yum.repos.d]# mv CentOS7-Base-163.repo CentOS7-Base-163.repo.123
[root@centos7 yum.repos.d]# yum clean all

已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
沒有已啟用的源。
執行 "yum repolist all" 查看您擁有的源。
您可以用 yum-config-manager --enable <源名> 來啟用源
[root@centos7 yum.repos.d]#?

現在發現沒法安裝什么東西了。

[root@centos7 yum.repos.d]# yum install zsh
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
沒有已啟用的源。
執行 "yum repolist all" 查看您擁有的源。
您可以用 yum-config-manager --enable <源名> 來啟用源
[root@centos7 yum.repos.d]#?

所以,現在需要把163的源恢復過來。

[root@centos7 yum.repos.d]# mv CentOS7-Base-163.repo.123 CentOS7-Base-163.repo
[root@centos7 yum.repos.d]# ls

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

此時用命令yum repolist all,可以看到163的源是可以用的,然后再清除緩存。

[root@centos7 yum.repos.d]# yum repolist all
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
源標識 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?源名稱 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?狀態
C7.0.1406-base/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7.0.1406 - Base ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
C7.0.1406-centosplus/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7.0.1406 - CentOSPlus ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
C7.0.1406-extras/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7.0.1406 - Extras ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
C7.0.1406-fasttrack/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CentOS-7.0.1406 - CentOSPlus ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
C7.0.1406-updates/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CentOS-7.0.1406 - Updates ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 禁用
C7.1.1503-base/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7.1.1503 - Base ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
C7.1.1503-centosplus/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7.1.1503 - CentOSPlus ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
C7.1.1503-extras/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7.1.1503 - Extras ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
C7.1.1503-fasttrack/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CentOS-7.1.1503 - CentOSPlus ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
C7.1.1503-updates/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CentOS-7.1.1503 - Updates ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 禁用
base/7/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7 - Base - 163.com ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 啟用: 9,591
base-debuginfo/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7 - Debuginfo ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
base-source/7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7 - Base Sources ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 禁用
c7-media ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CentOS-7 - Media ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
centosplus/7/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7 - Plus - 163.com ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 禁用
centosplus-source/7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7 - Plus Sources ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 禁用
cr/7/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7 - cr ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 禁用
extras/7/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7 - Extras - 163.com ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 啟用: ? 327
extras-source/7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CentOS-7 - Extras Sources ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 禁用
fasttrack/7/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CentOS-7 - fasttrack ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
updates/7/x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CentOS-7 - Updates - 163.com ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?啟用: 1,540
updates-source/7 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CentOS-7 - Updates Sources ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?禁用
repolist: 11,458
[root@centos7 yum.repos.d]# yum clean all
已加載插件:fastestmirror
正在清理軟件源: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@centos7 yum.repos.d]#?

更換yum源其實很容易理解,就是把原來的源改名字也好,刪除也好,然后去下載163的源。
7.7 yum下載rpm包

安裝擴展源epel

? yum install -y epel-release

? yum list |grep epel

光一個163的base是不夠用的,有時候很多的rpm包這個源里面是沒有的。有一些很重要的東西,自帶的源里面沒有,這時候需要安裝擴展源epel。

直接安裝即可,就是安裝了一個文件。

[root@centos7 yum.repos.d]# yum install -y epel-release
已加載插件:fastestmirror
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 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | 145 kB ?00:00:00 ? ??
(3/4): updates/7/x86_64/primary_db ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| 4.5 MB ?00:00:04 ? ??
(4/4): base/7/x86_64/primary_db ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | 5.7 MB ?00:00:05 ? ??
Determining fastest mirrors
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 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@centos7 yum.repos.d]# ls
CentOS7-Base-163.repo ?CentOS-Debuginfo.repo ?CentOS-Media.repo ? ?CentOS-Vault.repo

?epel-testing.repo
CentOS-CR.repo ? ? ? ? CentOS-fasttrack.repo ?CentOS-Sources.repo ?epel.repo
[root@centos7 yum.repos.d]#?

此時會發現多了2個文件,epel.repo是最核心的,可以cat一下內容。

[root@centos7 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

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

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

epel也是官方提供的,和fedora相關,裝了這個源以后,再yum list一次,會有更多包出來。

yum list里面會有很多包,這樣看的不是很清楚,可以使用管道符grep一下。

使用命令:yum list | grep epel

[root@centos7 yum.repos.d]# yum list | grep epel

zinnia-devel.x86_64 ? ? ? ? ? ? ? ? ? ? ?0.06-22.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zinnia-doc.noarch ? ? ? ? ? ? ? ? ? ? ? ?0.06-22.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zinnia-perl.x86_64 ? ? ? ? ? ? ? ? ? ? ? 0.06-22.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zinnia-python.x86_64 ? ? ? ? ? ? ? ? ? ? 0.06-22.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zinnia-tomoe-ja.x86_64 ? ? ? ? ? ? ? ? ? 0.06-22.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zinnia-tomoe-zh_CN.x86_64 ? ? ? ? ? ? ? ?0.06-22.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zinnia-utils.x86_64 ? ? ? ? ? ? ? ? ? ? ?0.06-22.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zipios++.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ?0.1.5.9-9.el7 ? ? ? ? ? ? ? ? epel ? ??
zipios++-devel.x86_64 ? ? ? ? ? ? ? ? ? ?0.1.5.9-9.el7 ? ? ? ? ? ? ? ? epel ? ??
zlib-ada.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ?1.4-0.5.20120830CVS.el7 ? ? ? epel ? ??
zlib-ada-devel.x86_64 ? ? ? ? ? ? ? ? ? ?1.4-0.5.20120830CVS.el7 ? ? ? epel ? ??
zmap.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2.1.1-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
znc.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1.6.5-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
znc-devel.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? 1.6.5-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
znc-modperl.x86_64 ? ? ? ? ? ? ? ? ? ? ? 1.6.5-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
znc-modpython.x86_64 ? ? ? ? ? ? ? ? ? ? 1.6.5-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
znc-modtcl.x86_64 ? ? ? ? ? ? ? ? ? ? ? ?1.6.5-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zopfli.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ?1.0.1-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zsh-lovers.noarch ? ? ? ? ? ? ? ? ? ? ? ?0.9.0-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zstd.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1.3.2-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zulucrypt.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? 5.0.1-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zulucrypt-console.x86_64 ? ? ? ? ? ? ? ? 5.0.1-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zulucrypt-devel.x86_64 ? ? ? ? ? ? ? ? ? 5.0.1-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zulucrypt-doc.noarch ? ? ? ? ? ? ? ? ? ? 5.0.1-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zulucrypt-libs.x86_64 ? ? ? ? ? ? ? ? ? ?5.0.1-1.el7 ? ? ? ? ? ? ? ? ? epel ? ??
zvbi.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0.2.35-1.el7 ? ? ? ? ? ? ? ? ?epel ? ??
zvbi-devel.x86_64 ? ? ? ? ? ? ? ? ? ? ? ?0.2.35-1.el7 ? ? ? ? ? ? ? ? ?epel ? ??
zvbi-fonts.noarch ? ? ? ? ? ? ? ? ? ? ? ?0.2.35-1.el7 ? ? ? ? ? ? ? ? ?epel ? ??
[root@centos7 yum.repos.d]#

epel還是很重要的,以后要記住,后續實驗會多次用到。

yum下載rpm包

? yum install -y 包名 --downloadonly

? ls /var/cache/yum/x86_64/7/

? yum install -y 包名 --downloadonly --downloaddir=路徑

? yum reinstall -y 包名 --downloadonly --downloaddir=路徑

網上的rpm包有很多,雖然在光盤里可以找到一些rpm包,但是像epel這樣的東西在光驅里是沒有的。但是這個包我還是想要下載到我本地中來,比如把這些包保存下來讓其他的機器去用,省得yum安裝費時間。

接下來怎么做呢?這實際上是yum的一個插件。

下載之前需要先確認一下要下載的rpm包是不是已經安裝過了。如果已經安裝過了,再使用這個方法,它會提示這個包已經安裝過了。

使用命令yum install zsh --downloadonly,僅僅下載我不安裝。

[root@centos7 yum.repos.d]# yum install zsh --downloadonly
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
?* epel: mirrors.tongji.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:02 ? ??
exiting because "Download Only" specified
[root@centos7 yum.repos.d]#

上面說將會被安裝,到底有沒有安裝,可以查看一下。

[root@centos7 yum.repos.d]# rpm -q zsh
未安裝軟件包 zsh?
[root@centos7 yum.repos.d]#?

結果顯示沒有安裝,那這個包被下載到哪里了呢?在上面可以看到這個包的倉庫名字。

[root@centos7 yum.repos.d]# ls /var/cache/yum/x86_64/7/base/packages
zsh-5.0.2-28.el7.x86_64.rpm
[root@centos7 yum.repos.d]#?

那如何指定下載的路徑呢?

[root@centos7 yum.repos.d]# yum install zsh --downloadonly --downloaddir=/tmp/

已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
?* epel: mirror01.idc.hinet.net
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 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@centos7 yum.repos.d]#?

具體查看一下。

[root@centos7 yum.repos.d]# ls /tmp/
111 ?1.txt ?2.txt ?aming2 ? ? ?ks-script-77j_y6 ?yum_save_tx.2017-12-21.04-19.DQfe79.yumtx ?zsh-5.0.2-28.el7.x86_64.rpm
123 ?234 ? ?3.txt ?aminglinux ?yum.log ? ? ? ? ? yum_save_tx.2017-12-21.05-05.Ls_2rV.yumtx
[root@centos7 yum.repos.d]#?

現在搞一個vim包。

[root@centos7 yum.repos.d]# yum install vim-enhanced --downloadonly --downloaddir=/tmp/
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
?* epel: mirror01.idc.hinet.net
軟件包 2:vim-enhanced-7.4.160-2.el7.x86_64 已安裝并且是最新版本
無須任何處理
[root@centos7 yum.repos.d]# ls /tmp/
111 ?1.txt ?2.txt ?aming2 ? ? ?ks-script-77j_y6 ?yum_save_tx.2017-12-21.04-19.DQfe79.yumtx ?zsh-5.0.2-28.el7.x86_64.rpm
123 ?234 ? ?3.txt ?aminglinux ?yum.log ? ? ? ? ? yum_save_tx.2017-12-21.05-05.Ls_2rV.yumtx
[root@centos7 yum.repos.d]#?

上面說已安裝最新版本,沒有執行任何操作,/tmp/下自然沒有這個包了。那現在就想要這個包,怎么辦呢?先刪除,在下載是一個方法但是是一個很笨的方法,可以使用另外一個命令。

[root@centos7 yum.repos.d]# yum reinstall vim-enhanced --downloadonly --downloaddir=/tmp/
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
?* epel: mirrors.ustc.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:01 ? ??
exiting because "Download Only" specified
[root@centos7 yum.repos.d]# ls /tmp/
111 ? ?234 ? ?aming2 ? ? ? ? ? ?vim-enhanced-7.4.160-2.el7.x86_64.rpm ? ? ?yum_save_tx.2017-12-21.05-05.Ls_2rV.yumtx
123 ? ?2.txt ?aminglinux ? ? ? ?yum.log ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?yum_save_tx.2017-12-21.05-11.Bvg73s.yumtx
1.txt ?3.txt ?ks-script-77j_y6 ?yum_save_tx.2017-12-21.04-19.DQfe79.yumtx ?zsh-5.0.2-28.el7.x86_64.rpm
[root@centos7 yum.repos.d]#?

現在就可以了,在/tmp/下也能查看到了。
7.8/7.9 源碼包安裝

源碼包安裝目錄概要

  • cd /usr/local/src/
  • wget?http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz
  • tar zxvf httpd-2.2.34.tar.gz
  • cd httpd-2.2.34
  • ./configure --prefix=/usr/local/apache2
  • make
  • make install
  • 卸載就是刪除安裝的文件

源碼包下載路徑 /usr/local/src/ 統一規范!!!!

源碼包安裝

1.切換到/usr/local/src/目錄下

[root@tianqi-01 ~]# cd /usr/local/src/
[root@tianqi-01 src]#?

2.下載Apache

[root@tianqi-01 src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz

3.下載完后查看,會看到是 .tat.gz的壓縮包,并解壓它

[root@tianqi-01 src]# ls
httpd-2.2.34.tar.gz
[root@tianqi-01 src]# tar zxvf httpd-2.2.34.tar.gz

4.在解壓完成后,查看并進入到httpd-2.2.34目錄下去,再去查看,會看到各種文件

[root@tianqi-01 src]# ls
httpd-2.2.34 ?httpd-2.2.34.tar.gz
[root@tianqi-01 src]# cd httpd-2.2.34
[root@tianqi-01 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
[root@tianqi-01 httpd-2.2.34]#?

所有的源碼包,都會有一些說明文檔的

其中 README (介紹Apache的serve)和 INSTALL (安裝文檔)是經常會用到的

5.指定安裝路徑

  • ./configure --prefix=/usr/local/apache2 (2 表示2的版本)
  • 在第一次安裝的時候,可以用echo $? 查看是否安裝正確,0表示安裝正確(即上條命令執行成功)
  • 在安裝的時候,若缺失什么命令,什么包就會停止安裝,并告訴你缺失什么,你只需要安裝即可
  • 一般有可能會缺少失gcc命令,需要去安裝——>yum install -y gcc
  • ./configure就是在配置的過程,配置的過程會生成make file,make file就是用來編譯的文件

小技巧:若是在運行一條命令,不知道是否正確,則可以echo $?查看 若是非零,表示上一條命令是錯的

[root@tianqi-01 httpd-2.2.34]# ./configure --prefix=/usr/local/apache2

[root@tianqi-01 httpd-2.2.34]#yum install -y gcc

[root@tianqi-01 httpd-2.2.34]# echo $?
0
[root@tianqi-01 httpd-2.2.34]#

6.make命令編譯工具,這個過程會根據你的虛擬機配置,若區分多個cpu就很快

  • 并使用echo $?去檢測下是否錯誤

[root@tianqi-01 httpd-2.2.34]# make

[root@tianqi-01 httpd-2.2.34]# echo $?
0
[root@tianqi-01 httpd-2.2.34]#

7.make install 它會把編譯完成的二進制文件、配置文件目錄放入到 prefix 指定的目錄下

  • 并使用echo $?去檢測下是否錯誤

[root@tianqi-01 httpd-2.2.34]# make install

[root@tianqi-01 httpd-2.2.34]# echo $?
0
[root@tianqi-01 httpd-2.2.34]#

8.并去 /usr/local/apache2/ 查看生成的目錄

[root@tianqi-01 httpd-2.2.34]# ls /usr/local/apache2/
bin ?build ?cgi-bin ?conf ?error ?htdocs ?icons ?include ?lib ?logs ?man ?manual ?modules
[root@tianqi-01 httpd-2.2.34]#?

這就是源碼編輯安裝的包

8.源碼包安裝的都是在一個目錄下,那就是說卸載這個包只需要刪除目錄即可

下載源碼包一定要去官方網站或者可信任的站點下載!!!

友情鏈接:阿銘Linux

轉載于:https://my.oschina.net/u/3744518/blog/1591960

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的五周第二次课的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。