Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use docker to set up wordpress blog and trample record in centos7

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how to use docker in centos7 to establish wordpress blog and trampling record. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.

First of all, the premise preparation.

1. Install docker. You can search for installation tutorials in rookie tutorials.

two。 Install python3 environment, because python2 is pre-installed in centos, so you need to download and reconfigure it.

3.docker installs the .yml file of wordpress

Content:

1. Install docker

Install python3 environment under 2.centos7 environment

2.1 installation

2.1.1. Installation depends on the environment

2.1.2 install pip and install wget with pip

2.1.3 download installation package for wget

2.1.4 compile and install

2.1.5 establish a soft link for python3

2.2 partial pit record

2.2.1

3.docker installs the .yml file of wordpress

3.1 docker-compose installation

3.2Last docker-compose.yml file

Update and add:

Problem 1:docker-compose cannot be installed, docker-compose version command does not exist cd / usr/local/bin/wget https://github.com/docker/compose/releases/download/1.14.0-rc2/docker-compose-Linux-x86_64rename docker-compose-Linux-x86_64 docker-compose docker-compose-Linux-x86_64chmod + x / usr/local/bin/docker-compose

Reference: https://blog.csdn.net/countofdane/article/details/95206131

Question 2: error report during installation of docker-compose ERROR: Command errored out with exit status 1: command: / usr/bin/python2-c 'import sys, setuptools, tokenize; sys.argv [0] =' "'" / tmp/pip-install-zItSn5/pycparser/setup.py' "; _ _ file__='"/ tmp/pip-install-zItSn5/pycparser/setup.py'"' F=getattr (tokenize,''open', open) (_ _ file__); code=f.read (). Replace ('\ r\ n','\ n'); f.close () Exec (compile (code, _ file__,'"''exec'"' ")) 'egg_info-- egg-base pip-egg-info cwd: / tmp/pip-install-zItSn5/pycparser/ Complete output (17 lines): Traceback (most recent call last): File", line 1, in File "/ tmp/pip-install-zItSn5/pycparser/setup.py", line 65, in cmdclass= {' install': install 'sdist': sdist}, File "/ usr/lib64/python2.7/distutils/core.py", line 112, in setup_ setup_distribution = dist = klass (attrs) File "/ usr/lib/python2.7/site-packages/setuptools/dist.py", line 269, in _ init__ _ Distribution.__init__ (self,attrs) File "/ usr/lib64/python2.7/distutils/dist.py", line 287 In _ _ init__ self.finalize_options () File "/ usr/lib/python2.7/site-packages/setuptools/dist.py", line 302, in finalize_options ep.load () (self, ep.name, value) File "/ usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2341 In load return self.resolve () File "/ usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2351 In resolve raise ImportError (str (exc)) ImportError: 'module' object has no attribute' check_specifier'-ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Solution: sudo pip install-upgrade pipsudo pip install-upgrade setuptools

Reference: https://www.cnblogs.com/liubiaos/p/9444485.html https://blog.csdn.net/liuyunshengsir/article/details/79136379

-update the split line-1. Install docker

Download tutorials on the rookie tutorials website, search for https://www.runoob.com/docker/docker-compose.html or see a tutorial I wrote, https://blog.csdn.net/weixin_42245375/article/details/103447571.

Small commands for installing python3 environment under 2.centos7 environment: how to view the current directory location under 1.Linux system # pwd2.centos7 update pip version pip install-upgrade pip2.1 installation 2.1.1, installation dependent environment yum-y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel2.1.2 installation pip Use pip to install wgetyum-y install epel-releaseyum install python-pip# install pippip install wget # install wget2.1.3 wget download installation package sudo mkdir / usr/local/python3 # create installation directory wget-no-check-certificate https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz # download file tar-xzvf Python-3.7.0.tgz # decompress cd Python-3.7.0 # into 2 .1.4 compile and install sudo. / configure-- prefix=/usr/local/python3 # specify the created directory sudo make & & sudo make install2.1.5 to establish the soft link sudo ln-s / usr/local/python3/bin/python3 / usr/bin/python3 for python3

* * Note: * * this is the way I write about establishing soft links. Other bloggers have also said that soft links are directly linked to the default python. In order to prevent the impact on yum, you need to modify the yum configuration file, as follows

Sudo ln-s / usr/local/python3/bin/python3 / usr/bin/python modify yum configuration file sudo vi / usr/bin/yum change the python version specified in the first line to python2.7 (#! / usr/bin/python to #! / usr/bin/python2.7) vi / usr/libexec/urlgrabber-ext-down2.2 partial pit record 2.2.1

The solution is also very simple, but at first I didn't expect that we would install the more-itertools library separately and install version 5.0.0.

Pip install more-itertools==5.0.0

Perform the installation of the latest version again

Pip install sentry3.docker install wordpress .yml file 3.1 docker-compose install pip install docker-compose3.2 last docker-compose.yml file

Contents of the file:

Version: '3.3'services: db: image: mysql:5.7 volumes:-db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: somewordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on:-db image: wordpress:latest ports:-"8000 image 80 "restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_NAME: wordpressvolumes: db_data: {}

Go to the directory where the file is located and run one-line command

Docker-compose up-d can finally visit the blog home page by visiting url:ip:8000 through the browser.

Done.

The above is the editor to share with you how to use docker in centos7 to set up wordpress blogs and trampling records. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report