Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux package installation and uninstall

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

There are three methods to install the software package under linux system:

1.rpm tool: download software rpm package installation, similar to Windows exe file

2.yum tool: similar to the app store, the advantage over rpm installation is that it is more convenient and quick, and the dependency package will be installed automatically.

3. Source code package: download the source code package to the linux system, which requires compiler compilation and installation

Usage of the rpm tool:

The format of the rpm package is as follows: (zsh is the package name, 5.0.2 is the version number, and-31.el7 is the release version number)

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

Install rpm package command: rpm-ivh package name

[root@localhost Packages] # rpm-ivh zsh-5.0.2-31.el7.x86_64.rpm preparing... # # [100%] upgrading / installing... 1:zsh-5.0.2-31.el7 # # # [100%]

Upgrade rpm package command: rpm-Uvh package name

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

* when there is a higher version of the zsh package in the system, you can use the rpm-Uvh upgrade package

Uninstall the rpm package: rpm-e package name

[root@localhost Packages] # rpm-e zsh # Uninstall the full name of the package that does not need to be written

Query the installed rpm package of the system: rpm-qa

[root@localhost Packages] # rpm-qa

Query whether the specified package is installed: rpm-Q package name

[root@localhost Packages] # rpm-Q zsh # uninstalled after installing the zsh package, so prompt not to install the uninstalled package zsh [root@localhost Packages] # rpm-Q vim-enhanced # the installed package lists the package information vim-enhanced-7.4.160-6.el7_6.x86_64

Query the details of the specified package: rpm-qi package name

[root@localhost Packages] # rpm-qi vim-enhancedName: vim-enhancedEpoch: 2Version: 7.4.160Release: 6.el7_6Architecture: x86_64Install Date: Wednesday, August 28, 2019, 11:22:18 Group: Applications/EditorsSize: 2296674License: VimSignature: RSA/SHA256, Monday, July 1, 2019, 21:34:29 Key ID 24c6a8a7f4a80eb5Source RPM: vim-7.4.160-6.el7_6.src.rpmBuild Date: Friday, June 28, 2019, 21:59:48 Build Host: x86-02.bsys.centos.orgRelocations: (not relocatable) Packager: CentOS BuildSystem Vendor: CentOSURL: http://www.vim.org/Summary: A version of the VIM editor which includes recent enhancementsDescription: VIM (VIsual editor iMproved) is an updated and improved version of thevi editor. Vi was the first real screen-based editor for UNIX, and isstill very popular. VIM improves on vi by adding new features:multiple windows, multi-level undo, block highlighting and more. Thevim-enhanced package contains a version of VIM with extra, recentlyintroduced features like Python and Perl interpreters.Install the vim-enhanced package if you'd like to use a version of theVIM editor which includes recently added enhancements likeinterpreters for the Python and Perl scripting languages. You'll alsoneed to install the vim-common package.

List the installation files of the package: rpm-ql package name

[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

Check what package the files are installed by: rpm-qf file absolute path

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

Usage of the yum tool:

Yum list: lists the rpm packages that can be installed in the yum repository

[root@localhost ~] # yum list

* the third column represents the warehouse name, with the @ symbol indicating that it has been installed

View the yum warehouse configuration file:

[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 package name: search for packages in the yum repository

[root@localhost ~] # yum search tomcat loaded plug-in: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.huaweicloud.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com==== matched S matched: tomcat = tomcat-admin-webapps.noarch: The host-manager and manager web applications for Apache Tomcattomcat-docs-webapp.noarch: The docs web application for Apache Tomcattomcat-javadoc.noarch: Javadoc generated documentation for Apache Tomcattomcat-jsp-2.2-api.noarch: Apache Tomcat JSP API implementation classestomcat-jsvc.noarch: Apache jsvc Wrapper for Apache Tomcat as separate servicetomcat-lib.noarch: Libraries needed to run the Tomcat Web containertomcat-servlet-3.0-api.noarch: Apache Tomcat Servlet API implementation classestomcat-webapps.noarch: The ROOT and examples web applications for Apache Tomcattomcatjss.noarch: JSS Connector for Apache Tomcat A JSSE module for Apache Tomcat that uses JSStomcat.noarch: Apache Servlet/JSP Engine, RI for Servlet 3.0/JSP 2.2 APItomcat-el-2.2-api.noarch: Expression Language v2.2 API

Yum list | grep package name: the second way to search for packages is to display more concise information.

[root@localhost] # yum list | grep tomcattomcat.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 package name: install package

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

Yum grouplist: lists the environment groups and extension groups that can be installed

[root@localhost ~] # yum grouplistFailed to set locale Defaulting to CLoaded plugins: fastestmirrorThere 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.comAvailable 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 WorkstationAvailable 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 ManagementDone

Yum-y groupinstall grouping name: install grouping (single quotation marks if the grouping name has more than one word)

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

Yum-y remove package name: uninstall the package

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

Yum-y update package name: update package

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

Yum provides "/ * / Command": check what package the command is installed by and the installation path

* when the command name is different from the package name, use yum list | grep package name may not find the specific information. Use yum provides to find the package name and installation path according to the command, such as: pstree command. The package name of the pstree command is psmisc.

[root@localhost ~] # yum provides "/ * / pstree" loaded plug-in: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.huaweicloud.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.compsmisc-22.20-15.el7.x86_64: Utilities for managing processes on your system Source: base matching Source: file name: / usr/bin/pstree

Yum builds local repositories:

Mount the CD with the centos image:

[root@localhost ~] # mount / dev/cdrom / mnt/gp/mount: / dev/sr0 write protection, which will be mounted as read-only

Back up the yum configuration file:

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

Empty the profile:

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

Create a new local yum warehouse profile:

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

Add the following:

[yumck] name=install yumck # Custom description character baseurl= file:///mnt/gp/ # whether the path enable=1 # of the rpm package in the warehouse is available, change to 0 and change to the warehouse to become unavailable gpgcheck=0 # whether to detect

Clear the cache:

[root@localhost ~] # yum clean all loaded plug-in: fastestmirror, langpacks is cleaning software source: yumckCleaning up list of fastest mirrorsOther repos take up 197M of disk space (use-- verbose for details)

View the packages that can be installed in the local yum repository:

[root@localhost ~] # yum list

Installation test:

[root@localhost ~] # yum-y install zsh loaded plug-in: fastestmirror LangpacksLoading mirror speeds from cached hostfile is resolving dependencies-- > checking transactions-- > package zsh.x86_64.0.5.0.2-31.el7 will be installed-- > resolve dependencies complete dependency resolution = Package schema version Source size = installing: zsh x86room64 5.0.2-31.el7 yumck 2.4 M transaction summary = installation 1 total package downloads: 2.4m installation size: 5.6MDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction is being installed: zsh-5.0.2-31.el7.x86_64 Zsh-5.0.2-31.el7.x86_64 1Acer 1 is in the process of verification: zsh.x86_64 0pur5.0.2-31.el7 is installed Over!

View installed packages:

* the third column shows that the package is from the local yum repository

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

Replace the domestic Yum source:

* centos default yum source is foreign, sometimes the installation speed of software is very slow, you can change NetEase yum source to solve the problem.

Backup the yum configuration file that comes with the system: / etc/yum.repos.d/CentOS-Base.repo

[root@localhost yum.repos.d] # lsCentOS-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 downloads the corresponding version of repo file: http://mirrors.163.com/.help/CentOS7-Base-163.repo

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

Or use curl-O:

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

Clear the cache:

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

View the list of yum warehouse rpm packages that have been replaced:

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

Install the extended yum source:

* when the replacement of the domestic yum warehouse or the system default yum warehouse package is not enough, you can add the yum extension source (the yum expansion warehouse provided by redhat officially, the number of packages is more)

Install the extended source epel-release:

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

View the configuration file:

* after the installation, you can see that the epel extension source (epel.repo, epel-testing.repo) configuration files have been added to the directory.

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

Check the list of rpm packages in yum Warehouse to display the rpm packages from the new expansion sources:

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

Download the rpm package for yum:

* when you install the software package using the yum command, the system will install the software package from the yum repository directly into the system.

Yumdownloader command: download the rpm package from the yum repository locally without installing it

[root@localhost ~] # yumdownloader zsh loaded plug-ins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * epel: hkg.mirror.rackspace.com

Check the downloaded package:

[root@localhost ~] # ls # this command downloads the package directly to the current directory mytest zsh-5.0.2-31.el7.x86_64.rpm

-- resolve parameter: automatically downloads related dependency packages

* add-- the resolve parameter checks the package dependencies and downloads the first pass dependency package when downloading the target rpm package

[root@localhost ~] # yumdownloader-- resolve zsh loaded plug-in: fastestmirror, langpacksLoading mirror speeds from cached hostfile * epel: hkg.mirror.rackspace.com-- > checking transactions-- > package zsh.x86_64.0.5.0.2-31.el7 will be installed-- > resolve dependencies and complete zsh-5.0.2-31.el7.x86_64.rpm

-- destdir parameter: specify the directory where the rpm package is downloaded

* if you do not specify a storage directory, the rpm package will be stored in the current directory

[root@localhost ~] # yumdownloader zsh-- destdir / root/mytest/ loaded plug-in: fastestmirror LangpacksLoading mirror speeds from cached hostfile * epel: hkg.mirror.rackspace.comzsh-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

Source package installation:

* take apache2.2 as an example, the path for storing the source code package / usr/local/src/,apache2.2 installation path / usr/local/apache

Install the gcc compiler before installing the source package:

* gcc is the GNU compiler suite (GNU Compiler Collection), which includes the front end of C, C++, Objective-C, Fortran, Java, Ada, Go and D languages, as well as libraries for these languages (such as libstdc++, libgcj, and so on).

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

Enter the specified directory to download the apache2.2 source package:

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

Extract the apache package:

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

Enter the apache source package directory and execute the following command: (specify the installation directory to generate the makefile file)

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

Check whether the previous command was executed successfully: (0 means success, non-0 means error. Source code installation should check the command execution results to avoid errors)

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

Compile:

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

Installation:

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

Installation completed:

[root@localhost httpd-2.2.29] # cd / usr/local/apache/ | lsABOUT_APACHE BuildBin.dsp config.log docs httpd.mak LAYOUT Makefile modules.lo README srclibacinclude.m4 buildconf config.nice emacs-style httpd.spec libhttpd.dep Makefile.in modules.o README.platforms supportApache.dsw buildmark.o config.status httpd include libhttpd.dsp Makefile .win NOTICE README-win32.txt testbuild CHANGES configure httpd.dep INSTALL libhttpd.mak modules NWGNUmakefile ROADMAP VERSIONINGBuildAll.dsp config.layout configure.in httpd.dsp InstallBin.dsp LICENSE modules.c os server

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report