Home >Operation and Maintenance >CentOS >Can centos install software?

Can centos install software?

WBOY
WBOYOriginal
2022-04-01 16:27:166976browse

centos can install software. Installation method: 1. Use yum to install, the syntax is "yum install -y software name"; 2. Use rpm to install, the syntax is "rpm -i package file name to be installed"; 3. Install the software through source code package compilation, compile The compiler compiles the source code and generates an executable binary file.

Can centos install software?

The operating environment of this article: centos 7 system, Dell G3 computer.

Can centos install software?

There are three main ways to install software in centos

1. The simplest and most convenient way is to use the yum command

安装:yum install -y 软件名
更新:yum update -y 软件名
卸载:yum remove -y 软件名 或 yum erase -y 软件名

If it is installed by yum method, you can use yum list installed to search. If you are looking for a specified package, add | grep "software name or package name" after the command;

[root@localhost ~] yum list installed | grep ruby

But you need to pay attention. It seems that not all software can be installed directly using the yum command. For example, when installing nginx, because nginx is located in the third-party yum source and not in the centos official yum source, you can switch the source or need to install epel first. You can choose to install epel directly. yum install epel-release installation, you can also use the rpm method introduced below, go to the epel official website to download the corresponding rpm package and install it through the rpm command.

2. A little more complicated, use the rpm method,

rpm in English is redhat package manager, which is the management of redhat software packages.

rpm is a set of management programs that install the required packages on the Linux host in a database record manner. That is to say, there is a database about rpm in the Linux system, which records the dependencies between installed packages and packages. The rpm package is a binary file that is pre-compiled and packaged on the Linux host. It saves the compilation and other processes of source code package installation described below, and it is very fast to install.

Command:

rpm -i 需要安装的包文件名

For example:

rpm -i example.rpm 安装 example.rpm 包; 
rpm -iv example.rpm 安装 example.rpm 包并在安装过程中显示正在安装的文件信息; 
rpm -ivh example.rpm 安装 example.rpm 包并在安装过程中显示正在安装的文件信息及安装进度;

Can centos install software?

3. Compile and install the software through the source code package

Source code package: The source code of the program software (generally also called Tarball, which is a resource package in which the source code of the software is packaged in tar and then compressed).

Binary package: such as the .rpm package of Red Hat distribution and the .deb package of Debian distribution. The binary package is generated after the source code package is compiled.

The approximate installation process of the source code package:

Get the source code package of the software->Compile the source code through the compiler->Generate executable Binary file

(1) Obtain the source code package of the software: You can download it directly from the corresponding official website, or you can obtain it through the wget command as before. The downloaded source code package is generally a tar package compressed with gzip. , the suffix is ​​.tar.gz. Go to the directory of the source package and execute tar -xzvf to unpack the package, such as:

#tar -xzvf apache_1_3_6_tar.gz. This will create a new directory in the current directory (the directory name is similar to the file name of the .tat.gz package) to store the decompressed content. In this example it is apache_1.3.6. Generally speaking, the /usr/src directory stores system-level source code directories, and the /usr/local/src directory stores user-level source code directories.

Detailed process of source package installation:

Can centos install software?

#(2) The path followed by –prefix in the second step in the above figure indicates that the software will be installed Which directory to go to? If the parameter –prefix=/path is not specified, it usually defaults to /usr/local. I recommend that the installation location is /usr/local/XXX, and XXX is your actual directory, which will facilitate future management.

(Configure is an executable script with many options. Use the command ./configure –help in the source code path to be installed to output a detailed list of options.

The –prefix option is Configure the installation path. If this option is not configured, the executable files will be placed in /usr/local/bin by default after installation, the library files will be placed in /usr/local/lib by default, and the configuration files will be placed in /usr/local/etc by default. Other resource files are placed in /usr/local/share, which is quite messy.

If you configure –prefix, such as:

./configure –prefix=/usr/local/test

You can put all resource files in /usr/local/test There will be no clutter in the path.)

Recommended tutorial: "centos tutorial"

The above is the detailed content of Can centos install software?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Can centos7 use Oracle?Next article:Can centos7 use Oracle?