微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

docker部署LAMP架构并部署上线wordpress博客系统

 

第一步:直接在镜像仓库拉取LAMP镜像

[root@ken-node3 ken]# docker pull tutum/lamp

 

第二步:查看已经获取到的镜像

[root@ken-node3 ken]# docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
tutum/lamp          latest              3d49e175ec00        3 years ago         427MB

 

第三步:启动容器

[root@ken-node3 ken]# docker run -p 80:80 -p 3306:3306 -v /ken:/var/www/html -v /ken1:/var/lib/MysqL -d tutum/lamp

命令解读:

端口映射本机80端口到容易80端口,确保本机的80端口未被占用

端口映射本机3306端口到容易3306端口,确保本机的3306端口未被占用

目录映射本机的/ken目录到容器的网站根目录,以实现数据持久化及方便管理

目录映射本机的/ken1目录到容器的数据库文件目录,以实现数据持久化及方便管理

后台运行该容器

 

第四步:准备wordpress安装包到/ken目录下,并进行数据库用户名的编辑

[root@ken-node3 ken]# ls
wordpress  wordpress-3.3.1-zh_CN.zip
[root@ken-node3 ken]# cp wordpress/* . -a
[root@ken-node3 ken]# ls
index.PHP    wordpress-3.3.1-zh_CN.zip  wp-blog-header.PHP    wp-cron.php        wp-login.PHP     wp-settings.PHP
license.txt  wp-activate.PHP            wp-comments-post.PHP  wp-includes        wp-mail.PHP      wp-signup.PHP
readme.html  wp-admin                   wp-config-sample.PHP  wp-links-opml.PHP  wp-pass.PHP      wp-trackback.PHP
wordpress    wp-app.PHP                 wp-content            wp-load.PHP        wp-register.PHP  xmlrpc.PHP

[root@ken-node3 ken]# cp wp-config-sample.PHP wp-config.php 

[root@ken-node3 ken]# vim wp-config.php

 

 

第五步:进入容易创建相应的数据库用户

 

[root@ken-node3 ken]# docker exec -it 9dbad46eb3f2 bash
root@9dbad46eb3f2:/# MysqL
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 1
Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)

copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered Trademark of Oracle Corporation and/or its
affiliates. Other names may be Trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MysqL> create database ken;
Query OK, 1 row affected (0.00 sec)

MysqL> grant all on *.* to ken@'localhost' identified by '123';
Query OK, 0 rows affected (0.00 sec)

MysqL> grant all on *.* to ken@'%' identified by '123';
Query OK, 0 rows affected (0.01 sec)


MysqL> exit
Bye

 

 

第六步:浏览器进行访问

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐