Fast installation of php7.4 Suite (CentOS 8)


Fast installation of php7.4 Suite (CentOS 8)

Only CentOS 8 is considered in this paper

This paper was written on November 14, 2020

Remi is a PHP installation repository. It’s the RPM package.

How fast is it? The following software installation time is about 2 minutes (excluding the operating system).

Each software version in this paper

centos 8
php 7.4.12
nginx 1.18
mysql 8.0.21
redis 5.0.3 
git 2.18.4

First, install Alibaba’s CentOS warehouse. (centos 8)

curl -o /etc/yum.repos.d/CentOS-Base.repo
rm -f  /etc/yum.repos.d/CentOS-centosplus.repo
rm -f  /etc/yum.repos.d/CentOS-PowerTools.repo
rm -f  /etc/yum.repos.d/CentOS-Extras.repo
rm -f  /etc/yum.repos.d/CentOS-AppStream.repo
dnf makecache
dnf repolist

Install Alibaba’s EPEL warehouse. (centos 8)

dnf install -y epel-release

sed -i 's|^#baseurl=|baseurl=|' /etc/yum.repos.d/epel*

sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
dnf makecache
dnf repolist

The warehouse for installing Ali’s Remi (CentOS 8)

dnf install -y

sed -i  's/https*:\/\/\/\/\/remi/g'  /etc/yum.repos.d/remi*

sed -i 's/#baseurl/baseurl/g' /etc/yum.repos.d/remi*

Fast as lightning is the key to the next sentence, clear the image list!! Otherwise, I will read the foreign image again.

sed -i 's|^mirrorlist|#mirrorlist|' /etc/yum.repos.d/remi*

dnf makecache
dnf repolist

Install PHP (CentOS 8)

dnf install -y yum-utils

dnf install -y php74 php74-php-devel  php74-php-fpm  php74-php-mbstring php74-php-memcache php74-php-memcached php74-php-redis  php74-php-mysqlnd  php74-php-pdo  php74-php-bcmath php74-php-xml php74-php-gd php74-php-gmp php74-php-igbinary php74-php-imagick   php74-php-mcrypt  php74-php-pdo_mysql php74-php-posix php74-php-simplexml  php74-php-opcache php74-php-xsl php74-php-xmlwriter php74-php-xmlreader php74-php-swoole php74-php-zip php74-php-phalcon  php74-php-yaml php74-php-yar php74-php-yaf php74-php-uuid

Experience the speed as fast as lightning!

Install Alibaba’s composer image source (CentOS 8)

ln -s /usr/bin/php74 /usr/bin/php

curl -o /usr/local/bin/composer

chmod +x /usr/local/bin/composer

Pay attention to the observation, confirm that the installation is successful, and the large version is 2.0

composer -V

Immediately set the image source of composer to Ali

composer config -g repo.packagist composer

Install nginx and integrate PHP FPM service (CentOS 8)

#The following echo is a command that needs to be copied together

/etc/nginx/conf.d/ default.conf The contents of the document are as follows

server {
    listen       80;
    server_name  localhost;
    charset utf-8 ;
    access_log  /var/log/nginx/host.access.log  main;
    root   /usr/share/nginx/html;
    index index.php  index.html index.htm;
    error_page 404  500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    location ~ \.php$ {
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
        include        fastcgi_params;

Add a PHP file as follows:

vi /usr/share/nginx/html/1.php


Start PHP FPM and nginx and verify that they are installed correctly

systemctl start nginx

Install MySQL 8 (CentOS 8)

Actually, the image of Ali is also used, because it is downloaded from the appstream library.

dnf install -y @mysql
systemctl enable mysqld
systemctl start mysqld
mysql -uroot

The above command will log in.

Note: the default account root of MySQL service installed with this method, and the default password is empty

Install redis, GIT and other common libraries (CentOS 8)

dnf install -y  git wget vim redis zip unzip p7zip rsync crontabs supervisor net-tools python3
systemctl enable redis
systemctl start redis

Summary (CentOS 8)

With the domestic image will be extremely fast, download package speed: 3MB / s, amazing fast!

No matter docker or CentOS environment is very fast!!

The whole installation process is eating and drinking Ali. I really want to sing a folk song to Ali~

This work adoptsCC agreementReprint must indicate the author and the link of this article

Recommended Today

Build HTTP service with C + + Mongoose

Mongoose source code address:… Mongoose user manual:… Mngoose set up HTTP service #include <string> #include “mongoose.h” using namespace std; static const char *s_http_port = “8000”; static void ev_handler(mg_connection *nc, int ev, void *ev_data) { struct http_message *hm = (struct http_message *) ev_data; if (ev == MG_EV_HTTP_REQUEST) { std::string uri; if (hm->uri.p && hm->uri.p[0] == ‘/’) […]