captions

Legend has it that a collection of dragon balls can summon the divine dragon.

Laravel, a common PHP development framework, is surprisingly uniform in large versions, both 8. Centos 8, PHP 8, mysql 8, Laravel 8. (Pretend not to know that Ubuntu is also widely used.)

The advantage of using Linux is that the development environment and deployment environment are highly unified, and the popularity of Windows 10 and Docker makes it easy for all PHP programmers to develop in Linux environment on Windows and MAC computers. At the same time, the existence of Alibaba open source mirror station makes the installation of all the software required only about 2 minutes, has been convenient to describe. That’s why I’m writing this series.

The following is a list of the major releases of the four categories of software at 8.

Each software version of this article

Centos 8.2 PHP 8.0.0 mysql 8.0.21 laravel 8.16.1Copy the code

First, install Ali’s centos warehouse. (8) centos

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.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
Copy the code

Install ali’s EPEL warehouse. (8) centos

dnf install -y epel-release
sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
dnf makecache
dnf repolist
Copy the code

Install Ali remi’s warehouse (centos 8)

dnf install -y https://mirrors.aliyun.com/remi/enterprise/remi-release-8.rpm
sed -i  's/https*://rpms.remirepo.net/https://mirrors.aliyun.com/remi/g'  /etc/yum.repos.d/remi*
sed -i 's/#baseurl/baseurl/g' /etc/yum.repos.d/remi*
sed -i 's|^mirrorlist|#mirrorlist|' /etc/yum.repos.d/remi*
dnf makecache
dnf repolist
Copy the code

Install PHP 8 (centos 8)

dnf install -y yum-utils
dnf install -y php80 php80-php-devel  php80-php-fpm  php80-php-mbstring php80-php-memcached php80-php-redis  php80-php-mysqlnd  php80-php-pdo  php80-php-bcmath php80-php-xml php80-php-gd php80-php-gmp php80-php-igbinary php80-php-imagick php80-php-pdo_mysql php80-php-posix php80-php-simplexml  php80-php-opcache php80-php-xsl php80-php-xmlwriter php80-php-xmlreader php80-php-swoole php80-php-zip  php80-php-yaml php80-php-uuid
Copy the code

Experience lightning-fast speed!

Phalcon php80-php-yar php80-php-yaf php80-php-memcache php80-php-mcrypt php80-php-mcrypt phalcon php80-php-yaf php80-php-yaf

Mysql > Install Composer (centos 8)

ln -s /usr/bin/php80 /usr/bin/php
curl -o /usr/local/bin/composer https://mirrors.aliyun.com/composer/composer.phar
chmod +x /usr/local/bin/composer
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
Copy the code

Install nginx and integrate PHP-FPM service (centos 8)

The following echo is a command that must be copied together

dnf makecache
dnf install -y nginx
systemctl enable nginx
systemctl enable php80-php-fpm
sed -i 's/user = apache/user = nginx/g' /etc/opt/remi/php80/php-fpm.d/www.conf
sed -i 's/group = apache/group = nginx/g' /etc/opt/remi/php80/php-fpm.d/www.conf
sed -i 's/listen = /var/opt/remi/php80/run/php-fpm/www.sock/listen=9000/g' /etc/opt/remi/php80/php-fpm.d/www.conf
rm -f /etc/nginx/conf.d/default.conf
vi /etc/nginx/conf.d/default.conf
Copy the code

The/etc/nginx/conf. D/default. The conf file content is as follows

server { listen 80; server_name localhost; charset utf-8 ; access_log /var/log/nginx/host.access.log main; root /www/blog/public; index index.php index.html index.htm; error_page 404 500 502 503 504 /50x.html; location = /50x.html { root /www/blog/public; } location / { try_files $uri $uri/ /index.php? $query_string; } location ~.php${fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; }}Copy the code

Install mysql 8 (centos 8)

Ali’s image was actually used as well, because it was downloaded from the AppStream library and was extremely fast.

dnf install -y @mysql
systemctl enable mysqld
systemctl start mysqld
mysql -uroot
Copy the code

Mysql -uroot, this command is used to log in to the mysql server. Create an empty database named Laravel and quit.

create database laravel default charset utf8mb4;
Copy the code

Install Redis, Git, and other popular 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
Copy the code

Install laravel (centos 8)

Ali’s mirror is actually used, because the composer’s mirror source is already set. Suppose the project is called blog and installed under the/WWW directory

mkdir -p /www cd /www composer create-project --prefer-dist laravel/laravel blog "8.*" rm -f ./blog/routes/web.php vi ./blog/routes/web.php <? php use IlluminateSupportFacadesRoute; Route::get('/', function () { ob_start(); phpinfo(INFO_GENERAL); $s = ob_get_contents(); ob_clean(); $system = preg_replace( '#^.+? Build.System.</td><td class="v">([^<]+?) <.+$#s','$1',$s ); echo "operating system: ".$system."<br>n"; echo "php: ".phpversion()."<br>n"; echo "laravel: " . app()::VERSION."<br>n"; $dbversion = DB::select("select version() v"); echo "mysql: " . $dbversion[0]->v."<br>n"; });Copy the code

Start phP-Fpm and nginx and verify that they are installed correctly

systemctl start nginx
systemctl start php80-php-fpm
curl localhost/
Copy the code

You should see output similar to the following:

Mysql: Operating System: Red Hat Enterprise Linux Release 8.2 (Ootpa) <br> 8.0.21 < br >Copy the code

Original text: learnku.com/articles/51…