Install Docker and deploy WordPress blog system, and install and deploy Docker

One year ago (2023-11-27) Chief Editor
16 minutes
three hundred and six
zero

Install Docker and deploy WordPress blog system

View the version of the system

Docker requires 64 bit CentOS 7

cat /etc/redhat-release

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

uname -r

Uninstall all relevant old versions on this machine

yum remove docker

docker-client

docker-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 software package for Docker

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/linux/centos/docker-ce.repo

Update yum software source cache and install docker ce

yum makecache fast yum install -y docker-ce

View Docker Version

docker  --version

Start Docker CE

systemctl enable docker systemctl start docker

Add the current user to the docker group

usermod -aG docker $USER

Test whether the Docker is installed correctly

docker run hello-world

Image acceleration

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

Write the following contents in/etc/locker/daemon. json (if the file does not exist, please create a new one)

{     "registry-mirrors": [" //registry.docker-cn.com "] }

Restart service

systemctl  restart  docker

Update the system environment

yum update -y

Restart CentOS 7 operating system

reboot

Start Docker service

systemctl start docker

Add the service to the startup item

systemctl enable docker

Search lamp images to find images with more than 10 stars praised by everyone

docker search -s 10 lamp

Pull the selected image, and select the tutum/lamp image here

docker pull docker.io/tutum/lamp

Check whether the image is pulled successfully

docker images

Create a blank directory locally to mount a data volume

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 MySQL database

mysql_secure_installation

Follow the wizard to complete initialization

Enter current password for root (enter for none):<– Enter for the first run

 Set root password? [Y/n]<– Whether to set the root user password, enter y and enter or enter directly

New password:<– Set the password of root user

Re enter new password:<– Enter the password you set again

Remove anonymous users? [Y/n]<- Whether to delete anonymous users, press Enter

Disallow root login remotely? [Y/n]<– Whether to disable root remote login, select n, and then 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, enter

Open MySQL

MySQL - uroot - p Enter the password set previously

Create Database

create database wp;

Exit MySQL

q

Update apt tool

apt update

Switch to the main directory of the Apache site

cd /var/www/html

Install wget tool

apt install -y wget

Download Wordpress compressed package from official website through wget tool

wget //cn.wordpress.org/wordpress-4.7.4-zh_CN.tar.gz

Extract the downloaded compressed package to the current directory

tar zxf wordpress-4.7.4-zh_CN.tar.gz -C ./

Exit Container

Ctrl + p

Ctrl + Q

View the local IP address and obtain the address to access the wrodpress website

ifconfig

Access through the browser to enter the wp installation configuration page

//:8080/wordpress

Troubleshooting of configuration failure:

-------------------------------------------------------------------------------------

Enter the container

docker exec -it mylamp /bin/bash

Enter the wp configuration directory

cd  /var/www/html/wordpress

New Profile

vi  wp-config.php

Copy and paste the configuration information provided by the page into the file

Note: In order to avoid garbled code, Chinese notes can be deleted in advance

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[+P!eb9[ czr@B }  6$8`f3V4); 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!.+ 4sO6u8J|  (~); define(AUTH_SALT, TP::6.oWlTEM4Jnd2`x];2Cz6[,-YDr(-V5%l*kYFlr-<8h|

define(SECURE_AUTH_SALT, *<^uhi,..li@

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+~3VB0T[6bCZGLfK-_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);

User name/password: ml/1111

This article is written by: Chief Editor Published on Software Development of Little Turkey , please indicate the source for reprinting: //hongchengtech.cn/blog/774.html
Kuke_WP editor
author

Related recommendations

One year ago (2023-11-27)

12 WordPress enterprise theme templates are recommended! WordPress can be built without writing code!, Wordpress setup

When many companies choose WordPress to build their websites, they often don't know which theme is easy to use. There are too many WordPress corporate themes in the market for everyone to choose, but they always hesitate to make a decision. Here we have carefully sorted out 12 WordPress corporate themes, covering all walks of life
four hundred and forty-eight
zero
One year ago (2023-11-27)

Inventory of WordPress themes on online course website (updated in 2020), free WordPress themes

To build an online education platform using the WordPress website building program, it is not only necessary to choose a better virtual host provider, but also the most important thing is to use a core online course plug-in, and a powerful WordPress theme can also improve students' learning experience. Learn more about WordPre
four hundred and forty-eight
zero
One year ago (2023-11-27)

Count the domestic excellent WordPress themes and wordpress excellent themes

WordPress originates from abroad, is easy to use, and is very popular, making more and more websites in China start to use WordPress website building programs. There are also many powerful experts or teams in China who have developed WordPress Chinese themes. This article details the outstanding WordPress themes in China. I Begin Theme
six hundred and thirty-eight
zero
One year ago (2023-11-27)

Best WordPress theme list in 2022 (free and paid), Wordpress resource network theme

When building a WordPress website, should you use a free theme or an advanced theme? What types of functions do you need, and how advanced do you want your website to be? These are all good questions. You need to explain before you spend money on WordPress topics. This is why we need to know all the details of the selected theme, and cover the topics from several
three hundred and ninety-three
zero

comment

0 people have participated in the review

Scan code to add WeChat

contact us

WeChat: Kuzhuti
Online consultation: