centos8容器中安装lamp及wordpress

1.最小化安装centos8
1.1更新系统(可选)
dnf update -y
2.安装podman
dnf install podman -y
3.拉取centos8镜像
podman search centos:8 podman pull centos:8 podman images
4.运行centos8容器
podman run --name mywordpress -dit -p 80:80 -p 443:443 centos:8 /sbin/init
5.查看容器
podman ps -a
6 进入容器
podman exec -it 容器ID bash
7.安装mariadb,php,httpd
dnf install mariadb mariadb-server httpd httpd-tools php php-cli php-json php-gd php-mbstring php-pdo php-xml php-mysqlnd php-pecl-zip wget -y
8.启动httpd,mariadb
systemctl start httpd mariadb
9.设置httpd,mariadb开机自启动
systemctl enable httpd mariadb
10.登录数据库(root无密码)
mysql -uroot -p
11.新建数据库
create database mywordpress;
12.新建wordpress数据库用户
GRANT ALL ON mywordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'mywordpresspassword';
13下载wordpres,wget速度慢,迅雷下载的国内地址,https://cn.wordpress.org/latest-zh_CN.tar.gz
14.传输wordpress包到容器
podman cp latest-zh_CN.tar.gz mywordpress:/var/www/
15.解包wordpress
tar zxvf latest-zh_CN.tar.gz
16.配置wordpress文件夹访问权限
chown -Rf apache:apache ./wordpress/ chmod -Rf 775 ./wordpress/
17.httpd配置文件夹conf.d中新增mywordpress.conf文件,内容如下
<VirtualHost *:80> ServerAdmin root@localhost DocumentRoot /var/www/wordpress <Directory "/var/www/wordpress"> Options Indexes FollowSymLinks AllowOverride all Require all granted </Directory> ErrorLog /var/log/httpd/wordpress_error.log CustomLog /var/log/httpd/wordpress_access.log common </VirtualHost>
18.重启httpd
systemctl restart httpd
19.配置wordpress连接数据库的文件(可选,配置文件不修改,访问wordpress时也可以设置)
20.访问wordpress,设置管理员账号信息

posted @ 2021-07-12 17:13  何方妖孽  阅读(285)  评论(0编辑  收藏  举报