91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Linux軟件包安裝和卸載

發布時間:2020-08-01 09:08:00 來源:網絡 閱讀:731 作者:Asn_Fy 欄目:系統運維

linux系統下安裝軟件包的三種方法:
1.rpm工具:下載軟件rpm包安裝,類似Windows的exe文件
2.yum工具:類似應用商店,相比rpm安裝優勢在于更方便快捷,會自動安裝依賴包
3.源碼包:下載源碼包到linux系統中,需要編譯器編譯安裝

rpm工具用法:
rpm包的格式如下圖:(zsh為包名,5.0.2為版本號,-31.el7為發布版本號)

[root@localhost Packages]# zsh-5.0.2-31.el7.x86_64.rpm

安裝rpm包命令:rpm -ivh 包名

[root@localhost Packages]# rpm -ivh zsh-5.0.2-31.el7.x86_64.rpm
準備中...                          ################################# [100%]
正在升級/安裝...
   1:zsh-5.0.2-31.el7                 ################################# [100%]

升級rpm包命令:rpm -Uvh 包名

[root@localhost Packages]# rpm -Uvh zsh-5.0.2-31.el7.x86_64.rpm

*當系統中有高版本的zsh包的時候,可以使用rpm -Uvh 升級包

卸載rpm包:rpm -e 包名

[root@localhost Packages]# rpm -e zsh  #卸載不需要寫包的全名

查詢系統已安裝的rpm包: rpm -qa

[root@localhost Packages]# rpm -qa

查詢指定的包是否安裝:rpm -q 包名

[root@localhost Packages]# rpm -q zsh   #前文安裝zsh包后已卸載所以提示未安裝
未安裝軟件包 zsh 
[root@localhost Packages]# rpm -q vim-enhanced  #已安裝的包會列出包的信息
vim-enhanced-7.4.160-6.el7_6.x86_64

查詢指定包的詳細信息: rpm -qi 包名

[root@localhost Packages]# rpm -qi vim-enhanced
Name        : vim-enhanced
Epoch       : 2
Version     : 7.4.160
Release     : 6.el7_6
Architecture: x86_64
Install Date: 2019年08月28日 星期三 11時22分18秒
Group       : Applications/Editors
Size        : 2296674
License     : Vim
Signature   : RSA/SHA256, 2019年07月01日 星期一 21時34分29秒, Key ID 24c6a8a7f4a80eb5
Source RPM  : vim-7.4.160-6.el7_6.src.rpm
Build Date  : 2019年06月28日 星期五 21時59分48秒
Build Host  : x86-02.bsys.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.

Install the vim-enhanced package if you'd like to use a version of the
VIM editor which includes recently added enhancements like
interpreters for the Python and Perl scripting languages.  You'll also
need to install the vim-common package.

列出包的安裝文件:rpm -ql 包名

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

查看文件由什么包安裝: rpm -qf 文件絕對路徑

[root@localhost Packages]# rpm -qf /usr/bin/vimdiff
vim-enhanced-7.4.160-6.el7_6.x86_64

yum工具的用法:
yum list :列出yum倉庫中可以安裝的rpm包

[root@localhost ~]# yum list

*第三列表示倉庫名,帶@符號表示已安裝

查看yum倉庫配置文件:

[root@localhost ~]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-CR.repo  CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo  CentOS-Sources.repo  CentOS-Vault.repo

yum search 包名:搜索yum倉庫中的包

[root@localhost ~]# yum search tomcat
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
=========================================================================== N/S matched: tomcat ===========================================================================
tomcat-admin-webapps.noarch : The host-manager and manager web applications for Apache Tomcat
tomcat-docs-webapp.noarch : The docs web application for Apache Tomcat
tomcat-javadoc.noarch : Javadoc generated documentation for Apache Tomcat
tomcat-jsp-2.2-api.noarch : Apache Tomcat JSP API implementation classes
tomcat-jsvc.noarch : Apache jsvc wrapper for Apache Tomcat as separate service
tomcat-lib.noarch : Libraries needed to run the Tomcat Web container
tomcat-servlet-3.0-api.noarch : Apache Tomcat Servlet API implementation classes
tomcat-webapps.noarch : The ROOT and examples web applications for Apache Tomcat
tomcatjss.noarch : JSS Connector for Apache Tomcat, a JSSE module for Apache Tomcat that uses JSS
tomcat.noarch : Apache Servlet/JSP Engine, RI for Servlet 3.0/JSP 2.2 API
tomcat-el-2.2-api.noarch : Expression Language v2.2 API

yum list | grep 包名:第二種搜索包的方式,顯示信息更簡潔

[root@localhost ~]# yum list | grep tomcat
tomcat.noarch                               7.0.76-9.el7_6             updates  
tomcat-admin-webapps.noarch                 7.0.76-9.el7_6             updates  
tomcat-docs-webapp.noarch                   7.0.76-9.el7_6             updates  
tomcat-el-2.2-api.noarch                    7.0.76-9.el7_6             updates  
tomcat-javadoc.noarch                       7.0.76-9.el7_6             updates  
tomcat-jsp-2.2-api.noarch                   7.0.76-9.el7_6             updates  
tomcat-jsvc.noarch                          7.0.76-9.el7_6             updates  
tomcat-lib.noarch                           7.0.76-9.el7_6             updates  
tomcat-servlet-3.0-api.noarch               7.0.76-9.el7_6             updates  
tomcat-webapps.noarch                       7.0.76-9.el7_6             updates  
tomcatjss.noarch                            7.2.1-8.el7_6              updates 

yum -y install 包名:安裝包

[root@localhost ~]# yum -y install vim-enhanced

yum grouplist:列出可以安裝的環境分組和拓展組

[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.huaweicloud.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
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

yum -y groupinstall 分組名:安裝分組 (分組名有多個單詞的情況下加單引號)

[root@localhost ~]# yum -y groupinstall 'Basic Web Server'

yum -y remove 包名:卸載包

[root@localhost ~]# yum -y remove tomcat

yum -y update 包名:更新包

[root@localhost ~]# yum -y update vim-enhancde

yum provides "/*/命令":查看命令由什么包安裝以及安裝路徑
*當遇到命令名稱與包名不一樣的情況時,使用yum list | grep 包名可能找不到具體信息,使用yum provides可以根據命令找到包名以及安裝路徑,比如:pstree命令,pstree命令的包名為psmisc

[root@localhost ~]# yum provides "/*/pstree"
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
psmisc-22.20-15.el7.x86_64 : Utilities for managing processes on your system
源    :base
匹配來源:
文件名    :/usr/bin/pstree

yum搭建本地倉庫:
掛載帶有centos鏡像的光盤:

[root@localhost ~]# mount /dev/cdrom /mnt/gp/
mount: /dev/sr0 寫保護,將以只讀方式掛載

備份yum配置文件:

[root@localhost ~]# cp -r /etc/yum.repos.d/ /etc/yum.repos.d.bak

清空配置文件:

[root@localhost ~]# rm -rf /etc/yum.repos.d/*

新建本地yum倉庫配置文件:

[root@localhost ~]# vim /etc/yum.repos.d/yumck.repo

添加以下內容:

[yumck]
name=install yumck  #自定義描述字符
baseurl=file:///mnt/gp/  #倉庫中rpm包的路徑
enable=1          #是否可用,改為0改倉庫即變為不可用
gpgcheck=0      #是否檢測

清除緩存:

[root@localhost ~]# yum clean all
已加載插件:fastestmirror, langpacks
正在清理軟件源: yumck
Cleaning up list of fastest mirrors
Other repos take up 197 M of disk space (use --verbose for details)

查看本地yum倉庫中可安裝的包:

[root@localhost ~]# yum list

安裝測試:

[root@localhost ~]# yum -y install zsh
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 zsh.x86_64.0.5.0.2-31.el7 將被 安裝
--> 解決依賴關系完成

依賴關系解決

===========================================================================================================================================================================
 Package                              架構                                    版本                                            源                                      大小
===========================================================================================================================================================================
正在安裝:
 zsh                                  x86_64                                  5.0.2-31.el7                                    yumck                                  2.4 M

事務概要
===========================================================================================================================================================================
安裝  1 軟件包

總下載量:2.4 M
安裝大小:5.6 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安裝    : zsh-5.0.2-31.el7.x86_64                                                                                                                                1/1 
  驗證中      : zsh-5.0.2-31.el7.x86_64                                                                                                                                1/1 

已安裝:
  zsh.x86_64 0:5.0.2-31.el7                                                                                                                                                

完畢!

查看已安裝的包:
*第三列已顯示該包來源于本地yum倉庫

[root@localhost ~]# yum list |grep zsh
zsh.x86_64                                  5.0.2-31.el7               @yumck 

更換國內yum源:

*centos默認yum源是國外的,有時候安裝軟件速度很慢,可以更換網易yum源解決
備份系統自帶的yum配置文件:/etc/yum.repos.d/CentOS-Base.repo

[root@localhost 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@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak

wget下載對應版本的repo文件:http://mirrors.163.com/.help/CentOS7-Base-163.repo

[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

或使用curl -O:

[root@localhost yum.repos.d]# curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo

清除緩存:

[root@localhost yum.repos.d]# yum clean all

查看更換完成的yum倉庫rpm包列表:

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

安裝拓展yum源:

*當更換的國內yum倉庫或系統默認yum倉庫包不夠時,可以添加yum拓展源(由redhat官方提供的yum拓展倉庫,包數量更多)
安裝拓展源 epel-release:

[root@localhost yum.repos.d]# yum -y install epel-release

查看配置文件:
*安裝完成后可以看到目錄下增加了epel拓展源(epel.repo、epel-testing.repo)配置文件

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

查看yum倉庫rpm包列表即可顯示新增拓展源的rpm包:

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

yum下載rpm包:

*使用yum命令安裝軟件包時,系統會直接將yum倉庫的軟件包安裝到系統中

yumdownloader 命令:將yum倉庫中的rpm包下載到本地不安裝

[root@localhost ~]# yumdownloader zsh
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: hkg.mirror.rackspace.com

查看下載好的包:

[root@localhost ~]# ls       #該命令會直接把包下載到當前所在目錄
mytest  zsh-5.0.2-31.el7.x86_64.rpm  

- -resolve 參數:自動下載相關依賴包
*加上 - - resolve參數在下載目標rpm包時,會檢查包的依賴關系并下載先關依賴包

[root@localhost ~]# yumdownloader --resolve zsh
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: hkg.mirror.rackspace.com
--> 正在檢查事務
---> 軟件包 zsh.x86_64.0.5.0.2-31.el7 將被 安裝
--> 解決依賴關系完成
zsh-5.0.2-31.el7.x86_64.rpm 

- -destdir 參數:指定下載rpm包的存放目錄
*如不指定存放目錄,rpm包會存放到當前所在目錄

[root@localhost ~]# yumdownloader zsh --destdir /root/mytest/
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: hkg.mirror.rackspace.com
zsh-5.0.2-31.el7.x86_64.rpm                                                                                                                         | 2.4 MB  00:00:00     
[root@localhost ~]# ls /root/mytest/
zsh-5.0.2-31.el7.x86_64.rpm

源碼包安裝:

*以apache2.2為例,源碼包存放路徑/usr/local/src/,apache2.2安裝路徑/usr/local/apache

在安裝源碼包之前先安裝gcc編譯器:

*gcc是GNU編譯器套件(GNU Compiler Collection),它包括了C、C++、Objective-C、Fortran、Java、Ada、Go語言和 D語言的前端,也包括了這些語言的庫(如 libstdc++、libgcj等等)。

[root@localhost src]# yum -y install gcc

進入指定目錄下載apache2.2源碼包:

[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget https://ftp.bit.nl/apache/httpd-2.2.29.tar.gz 

解壓apache包:

[root@localhost src]# tar -zxvf httpd-2.2.29.tar.gz 

進入apache源碼包目錄執行如下命令:(指定安裝目錄生成makefile文件)

[root@localhost httpd-2.2.29]# ./configure --prefix=/usr/local/apache

查看上一條命令是否執行成功:(0代表成功,非0代表出錯,源碼安裝要多查看命令執行結果避免出錯)

[root@localhost httpd-2.2.29]# echo $?
0

編譯:

[root@localhost httpd-2.2.29]# make
[root@localhost httpd-2.2.29]# echo $?
0

安裝:

[root@localhost httpd-2.2.29]# make install
[root@localhost httpd-2.2.29]# echo $?
0

安裝完成:

[root@localhost httpd-2.2.29]# cd /usr/local/apache/ | ls
ABOUT_APACHE  BuildBin.dsp   config.log     docs         httpd.mak       LAYOUT        Makefile      modules.lo     README            srclib
acinclude.m4  buildconf      config.nice    emacs-style  httpd.spec      libhttpd.dep  Makefile.in   modules.o      README.platforms  support
Apache.dsw    buildmark.o    config.status  httpd        include         libhttpd.dsp  Makefile.win  NOTICE         README-win32.txt  test
build         CHANGES        configure      httpd.dep    INSTALL         libhttpd.mak  modules       NWGNUmakefile  ROADMAP           VERSIONING
BuildAll.dsp  config.layout  configure.in   httpd.dsp    InstallBin.dsp  LICENSE       modules.c     os             server
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

忻城县| 淮南市| 汉沽区| 上饶县| 云林县| 徐水县| 玉龙| 北辰区| 惠水县| 自贡市| 扶余县| 乌拉特前旗| 保靖县| 阿拉善左旗| 罗甸县| 澳门| 县级市| 西乌珠穆沁旗| 巴彦淖尔市| 平塘县| 沂源县| 漯河市| 蒲江县| 上饶市| 西乌| 广饶县| 长海县| 信丰县| 石渠县| 施甸县| 新宁县| 江源县| 广汉市| 兴安盟| 奇台县| 商丘市| 姜堰市| 赫章县| 桐城市| 沾益县| 秦安县|