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

Software package Management and Source Code installation of Software under linux

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. What is a software package?

A software package is a product of packaging applications, configuration files, and management data.

2. There are two basic software package management tools commonly used under Linux: dpkg tool and RPM tool. Corresponds to two different formats of software packages, namely, .deb format and .rpm format. The dpkg package tool is mainly used in Debian and Ubuntu distributions. The RPM tool is used in most Linux distributions, such as Red Hat, openSUSE, and so on.

3. When installing software using dpkg and rpm tools, you need to consider the dependence of the software. Only when all the libraries and supports that the application depends on have been installed correctly, the software can be installed correctly.

4. Common options for dpkg tools:

-- install (- I): installs a specific package. This option removes the old version from the system before installing the package.

-- force: force installation of software packages. The system ignores all dependencies and compatibility issues until the package is "installed". Please use it with caution.

-l: view installed packages. Assuming that you need to find OpenSSH version information on the current system, you can use the following command: dpkg-l | grep openssh.

-- search (- S): see which files are copied to the system by the installed package. Take OpenSSH as an example: dpkg-S openssh.

-- remove (- r): uninstall the installed package. The name of the software package is required to uninstall and install the software. For example, to uninstall the Opera browser installed on the system, first use dpkg-l | grep opera to view the package information of the opera browser, and then use sudo dpkg-- remove opera to delete the opera browser.

Note: the uninstalled package may contain libraries and data files that other software depends on, in which case the uninstall may lead to unpredictable consequences. Therefore, make sure that all dependencies have been resolved or use more advanced package tools before uninstalling.

5. Common options for RPM tools:

-ivh: install the software package. Note that this is a combination of three options. -I is used to install a software package. -v is used to show what rpm is currently doing. -h remind the user of the current installation progress by printing a series of "#".

-- force: ignore all dependencies and compatibility issues and forcibly install the software package.

-- nodeps: causes rpm to ignore package dependency conflicts and continue to install the package. Package dependency conflicts occur when the package you are installing works only with the support of some other packages.

-U: used to upgrade a software package. Usually used together with-v and-h (that is,-Uvh). The upgrade operation is actually a combination of uninstall and installation. When upgrading software, rpm first uninstalls the old version of the package, and then installs the new version of the package. The upgrade operation of rpm retains the configuration file of the software.

-Q: view installed packages.

-e: uninstall the package. This command takes the name of the package as an argument without version information.

-- test: rpm is required to simulate the whole process of deleting a package, but does not actually perform the delete operation.

6. Advanced software package tool: APT (Advanced Package Tool).

(1) APT can automatically detect software dependency problems, download and install all files. You don't need to install dependent components one by one, as you do with dpkg and rpm tools.

(2) when the system starts for the first time, you need to run apt-get update to update the package information in the cache, and after that, you can use the apt-get install command to install the package. It is recommended that you run apt-get update every time you install and update your software to ensure that the packages you get are up to date.

(3) Common options:

Apt-get: used to perform all operations related to package installation.

Apt-cache: used to find information about software packages.

Apt-get install: download and install the package.

Apt-get upgrade: download and install the latest version of the software package already available on this system.

Apt-get remove: uninstall a specific package.

Apt-get source: download specific software source code.

Apt-get clean: delete all downloaded package files.

Apt-get-h: lists the full usage of apt-get.

Apt-cache search: search for specific packages in the package list.

Apt-cache depends: lists the dependencies of a specific software package.

7. Compile and install software from source code:

(1) there is no absolute process for compiling and installing software from source code, and different software has different compiling methods, but the basic idea is the same.

(2) compiling and installing software from source code usually gives the compiler more control, such as where the software is installed, enabling and disabling some functions of the software, and so on.

(3) the general steps are as follows:

A: download the source code of the required installation software from the Internet. Under Linux, compressed formats such as ".tar.bz2" and ".tar.gz" are standard formats for publishing source code.

B: use the decompression tool to extract the source code.

C: use the configure script to personalize the software according to the installation document README or INSTALL provided by the software. All software on Linux uses the script configure to configure software released in source code. Configure generates the corresponding makefile file according to the relevant parameters provided by the user, and then makefile instructs the make command to compile the software correctly.

D: compile using the make tool. Make is an advanced compilation tool that invokes the appropriate compiler to compile source code according to the rules in the makefile file. Because large software is always composed of a large number of modules, the links between source code files are so complex that it is impossible to compile these files one by one. Using the make tool, you can follow predetermined steps to automate all of this.

E: run make install to configure the installation software according to step c.

(4) if there is a problem, do not panic, this is normal, you should first read the installation documentation, and then look for relevant information on the Internet to solve the problems encountered step by step.

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