安裝軟件包的三種方法:node
設置光驅並掛載 1)點擊--虛擬機—設置—CD/DVD(ide)--右邊設置iso映像文件路徑。linux
2)掛載光驅git
[root@yong-02 ~]# mount /dev/cdrom /mnt mount: /dev/sr0 寫保護,將以只讀方式掛載 [root@yong-02 ~]# ls /mnt CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7 EFI images Packages RPM-GPG-KEY-CentOS-Testing-7 EULA isolinux repodata TRANS.TBL ### /mnt/Packages目錄裏面是rpm包
查看/mnt/Packages 裏面的包前5個vim
[root@yong-02 Packages]# ls |head -5 389-ds-base-1.3.6.1-16.el7.x86_64.rpm 389-ds-base-libs-1.3.6.1-16.el7.x86_64.rpm abattis-cantarell-fonts-0.0.25-1.el7.noarch.rpm abrt-2.1.11-48.el7.centos.x86_64.rpm abrt-addon-ccpp-2.1.11-48.el7.centos.x86_64.rpm
小知識: 每一個rpm包的名稱都是由-和.分紅若干部分,好比abrt-2.1.11-48.el7.centos.x86_64.rpm Abrt:包名
2.1.11-48:版本號;2爲主版本號,1爲次版本號,11爲修正版本
48-el7.centos:發佈版本號
x86_64.:運行平臺,64位 cpu目前分32位和64位,i38六、i58六、i686是32位,X86_64是64位。
64位系統能夠安裝32位軟件,可是32位系統不能安裝64爲軟件。windows
[root@yong-02 Packages]# rpm -ivh zip-3.0-11.el7.x86_64.rpm 準備中... ################################# [100%] 軟件包 zip-3.0-11.el7.x86_64 已經安裝
[root@yong-02 Packages]# rpm -e zip
[root@yong-02 ~]# rpm -q vim-enhanced vim-enhanced-7.4.160-2.el7.x86_64
[root@yong-02 Packages]# rpm -qa |head linux-firmware-20170606-56.gitc990aae.el7.noarch centos-release-7-4.1708.el7.centos.x86_64 kbd-1.15.5-13.el7.x86_64 setup-2.8.71-7.el7.noarch open-vm-tools-10.1.5-3.el7.x86_64 basesystem-10.0-7.el7.centos.noarch kexec-tools-2.0.14-17.el7.x86_64 bind-license-9.9.4-50.el7.noarch grub2-2.02-0.64.el7.centos.x86_64 firewalld-filesystem-0.4.4.4-6.el7.noarch
[root@yong-02 Packages]# rpm -qi vim-enhanced Name : vim-enhanced Epoch : 2 Version : 7.4.160 Release : 2.el7 Architecture: x86_64 Install Date: 2018年03月12日 星期一 15時57分38秒 Group : Applications/Editors Size : 2292098 License : Vim Signature : RSA/SHA256, 2017年08月11日 星期五 04時15分38秒, Key ID 24c6a8a7f4a80eb5 Source RPM : vim-7.4.160-2.el7.src.rpm Build Date : 2017年08月02日 星期三 08時46分12秒 Build Host : c1bm.rdu2.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://www.vim.org/ Summary : A version of the VIM editor which includes recent enhancements Description : VIM (VIsual editor iMproved) is an updated and improved version of the vi editor. Vi was the first real screen-based editor for UNIX, and is still very popular. VIM improves on vi by adding new features: multiple windows, multi-level undo, block highlighting and more. The vim-enhanced package contains a version of VIM with extra, recently introduced features like Python and Perl interpreters.
[root@yong-02 Packages]# rpm -ql vim-enhanced /etc/profile.d/vim.csh /etc/profile.d/vim.sh /usr/bin/rvim /usr/bin/vim /usr/bin/vimdiff /usr/bin/vimtutor
[root@yong-02 Packages]# rpm -qf /usr/bin/cd bash-4.2.46-28.el7.x86_64
[root@yong-02 Packages]# rpm -qf `which cd` bash-4.2.46-28.el7.x86_64 注意:``(esc下面那個鍵)裏面which cd 顯示只有一行,若是是which ls 顯示2行,這裏就不能使用這條命令。
Yum比rpm工具更方便,yum工具最大的優點在於能夠聯網去下載所須要的的rpm包,而後自動安裝,安裝全部相關的rpm包,解決依賴關係。centos
[root@yong-02 Packages]# yum list |head -20 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.shu.edu.cn 已安裝的軟件包 GeoIP.x86_64 1.5.0-11.el7 @anaconda NetworkManager.x86_64 1:1.8.0-9.el7 @anaconda NetworkManager-libnm.x86_64 1:1.8.0-9.el7 @anaconda NetworkManager-team.x86_64 1:1.8.0-9.el7 @anaconda NetworkManager-tui.x86_64 1:1.8.0-9.el7 @anaconda NetworkManager-wifi.x86_64 1:1.8.0-9.el7 @anaconda acl.x86_64 2.2.51-12.el7 @anaconda aic94xx-firmware.noarch 30-6.el7 @anaconda alsa-firmware.noarch 1.0.28-2.el7 @anaconda alsa-lib.x86_64 1.1.3-3.el7 @anaconda alsa-tools-firmware.x86_64 1.1.0-1.el7 @anaconda audit.x86_64 2.7.6-3.el7 @anaconda audit-libs.x86_64 2.7.6-3.el7 @anaconda authconfig.x86_64 6.2.8-30.el7 @anaconda
左邊是包名,中間是版本信息,右邊是倉庫名,倉庫這邊顯示@base、@anaconda表示已經安裝。若是未安裝這顯示base或者anaconda,若是是updates表示已安裝可是須要升級。緩存
yum的配置文件:/etc/yum.repos.d/Centos-Base.repo 裏面能夠配置倉庫名,yum源地址安全
[root@yong-02 Packages]# ls /etc/yum.repos.d/ CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo [root@yong-02 Packages]# cat /etc/yum.repos.d/CentOS-Base.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 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7bash
[root@yong-02 Packages]# yum search vim 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.shu.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」試試。
[root@yong-02 Packages]# yum list |grep 'vim' vim-common.x86_64 2:7.4.160-2.el7 @base vim-enhanced.x86_64 2:7.4.160-2.el7 @base vim-filesystem.x86_64 2:7.4.160-2.el7 @base 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-2.el7 base
[root@yong-02 Packages]# 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: mirrors.tuna.tsinghua.edu.cn 可用的環境分組: 最小安裝 基礎設施服務器 計算節點 文件及打印服務器 基本網頁服務器 虛擬化主機 帶 GUI 的服務器 GNOME 桌面 KDE Plasma Workspaces 開發及生成工做站 可用組: 傳統 UNIX 兼容性 兼容性程序庫 圖形管理工具 安全性工具 開發工具 控制檯互聯網工具 智能卡支持 科學記數法支持 系統管理 系統管理工具 完成
LANG=en 切換英文服務器
yum remove [-y]
命令:yum remove –y 包名 [root@yong-02 Packages]# yum remove vim 已加載插件:fastestmirror 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 vim-enhanced.x86_64.2.7.4.160-2.el7 將被 刪除 --> 解決依賴關係完成 依賴關係解決 ===================================================================================== Package 架構 版本 源 大小 ===================================================================================== 正在刪除: vim-enhanced x86_64 2:7.4.160-2.el7 @base 2.2 M 事務概要 ===================================================================================== 移除 1 軟件包 安裝大小:2.2 M 是否繼續?[y/N]:n Exiting on user command 您的事務已保存,請執行: yum load-transaction /tmp/yum_save_tx.2018-04-18.17-26.1qYdG1.yumtx 從新執行該事務
[root@linux-128 ~]# mount /dev/cdrom /mnt mount: /dev/sr0 寫保護,將以只讀方式掛載
[dvd] //倉庫名字
name=install dvd
baseurl=file:///mnt //本地源地址
enable=1 //本地是否可用,1可用,0不能夠
gpgcheck=0 //是否檢測,1檢測,0不檢測
[root@yong-02 yum.repos.d]# yum list |tail yum-plugin-changelog.noarch 1.1.31-42.el7 dvd yum-plugin-tmprepo.noarch 1.1.31-42.el7 dvd yum-plugin-verify.noarch 1.1.31-42.el7 dvd yum-plugin-versionlock.noarch 1.1.31-42.el7 dvd yum-utils.noarch 1.1.31-42.el7 dvd zenity.x86_64 3.22.0-1.el7 dvd zip.x86_64 3.0-11.el7 dvd zlib-devel.x86_64 1.2.7-17.el7 dvd zsh.x86_64 5.0.2-28.el7 dvd zziplib.x86_64 0.13.62-5.el7 dvd
在安裝軟件時若是出現如下報錯:
跑大量高負載程序,形成cpu soft lockup
解決方法 :1,echo 30 > /proc/sys/kernel/watchdog_thresh
2,sysctl -w kernel.watchdog_thresh=30