CentOS 7 rpm包部署wordpress
先下载需要的包 👇包含最新的PHP和MySQL 第三方yum源 这样就能下载各个版本的PHP和MySQL
清华大学的镜像地址:https://mirrors.tuna.tsinghua.edu.cn/remi/
[root@centos7 ~]#wget https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm [root@centos7 ~]#yum -y install remi-release-7.rpm
下载后的源
[root@centos7 ~]# rpm -ql remi-release /etc/pki/rpm-gpg/RPM-GPG-KEY-remi /etc/pki/rpm-gpg/RPM-GPG-KEY-remi2017 /etc/pki/rpm-gpg/RPM-GPG-KEY-remi2018 /etc/pki/rpm-gpg/RPM-GPG-KEY-remi2019 /etc/pki/rpm-gpg/RPM-GPG-KEY-remi2020 /etc/yum.repos.d/remi-glpi91.repo /etc/yum.repos.d/remi-glpi92.repo /etc/yum.repos.d/remi-glpi93.repo /etc/yum.repos.d/remi-glpi94.repo /etc/yum.repos.d/remi-modular.repo /etc/yum.repos.d/remi-php54.repo /etc/yum.repos.d/remi-php70.repo /etc/yum.repos.d/remi-php71.repo /etc/yum.repos.d/remi-php72.repo /etc/yum.repos.d/remi-php73.repo /etc/yum.repos.d/remi-php74.repo /etc/yum.repos.d/remi-php80.repo /etc/yum.repos.d/remi-safe.repo /etc/yum.repos.d/remi.repo
找个比较新的装上 server包和依赖包也装上
[root@centos7 ~]#yum -y install httpd php74-php php74-php-mbstring php74-phpmysqlnd mariadb-server unzip
把服务起来
[root@centos7 ~]# systemctl start mariadb httpd
下载wordpress 官方地址:https://cn.wordpress.org/download/
[root@centos7 ~]# wget https://cn.wordpress.org/latest-zh_CN.tar.gz
解压并进入wordpress文件夹
[root@centos7 ~]# tar xf latest-zh_CN.tar.gz [root@centos7 ~]# cd wordpress [root@centos7 wordpress]# ls index.php wp-activate.php wp-comments-post.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php license.txt wp-admin wp-config-sample.php wp-includes wp-login.php wp-signup.php readme.html wp-blog-header.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php
把整个目录下的文件都移走 移到/var/www/html/下面 用以web访问
[root@centos7 ~]# mv wordpress/* /var/www/html/
为了以后apache账号对wordpress管理 需要给html目录递归权限
[root@centos7 ~]# cd /var/www/html/
[root@centos7 html]# setfacl -Rm u:apache:rwx .
浏览网页确认 直接访问IP地址 eg:10.0.0.100
缺了点东西 我找找 可能json包没装 后来发现没装php74-php-pecl-mysql.x86_64
[root@centos7 ~]# yum list php*|grep php74 #找一下缺啥包 [root@centos7 ~]# yum -y install php74-php-json.x86_64 Loaded plugins: fastestmirror Repository epel is listed more than once in the configuration Loading mirror speeds from cached hostfile * remi-safe: mirrors.tuna.tsinghua.edu.cn Package php74-php-json-7.4.12-1.el7.remi.x86_64 already installed and latest version Nothing to do [root@centos7 ~]# yum -y install php74-php-pecl-mysql.x86_64 [root@centos7 ~]# systemctl restart httpd
*************************************************************************************************************************************************************************************************
OK
接下来新建个数据库(mariadb)和用户
MariaDB [test]> create database wordpress; Query OK, 1 row affected (0.00 sec) MariaDB [test]> grant all on wordpress.* to wordpress@'10.0.0.%' identified by '123456'; Query OK, 0 rows affected (0.00 sec)
如果是mysql8.0不可以一步到位 分两步做
mysql> create user wordpress@'10.0.0.%' identified by '123456'; mysql> grant all on wordpress.* to wordpress@'10.0.0.%';
**************************************************************************************************************************************************************************************************
设置完成后去登录界面 安装
登录上去
默认有一篇文章
可以开始使用了