Install Docker and deploy WordPress blogging system

View the system version

Docker requires 64-bit CentOS 7

The cat/etc/redhat – release

Check the kernel version. Docker requires that the Linux kernel version be higher than 3.10

Uname -r

Uninstall all relevant older versions on this machine

Yum remove docker \

Docker – client \

Docker – the client – latest \

Docker – common \

Docker – latest \

Docker – latest – logrotate \

Docker – logrotate \

Docker – selinux \

Docker – engine – selinux \

Docker – engine

Install the yum utility and the necessary Docker packages

Yum install – y yum – utils \

Device mapper – persistent – data \

lvm2

Configure domestic Docker image resources (University of Science and Technology of China)

Yum – config – manager \

— add-repo\mirrors.ustc.edu.cn/docker-ce/l…

Update the yum software source cache and install docker-CE

Yum makecache fast yum install-y docker-ce

Check the version of Docker

Docker – version

Start the Docker CE

Systemctl enable docker systemctl start docker

Add the current user to the Docker group

Usermod – aG docker $USER

Test whether Docker is installed correctly

Docker run the hello world

Mirror to accelerate

Docker China official image acceleration can be accessed at registry.docker-cn.com. Currently the library contains only popular public images, while private images still need to be pulled from the US library.

Write the following to /etc/docker-daemon. json (create a new file if it doesn’t exist)

{” registry – mirrors “:” registry.docker-cn.com “]}

Restarting the service

Systemctl restart docker

Update the system environment

Yum update – y

Restart the CentOS 7 OS

reboot

Start the Docker service

Systemctl start docker

Add the service to the boot option

Systemctl enable docker

Search lamp images for those with more than 10 “likes”

Docker search -s 10 lamp

Pull the selected image, in this case the tutum/lamp image

Docker pull docker. IO/tutum/lamp

Check whether the mirror is pulled successfully

Docker images

Create a blank directory locally for mounting a data volume

The mkdir/mysql_data

Create and start a container

Docker run-d–name=mylamp-p 8080:80-p 3306:3306-v/mysql_data:/var/lib/mysql docker. IO /tutum/lamp

Enter the container

Docker exec – it mylamp/bin/bash

Initialize the MySQL database

mysql_secure_installation

Follow the wizard to complete the initialization

Enter current password for root(Enter for None):< – Press Enter for the first time

Set the root password? [Y/n]< – Specifies whether to set a password for user root. Enter Y and press Enter or press Enter

New password:< – Set the password of user root

Re-enter new password:< — Enter your password again

Remove anonymous users? [Y/n]< – Press Enter to delete anonymous users

Disallow root login remotely? [Y/n]< – To disable root remote login, select n and press Enter

Remove test database and access to it? [Y/n]< – Whether to delete the test database, press Enter

Reload privilege tables now? [Y/n]< – Whether to reload the permission table, press Enter

Open the MySQL

Mysql -uroot-p Enter the password previously set

Creating a database

The create database wp.

Exit the mysql

\ q

Update APT Tools

Apt update

Switch to the Apache site home directory

CD/var/WWW/HTML

Install the WGET tool

Apt install wget – y

Use the wget tool to download the WordPress package from the official website

Wget cn.wordpress.org/wordpress-4…

Decompress the downloaded package to the current directory

Tar ZXF wordpress – 4.7.4 – zh_CN. Tar. Gz – C /

Out of the container

Ctrl + p

Ctrl + Q

Check your local IP for an address to access the WrodPress web site

The ifconfig

The WP installation and configuration page is displayed

http:// < IP address > : 8080 / wordpress

Configuration failure troubleshooting:

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Enter the container

Docker exec – it mylamp/bin/bash

Access the WP configuration directory

CD/var/WWW/HTML/wordpress

Creating a Configuration File

Vi wp – config. PHP

Copy and paste the page provisioning configuration information into this file

Note: In order to avoid garbled characters, Chinese annotations can be deleted in advance

<? php define(‘DB_NAME’,’wp’);

Define (‘ DB_USER ‘, ‘root’);

Define (‘ DB_PASSWORD ‘, ‘1111’);

Define (‘ DB_HOST ‘, ‘localhost’);

Define (‘ DB_CHARSET ‘, ‘utf8mb4’);

Define (‘ DB_COLLATE ‘, ‘);

Define (‘ AUTH_KEY ‘, ‘XfI2! &IN? sZJ]W>jMy):CRGP 2%ys-? dCAI.Bk lDPgoh8tj-SNO*D.I/wBgfvey’);

Define (‘ SECURE_AUTH_KEY ‘, ‘^ % H/yvk_F? B< Mk6LR; _1}Rk CI.M4i^jqQ:]c_~> [+P!eb9[czr B}6$8f3V4’);define(‘LOGGED_IN_KEY’,’x2M)5xUfiD/mDZBsXV?EHa>sRHNd$2NMQrz_{Z&M-Fddf{gk%*odMBm7l+uS#~BT’);

Define (‘ NONCE_KEY ‘, ‘6 ~ > X: j = j {SabQAO} s_; Oy! [rR + + < Fen2NS | j4V YVMzXj (9, 3 # AR & > 4 so6u8j | (~ ‘); define (‘ AUTH_SALT ‘, ‘TP: : 6. OWlTEM4Jnd2 ` x]; 2Cz6[,-YDr(-V5%l*kYFlr-<8h|<y1so pi7=(S/1=a’);

Define (‘ SECURE_AUTH_SALT ‘, ‘* (NNG. UntS0TFTpqwGpGf5O < ^ uhI,.. lI <FN? m^F&J=%DGTwjhOb:[:5fu9JPBv’);

Define (‘ LOGGED_IN_SALT ‘, ‘Fo? B6AQG%6O+-u]SR2asQ#h/BVB=h}XuS?? 2Ii^h^1xD5,; 52++5n td7qOZYUB7’);

Define (‘ NONCE_SALT ‘, ‘~ Vt4 ^ {Sgmxb / * oTeP > k > CjJm – N + ~ 3 vb0t [6 BCZGLFK – FRsEJsWCuf_iY5n % D) [F’); $table_prefix = ‘wp’;

Define (‘ WP_DEBUG, false); define(‘WP_ZH_CN_ICP_NUM’,true);

If (! defined(‘ABSPATH’))

Define (‘ ABSPATH ‘dirname (FILE).’/’);

Require_once (ABSPATH. ‘wp – Settings. PHP);

Username/password: ML /1111