Set up centos

  • Above all you need to have own server, this you can apply for Tencent and Ali’s 1G1 core is ok.
  • Use virtual machine to install centos7 latest good, so that the pit more convenient.
  • Centos recommended to use xshell or iterm, modify domestic 163 yum source, aliyun source pit don’t go, in order to execute a command

Wget – O/etc/yum. Repos. D/CentOS – Base. Repo mirrors.163.com/.help/CentO… yum clean all yum makecache yum -y update

Build docker

Example Set the Docker CE resource library

Yum install – y yum – utils to yum – config manager – add – repo download.docker.com/linux/cento… sudo yum makecache fast

Install the docker

sudo yum -y install docker-ce

Start the docker

sudo systemctl start docker

Set up the wordpress

* Download the latest wordpress tar package at cn.wordpress.org/

  • Log in to the server and decompress the installation package to the corresponding data directory

[root@docker ~]# tar ZXVF wordpress-5.4.1- zh_cn.tar. gz -c data/app/ WWW / [root@docker ~]# ls data/app/ WWW/HTML index.html wordpress

  • Log in to the server to create the Docker network mode

[root@docker ~]# docker network create lnmp 2b4217d39d5e438f1012c39a892053460c8cddf4d2f59e8e24161617fd3834b1 [root@docker ~]# docker network ls NETWORK ID NAME DRIVER SCOPE e954af0a31d1 bridge bridge local 8ec99c72fcb1 host host local 2b4217d39d5e lnmp bridge local a35525e0158b none null local [root@docker ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 64639d9f9ec7 richarvey/nginx-php-fpm “docker-php-entrypoi… 5 minutes ago Up 5 minutes 443/ TCP, 9000/ TCP, 0.0.0.0:88->80/ TCP lnmp_web

  • Create the PHP environment container

[root@docker ~]# docker run -itd –name lnmp_web –net lnmp -p 9528:80 –mount type=bind,src=/data/www,dst=/var/www/html richarvey/nginx-php-fpm

[root@docker ~]# ls /www/ html index.html

  • accesshttp://IP:88/wordpressCan be

Change the database password in PHP

[root@docker ~]# cp/WWW /wordpress/wp-config-sample. PHP /app/ WWW /wordpress/wp-config. PHP cp: [root@docker ~]# cp/WWW /wordpress/wp-config. PHP Whether to cover “/ app/below/wordpress/wp – config. PHP”? y

[root@docker ~]# vim /app/wwwroot/wordpress/wp-config.php

Set up the mysql

  • Create a mysql database container

[root@docker ~]# docker run -itd –name lnmp_mysql –net lnmp -p 9527:3306 –mount src=mysql-vol,dst=/var/lib/mysql -e MYSQL_ROOT_PASSWORD=matrix@123 mysql 62a0bccd72a303f4c375a36f5523b6383aeb0c6a76c358c59410bf022622c5f5

  • You can view the data volume of MySQL

[root@docker ~]# docker volume ls DRIVER VOLUME NAME local mysql-vol

  • Mysql data is stored in this data volume directory

/ root @ docker ~ # ls/var/lib/docker/volumes/mysql – vol / _data while forming/check mysql log [root @ docker _data while forming] # docker logs lnmp_mysql [root@docker _data]# docker top lnmp_mysql

  • Create the required database

[root@docker mysql]# docker exec lnmp_mysql sh -c ‘exec mysql -uroot -pmatrix@123 -e”create database wp”‘ [root@docker mysql]# yum install mysql [root@docker ~]# mysql -h192.168.30.22 -uroot -p Enter password:

  • Error:

ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password’ cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory may be caused by the mysql version

  • The solution

[root@docker ~]# docker exec -it lnmp_mysql bash

root@63259bee4195:/# mysql -uroot -p123456

mysql> alter user ‘root’@’%’ identified with mysql_native_password by ‘root’; Query OK, 0 rows affected (0.04 sec)

[root@docker ~]# mysql -h192.168.30.22 -uroot -p

Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 22 Server version: MySQL Community Server – GPL Copyright (C) 2000, 2018, Oracle, MariaDB Corporation Ab and Others. Type ‘help; ‘ or ‘\h’ for help. Type ‘\c’ to clear the current input statement. MySQL [(none)]> show databases; +——————–+ | Database | +——————–+ | information_schema | | mysql | | performance_schema | | sys | | wp | + — — — — — — — — — — — — — — — — — — — — + 5 rows in the set (0.02 SEC)