I have been using Ubuntu, but I seldom use CentOS to install PHP development environment. Recently, I have been doing a lot of trouble. Last time I installed PHP7 by default on CentOS8, I had to use LNMP one-click script to install PHP5. I recently debugged a simple script to send emails, and installed PHP5 on CentOS7 by default. I tried to install PHP7 again, but this time it went well, and I am familiar with the routine of installation.

The target

Therefore, this article also documents the installation of PHP7 on CentOS7. The main idea is to configure the software source, and then specify the software source to install the specific package.

version

The machine

Linux distribution: CentOS7

Software to be Installed

PHP7

steps

Displays the configured source

sudo yum repolist
Copy the code

The plug-in fastestmirror Loading mirror speeds from cached hostfile is loaded

  • remi-safe: mirror.innosol.asia

Source ID Indicates the status of the source name

7 / base/x86_64 CentOS – 7, 10097

Epel/X86_64 Extra Packages for Enterprise Linux 7-X86_64 13,224

extras/7/x86_64             CentOS-7                                                           341

Remi-safe safe remi’s RPM repository for Enterprise Linux 7-x86_64 3,693 updates/7/x86_64 centos-7,787

Repolist: 29142

As above, this is a few sources displayed after installation. There are two main points here: epel, Remi, we need to install phP-related software, these two are necessary. And reMI relies on EPEL, so install the EPEL first, and if not, install the two in sequence.

Install the EPEL

EPEL is a repository for Extra Packages for Enterprise Linux. EPEL is a repository for Extra Packages for Enterprise Linux. EPEL is a repository for Extra Packages for Enterprise Linux, and is designed specifically for RHEL. So if you use RHEL, CentOS, Scientific and other RHEL system Linux, you can be very safe to use EPEL yum source.

sudo yum install epel-release
Copy the code

Install REMI

rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
Copy the code
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Copy the code

Note: the end of the second command 7 represents CentOS release 7, and so on, 8 can be replaced with 8

Check whether REMI is successfully installed

By default, REMI is disabled. To check whether the installation is successful, run the following command:

yum repolist disabled | grep remi
Copy the code

Version specific installation

If the software source is disabled by default, you need to display a statement specifying the software source. The command is as follows:

Yum --enablerepo= Software source name install Software packageCopy the code

Similarly, search for a software name keyword that can be installed in a software source, as follows:

Sogou.com yum --enablerepo= software source search keywordCopy the code

conclusion

Enjoy it!