1.RPM包的來源html
在虛擬機中點擊選擇虛擬機設置,選中CD/DVD,選擇ISO鏡像,設備狀態選擇已鏈接, 而後點擊肯定。node
[root@xuexi--01 ~]# mkdir /mnt/cdrom [root@xuexi--01 ~]# mount /dev/sr0 /mnt/cdrom [root@xuexi--01 ~]# cd /mnt/cdrom/ [root@xuexi--01 cdrom]# ls ````全部的RPM包都在Packages這個目錄當中 CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7 EFI images Packages RPM-GPG-KEY-CentOS-Testing-7 EULA isolinux repodata TRANS.TBL [root@xuexi--01 cdrom]# cd Packages/ [root@xuexi--01 Packages]# ls ······ postgresql-libs-9.2.21-1.el7.x86_64.rpm postgresql-odbc-09.03.0100-2.el7.x86_64.rpm postgresql-plperl-9.2.21-1.el7.x86_64.rpm postgresql-plpython-9.2.21-1.el7.x86_64.rpm postgresql-pltcl-9.2.21-1.el7.x86_64.rpm postgresql-server-9.2.21-1.el7.x86_64.rpm postgresql-test-9.2.21-1.el7.x86_64.rpm pothana2000-fonts-1.3.3-6.el7.noarch.rpm powertop-2.3-12.el7.x86_64.rpm ppp-2.4.5-33.el7.x86_64.rpm pptp-1.7.2-22.el7.x86_64.rpm prelink-0.5.0-9.el7.x86_64.rpm procmail-3.22-36.el7.x86_64.rpm procps-ng-3.3.10-16.el7.x86_64.rpm psacct-6.6.1-13.el7.x86_64.rpm ps_mem-3.1-7.el7.noarch.rpm psmisc-22.20-15.el7.x86_64.rpm pth-2.0.7-23.el7.x86_64.rpm ptlib-2.10.10-6.el7.x86_64.rpm pulseaudio-10.0-3.el7.x86_64.rpm pulseaudio-gdm-hooks-10.0-3.el7.x86_64.rpm pulseaudio-libs-10.0-3.el7.x86_64.rpm pulseaudio-libs-devel-10.0-3.el7.x86_64.rpm pulseaudio-libs-glib2-10.0-3.el7.x86_64.rpm pulseaudio-module-bluetooth-10.0-3.el7.x86_64.rpm ······
2.RPM包的命名規則 例如:httpd-2.4.6-67.el7.centos.x86_64.rpmpython
3.RPM包依賴性linux
1.包全名與包名nginx
2.RPM安裝git
選項:github
[root@xuexi--01 Packages]# rpm -ivh zsh-5.0.2-28.el7.x86_64.rpm 準備中... ################################# [100%] 正在升級/安裝... 1:zsh-5.0.2-28.el7 ################################# [100%]
RPM升級sql
選項:docker
RPM卸載shell
選項:
[root@xuexi--01 Packages]# rpm -e zsh
1.查詢是否安裝
[root@xuexi--01 Packages]# rpm -q httpd 未安裝軟件包 httpd
2.查詢軟件包的詳細信息
選項:
[root@xuexi--01 Packages]# rpm -ivh zsh-5.0.2-28.el7.x86_64.rpm 準備中... ################################# [100%] 正在升級/安裝... 1:zsh-5.0.2-28.el7 ################################# [100%] [root@xuexi--01 Packages]# rpm -qi zsh Name : zsh Version : 5.0.2 Release : 28.el7 Architecture: x86_64 Install Date: 2018年05月26日 星期六 21時45分48秒 Group : System Environment/Shells Size : 5855982 License : MIT Signature : RSA/SHA256, 2017年08月11日 星期五 04時28分17秒, Key ID 24c6a8a7f4a80eb5 Source RPM : zsh-5.0.2-28.el7.src.rpm Build Date : 2017年08月02日 星期三 18時52分37秒 Build Host : c1bm.rdu2.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://zsh.sourceforge.net/ Summary : Powerful interactive shell Description : The zsh shell is a command interpreter usable as an interactive login shell and as a shell script command processor. Zsh resembles the ksh shell (the Korn shell), but includes many enhancements. Zsh supports command line editing, built-in spelling correction, programmable command completion, shell functions (with autoloading), a history mechanism, and more.
3.查詢包中文件安裝位置
選項:
安裝位置 | 說明 |
---|---|
/etc/ | 配置文件安裝目錄 |
/usr/bin/ | 可執行的命令安裝目錄 |
/usr/lib/ | 程序所使用的函數庫保存位置 |
/usr/share/doc/ | 基本的軟件使用手冊保存位置 |
/usr/share/man/ | 幫助文件保存位置 |
4.查詢系統文件屬於哪一個RPM包
/usr/share/zsh/site-functions [root@xuexi--01 Packages]# rpm -qf /usr/share/zsh/site-functions systemd-219-42.el7.x86_64 zsh-5.0.2-28.el7.x86_64
1.RPM校驗
選項:
[root@localhost ~]# yum list ··· yum-utils.noarch 1.1.31-45.el7 base zenity.x86_64 3.22.0-1.el7 base zip.x86_64 3.0-11.el7 base zlib.i686 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@localhost ~]# yum search vim 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: ftp.sjtu.edu.cn ========================= N/S matched: vim ========================= protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol : Buffers descriptions vim-X11.x86_64 : The VIM version of the vi editor for the X Window : System vim-common.x86_64 : The common files needed by any version of the : VIM editor vim-enhanced.x86_64 : A version of the VIM editor which includes : recent enhancements vim-filesystem.x86_64 : VIM filesystem layout vim-minimal.x86_64 : A minimal version of the VIM editor 名稱和簡介匹配 only,使用「search all」試試。
還有一種搜索的rpm包的方法,使用grep。 yum list |grep '關鍵字'
[root@localhost ~]# yum list |grep 'vim' vim-minimal.x86_64 2:7.4.160-2.el7 @anaconda protobuf-vim.x86_64 2.5.0-8.el7 base vim-X11.x86_64 2:7.4.160-4.el7 base vim-common.x86_64 2:7.4.160-4.el7 base vim-enhanced.x86_64 2:7.4.160-4.el7 base vim-filesystem.x86_64 2:7.4.160-4.el7 base vim-minimal.x86_64 2:7.4.160-4.el7 base
選項:
[root@localhost ~]# yum install -y zsh.x86_64 已加載插件:fastestmirror base | 3.6 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: ftp.sjtu.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 Downloading packages: zsh-5.0.2-28.el7.x86_64.rpm | 2.4 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : zsh-5.0.2-28.el7.x86_64 1/1 驗證中 : zsh-5.0.2-28.el7.x86_64 1/1 已安裝: zsh.x86_64 0:5.0.2-28.el7 完畢!
選項:
[root@localhost ~]# yum remove -y zsh Failed to set locale, defaulting to C Loaded plugins: fastestmirror Resolving Dependencies --> Running transaction check ---> Package zsh.x86_64 0:5.0.2-28.el7 will be erased --> Finished Dependency Resolution Dependencies Resolved ==================================================================== Package Arch Version Repository Size ==================================================================== Removing: zsh x86_64 5.0.2-28.el7 @base 5.6 M Transaction Summary ==================================================================== Remove 1 Package Installed size: 5.6 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : zsh-5.0.2-28.el7.x86_64 1/1 Verifying : zsh-5.0.2-28.el7.x86_64 1/1 Removed: zsh.x86_64 0:5.0.2-28.el7 Complete!
[root@localhost ~]# yum grouplist 已加載插件:fastestmirror 沒有安裝組信息文件 Maybe run: yum groups mark convert (see man yum) Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: ftp.sjtu.edu.cn 可用的環境分組: 最小安裝 基礎設施服務器 計算節點 文件及打印服務器 基本網頁服務器 虛擬化主機 帶 GUI 的服務器 GNOME 桌面 KDE Plasma Workspaces 開發及生成工做站 可用組: 傳統 UNIX 兼容性 兼容性程序庫 圖形管理工具 安全性工具 開發工具 控制檯互聯網工具 智能卡支持 科學記數法支持 系統管理 系統管理工具 完成
使用 英文顯示,只須要將語言改成英文就能夠了LANG=en
[root@localhost ~]# yum grouplist Failed to set locale, defaulting to C Loaded plugins: fastestmirror There is no installed groups file. Maybe run: yum groups mark convert (see man yum) Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: ftp.sjtu.edu.cn Available Environment Groups: Minimal Install Compute Node Infrastructure Server File and Print Server Basic Web Server Virtualization Host Server with GUI GNOME Desktop KDE Plasma Workspaces Development and Creative Workstation Available Groups: Compatibility Libraries Console Internet Tools Development Tools Graphical Administration Tools Legacy UNIX Compatibility Scientific Support Security Tools Smart Card Support System Administration Tools System Management Done
[root@localhost ~]# yum provides /*/"vim" 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: ftp.sjtu.edu.cn base/7/x86_64/filelists_db | 6.9 MB 00:00 extras/7/x86_64/filelists_db | 519 kB 00:00 updates/7/x86_64/filelists_db | 1.3 MB 00:00 cmake-2.8.12.2-2.el7.x86_64 : Cross-platform make system 源 :base 匹配來源: 文件名 :/usr/share/cmake/editors/vim 2:docker-unit-test-1.13.1-53.git774336d.el7.centos.x86_64 : ...: Automates deployment of containerized applications - for ...: running unit tests 源 :extras 匹配來源: 文件名 :/var/lib/docker-unit-test/v1.10-migrator-c417a6a022c5023c111662e8280f885f6ac259be/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/runc-e9c345b3f906d5dc5e8100b05ce37073a811c74a/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/docker-novolume-plugin-385ec70baac3ef356f868f391c8d7818140fbd44/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/containerd-296f1f80d6c6a83cc625163f863e53d3287328ee/vendor/src/github.com/docker/docker/contrib/syntax/vim 2:docker-unit-test-1.13.1-58.git87f2fab.el7.centos.x86_64 : ...: Automates deployment of containerized applications - for ...: running unit tests 源 :extras 匹配來源: 文件名 :/var/lib/docker-unit-test/v1.10-migrator-c417a6a022c5023c111662e8280f885f6ac259be/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/runc-e9c345b3f906d5dc5e8100b05ce37073a811c74a/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/docker-novolume-plugin-385ec70baac3ef356f868f391c8d7818140fbd44/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/containerd-296f1f80d6c6a83cc625163f863e53d3287328ee/vendor/src/github.com/docker/docker/contrib/syntax/vim 2:docker-unit-test-1.13.1-63.git94f4240.el7.centos.x86_64 : ...: Automates deployment of containerized applications - for ...: running unit tests 源 :extras 匹配來源: 文件名 :/var/lib/docker-unit-test/v1.10-migrator-c417a6a022c5023c111662e8280f885f6ac259be/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/runc-e9c345b3f906d5dc5e8100b05ce37073a811c74a/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/docker-novolume-plugin-385ec70baac3ef356f868f391c8d7818140fbd44/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim 文件名 :/var/lib/docker-unit-test/containerd-296f1f80d6c6a83cc625163f863e53d3287328ee/vendor/src/github.com/docker/docker/contrib/syntax/vim git-1.8.3.1-13.el7.x86_64 : Fast Version Control System 源 :base 匹配來源: 文件名 :/usr/share/doc/git-1.8.3.1/contrib/vim 2:vim-common-7.4.160-4.el7.x86_64 : The common files needed by any : version of the VIM editor 源 :base 匹配來源: 文件名 :/usr/share/vim 2:vim-enhanced-7.4.160-4.el7.x86_64 : A version of the VIM editor ...: which includes recent enhancements 源 :base 匹配來源: 文件名 :/usr/bin/vim
[dvd] name=install dvd baseurl=file:///mnt enable=1 gpcheck=0
[root@localhost ~]# mount /dev/sr0 /mnt/cdrom/ [root@localhost ~]# cp -r /etc/yum.repos.d/ /etc/yum.repos.d.bak [root@localhost ~]# ls /etc/ | grep yum* yum yum.conf yum.repos.d yum.repos.d.bak vim /etc/yum.repos.d/dvd.repo [dvd] name=install dvd baseurl=file:///mnt/cdrom ····地址爲本身光盤目錄掛載點 enable=1 ···· enabled=1 讓這個yum源失效 gpgcheck=0 [root@localhost ~]# yum clean all
[root@localhost ~]# yum list ······ pygobject3-devel.x86_64 3.22.0-1.el7 dvd pygtk2.x86_64 2.24.0-9.el7 dvd pygtk2-libglade.x86_64 2.24.0-9.el7 dvd pykde4.x86_64 4.10.5-4.el7 dvd pykickstart.noarch 1.99.66.12-1.el7 dvd pyldb.x86_64 1.1.29-1.el7 dvd pyorbit.x86_64 2.24.0-15.el7 dvd pyparsing.noarch 1.5.6-9.el7 dvd pyparted.x86_64 1:3.9-13.el7 dvd pytalloc.x86_64 2.1.9-1.el7 dvd python-IPy.noarch 0.75-6.el7 dvd python-augeas.noarch 0.5.0-2.el7 dvd python-babel.noarch 0.9.6-8.el7 dvd python-backports.x86_64 1.0-8.el7 dvd python-backports-ssl_match_hostname.noarch ······
一、掛載光盤 [root@localhost ~]# mount /dev/sr0 /mnt/cdrom/ 2.使網絡yum 源失效
[root@localhost ~]# cd /etc/yum.repos.d/ # 進入yum源 [root@localhost yum.repos.d]# ls CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo CentOS-CR.repo CentOS-Media.repo CentOS-Debuginfo.repo CentOS-Sources.repo # 網絡yum源生效的文件爲CentOS-Base.repo,未防止之後須要使用,不要將其刪除,能夠更改後綴名使其失效。 [root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak [root@localhost yum.repos.d]# ls CentOS-Base.repo.bak CentOS-fasttrack.repo CentOS-Vault.repo CentOS-CR.repo CentOS-Media.repo CentOS-Debuginfo.repo CentOS-Sources.repo # 更更名稱後,網絡yum源就已經失效了 本地yum源起做用的是CentOS-Media.repo,須要修改這個文件裏面的內容
3.使光盤yum源生效
[root@localhost yum.repos.d]# vi CentOS-Media.repo # CentOS-Media.repo # # This repo can be used with mounted DVD media, verify the mount point for # CentOS-7. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c7-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c7-media [command] [c7-media] name=CentOS-$releasever - Media baseurl=file:///mnt/cdrom/ # file:///media/cdrom/ # file:///media/cdrecorder/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@localhost yum.repos.d]# yum list ······ pygobject3-devel.x86_64 3.22.0-1.el7 c7-media pygtk2.x86_64 2.24.0-9.el7 c7-media pygtk2-libglade.x86_64 2.24.0-9.el7 c7-media pykde4.x86_64 4.10.5-4.el7 c7-media pykickstart.noarch 1.99.66.12-1.el7 c7-media pyldb.x86_64 1.1.29-1.el7 c7-media pyorbit.x86_64 2.24.0-15.el7 c7-media pyparsing.noarch 1.5.6-9.el7 c7-media pyparted.x86_64 1:3.9-13.el7 c7-media pytalloc.x86_64 2.1.9-1.el7 c7-media python-IPy.noarch 0.75-6.el7 c7-media python-augeas.noarch 0.5.0-2.el7 c7-media python-babel.noarch 0.9.6-8.el7 c7-media python-backports.x86_64 1.0-8.el7 c7-media python-backports-ssl_match_hostname.noarch ······
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo 若是刪除了CentOS-Base.repo 沒有辦法使用yum 安裝wget 軟件包 可使用curl -O 進行下載 curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo yum-plugin-versionlock.noarch 1.1.31-45.el7 base yum-rhn-plugin.noarch 2.0.1-10.el7 base yum-updateonboot.noarch 1.1.31-45.el7 base yum-utils.noarch 1.1.31-45.el7 base zenity.x86_64 3.22.0-1.el7 base zip.x86_64 3.0-11.el7 base zlib.i686 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@localhost yum.repos.d]# yum install -y zsh 已加載插件:fastestmirror Loading mirror speeds from cached hostfile 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 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 Downloading packages: zsh-5.0.2-28.el7.x86_64.rpm | 2.4 MB 00:02 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : zsh-5.0.2-28.el7.x86_64 1/1 驗證中 : zsh-5.0.2-28.el7.x86_64 1/1 已安裝: zsh.x86_64 0:5.0.2-28.el7 完畢!
[root@localhost yum.repos.d]# yum install -y epel-release 已加載插件:fastestmirror Loading mirror speeds from cached hostfile 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 epel-release.noarch.0.7-11 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ==================================================================== Package 架構 版本 源 大小 ==================================================================== 正在安裝: epel-release noarch 7-11 extras 15 k 事務概要 ==================================================================== 安裝 1 軟件包 總下載量:15 k 安裝大小:24 k Downloading packages: epel-release-7-11.noarch.rpm | 15 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : epel-release-7-11.noarch 1/1 驗證中 : epel-release-7-11.noarch 1/1 已安裝: epel-release.noarch 0:7-11 完畢!
[root@localhost yum.repos.d]# yum list | grep epel ······ znc-modtcl.x86_64 1.6.6-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.4-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@localhost yum.repos.d]# yum install zsh --downloadonly 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * epel: mirrors.ustc.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@localhost yum.repos.d]# ls /var/cache/yum/x86_64/7/base/packages/ glibc-2.17-222.el7.x86_64.rpm glibc-common-2.17-222.el7.x86_64.rpm glibc-devel-2.17-222.el7.x86_64.rpm glibc-headers-2.17-222.el7.x86_64.rpm libmpc-1.0.1-3.el7.x86_64.rpm mpfr-3.1.1-4.el7.x86_64.rpm zsh-5.0.2-28.el7.x86_64.rpm
#指定下載的目錄
[root@localhost yum.repos.d]# yum install zsh --downloadonly --downloaddir=/tmp/ 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * epel: mirrors.ustc.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@localhost yum.repos.d]# ls /tmp/ zsh-5.0.2-28.el7.x86_64.rpm
能夠設置使yum保留已經下載的rpm包,供之後升級或從新安裝時使用。
[root@localhost ~]# ls /tmp/base/packages/ zsh-5.0.2-28.el7.x86_64.rpm
[root@localhost ~]# mkdir -p /root/data/yumdata
2.拷貝ISO鏡像文件中的rpm包到/data/yumdata/
[root@localhost ~]# cp /mnt/cdrom/Packages/*.rpm /data/yumdata/
3.建立repository 建立repo 的庫
createrepo --update /data/yumdata/
[root@localhost ~]# createrepo /data/yumdata/ Spawning worker 0 with 7308 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete
[root@localhost ~]# yum install -y nginx 已加載插件:fastestmirror base | 3.6 kB 00:00 c7-media | 3.6 kB 00:00 epel/x86_64/metalink | 7.0 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 Loading mirror speeds from cached hostfile * epel: mirrors.tuna.tsinghua.edu.cn 軟件包 1:nginx-1.12.2-2.el7.x86_64 已安裝而且是最新版本 無須任何處理 nginx軟件包以前安裝過提示已是最新版本
安裝完成後須要更改一下配置文件
[root@localhost ~]# vim /etc/nginx/nginx.conf server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /data/yumdata; IP 能夠訪問到rpm包 # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { autoindex on; 在這個地方添加 autoindex on;將來提供目錄瀏覽 } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; [root@localhost ~]# nginx -t 檢測nginx 配置語法有沒有錯誤 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [root@localhost ~]# systemctl start nginx 啓動nginx
[root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# mkdir bak [root@localhost yum.repos.d]# mv *.repo bak/ [root@localhost yum.repos.d]# ls bak CentOS-Base.repo.bak
使用ip 訪問
[root@localhost ~]# cd /usr/local/src [root@localhost src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz --2018-05-29 20:58:29-- http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz 正在解析主機 mirrors.cnnic.cn (mirrors.cnnic.cn)... 101.6.8.193, 2402:f000:1:408:8100::1 正在鏈接 mirrors.cnnic.cn (mirrors.cnnic.cn)|101.6.8.193|:80... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 302 Found 位置:http://219.238.7.69/files/200300000B7F2CD1/mirrors.hust.edu.cn/apache//httpd/httpd-2.4.33.tar.gz [跟隨至新的 URL] --2018-05-29 20:58:29-- http://219.238.7.69/files/200300000B7F2CD1/mirrors.hust.edu.cn/apache//httpd/httpd-2.4.33.tar.gz 正在鏈接 219.238.7.69:80... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:9076901 (8.7M) [application/octet-stream] 正在保存至: 「httpd-2.4.33.tar.gz」 100%[==========================>] 9,076,901 46.6KB/s 用時 4m 0s 2018-05-29 21:02:31 (36.9 KB/s) - 已保存 「httpd-2.4.33.tar.gz」 [9076901/9076901])
[root@localhost src]# ls httpd-2.4.33.tar.gz [root@localhost src]# tar -zxvf httpd-2.4.33.tar.gz [root@localhost src]# ls httpd-2.4.33 httpd-2.4.33.tar.gz [root@localhost src]# cd httpd-2.4.33 [root@localhost httpd-2.4.33]# ls ABOUT_APACHE CMakeLists.txt INSTALL NWGNUmakefile acinclude.m4 config.layout InstallBin.dsp os Apache-apr2.dsw configure LAYOUT README Apache.dsw configure.in libhttpd.dep README.cmake apache_probes.d docs libhttpd.dsp README.platforms ap.d emacs-style libhttpd.mak ROADMAP build httpd.dep LICENSE server BuildAll.dsp httpd.dsp Makefile.in srclib BuildBin.dsp httpd.mak Makefile.win support buildconf httpd.spec modules test CHANGES include NOTICE VERSIONING 這個裏面有README 和 INSTALL 這兩個文件,能夠查看這些幫助文檔來進行安裝 [root@localhost httpd-2.4.33]# cat INSTALL APACHE INSTALLATION OVERVIEW Quick Start - Unix ------------------ For complete installation documentation, see [ht]docs/manual/install.html or http://httpd.apache.org/docs/2.4/install.html $ ./configure --prefix=PREFIX 安裝步驟 $ make $ make install $ PREFIX/bin/apachectl start
[root@localhost httpd-2.4.33]# ./configure --prefix=/usr/local/apache2 checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... no configure: error: APR not found. Please read the documentation.
運行安裝命令的時候報錯,可使用echo $? 若是執行的結果非0 說明上一條命令是錯誤的
[root@localhost httpd-2.4.33]# echo $? 1
configure: error: APR not found. Please read the documentation.
[root@localhost src]# wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz --2018-05-29 21:20:57-- http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz 正在解析主機 mirrors.cnnic.cn (mirrors.cnnic.cn)... 101.6.8.193, 2402:f000:1:408:8100::1 正在鏈接 mirrors.cnnic.cn (mirrors.cnnic.cn)|101.6.8.193|:80... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 302 Found 位置:http://219.239.26.11/files/224600000AE1B9A7/mirror.bit.edu.cn/apache//apr/apr-1.6.3.tar.gz [跟隨至新的 URL] --2018-05-29 21:20:58-- http://219.239.26.11/files/224600000AE1B9A7/mirror.bit.edu.cn/apache//apr/apr-1.6.3.tar.gz 正在鏈接 219.239.26.11:80... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:1072661 (1.0M) [application/octet-stream] 正在保存至: 「apr-1.6.3.tar.gz」 100%[==========================>] 1,072,661 6.62MB/s 用時 0.2s 2018-05-29 21:20:58 (6.62 MB/s) - 已保存 「apr-1.6.3.tar.gz」 [1072661/1072661]) [root@localhost src]# ls apr-1.6.3.tar.gz httpd-2.4.33 httpd-2.4.33.tar.gz [root@localhost src]# tar -zxvf apr-1.6.3.tar.gz [root@localhost src]# ls apr-1.6.3 apr-1.6.3.tar.gz httpd-2.4.33 httpd-2.4.33.tar.gz [root@localhost src]# cd apr-1.6.3 [root@localhost apr-1.6.3]# ls apr-config.in CMakeLists.txt libapr.mak poll apr.dep config.layout libapr.rc random apr.dsp configure LICENSE README apr.dsw configure.in locks README.cmake apr.mak docs Makefile.in shmem apr.pc.in dso Makefile.win strings apr.spec emacs-mode memory support atomic encoding misc tables build file_io mmap test buildconf helpers network_io threadproc build.conf include NOTICE time build-outputs.mk libapr.dep NWGNUmakefile tools CHANGES libapr.dsp passwd user
仍是使用
[root@localhost apr-1.6.3]# ./configure --prefix=/usr/desired/path/of/apr2 [root@localhost apr-1.6.3]# echo $? 0 [root@localhost apr-1.6.3]# make [root@localhost apr-1.6.3]# make test [root@localhost apr-1.6.3]# echo $? 0 [root@localhost apr-1.6.3]# make install
安裝完apr 而後再回去繼續安裝apache仍是報錯沒有APR 這時候須要關聯一下路徑
而後報錯 沒有安裝checking for APR-util... no configure: error: APR-util not found. Please read the documentation. 繼續安裝apr-util
[root@localhost ~]# ls /usr/local/src/apache2/ bin cgi-bin error icons logs manual build conf htdocs include man modules
提示沒有安裝apr 下載源碼包安裝 也可使用yum安裝,本章節講的使用源碼包因此使用源碼包安裝的方法,
提示沒有安裝apr-util 同上下載安裝,./configure時須要關聯apr ./configure --prefix=/usr/local/src/apr-util2 --with-apr=/usr/local/src/apr
apr-util make報錯 yum install expat-devel
安裝apache時須要關聯apr和apr-util2 ./configure --prefix=/usr/local/src/apache2 --with-apr=/usr/local/src/apr --with-apr-util=/usr/local/src/aprutil2
pcre-config... false: yum -y install pcre-devel