Ubuntu18.04 安装WordPress
-
打开cn.wordpress.org,查看最新版wordpress版本
-
右键复制.tar.gz链接,转入linux 终端操作
# mkdir download ///建立一个下载文件夹
# cd download/
# wget https://wordpress.org/latest.tar.gz
--2019-07-04 02:23:45-- https://wordpress.org/latest.tar.gz
Resolving wordpress.org (wordpress.org)... 198.143.164.252
Connecting to wordpress.org (wordpress.org)|198.143.164.252|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11200591 (11M) [application/octet-stream]
Saving to: ‘latest.tar.gz’
latest.tar.gz 100%[===============================================================>] 10.68M 4.55MB/s in 2.3s
2019-07-04 02:23:49 (4.55 MB/s) - ‘latest.tar.gz’ saved [11200591/11200591]
- 解压wordpress
- 解压缩下载文件,且压缩至指定WWW目录
root@ubuntu:/download# gzip -d latest.tar.gz
root@ubuntu:/download# ls
latest.tar
root@ubuntu:/download# tar xf latest.tar -C /var/www/html/
root@ubuntu:/download# ls /var/www/html/
index.html php php.php wordpress
- 更改文件夹权限且重启httpd服务
# chmod -R 777 /var/www/html/
# /etc/inid.d/apache2 restart
mysql数据库操作(若安装好phpmyadmin,可直接页面操作)
- 登入mysql
#mysql -u root -p
root@ubuntu:/download# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.26-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2019, 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.
- 创建数据库 名字为wordpress
mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.01 sec)
- 创建管理员为 wordadm
mysql> CREATE USER wordadm;
Query OK, 0 rows affected (0.00 sec)
- 设置密码
mysql> SET PASSWORD FOR wordadm = PASSWORD("wordpassd");
Query OK, 0 rows affected, 1 warning (0.00 sec)
- 设置权限
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wordadm IDENTIFIED BY "wordpassd";
Query OK, 0 rows affected, 1 warning (0.00 sec)
- 配置立即生效
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
WordPress 登录问题
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
您的PHP安装似乎缺少WordPress所需的MySQL扩展。
瞎捣鼓过程,是否有效未知
- 网上找了一些相关问题解决方法,安装了下列程序,未能刷新页面(但是否生成了下列关联的mysql.so文件未知)
root@ubuntu:/download# apt install php-fpm
root@ubuntu:/download# apt install php-mysql
- 修改php.ini文件内容,具体位置
- 特别说明,linux系统品牌及版本不一样,位置也可能不一致
# vi /etc/php/7.2/apache2/php.ini
- 上图位置是需要修改的内容行
添加以列内容
extension=mysqli.so
extension_dir="/usr/lib/php/20170718"
- 使用find命令查找本地是否有mysql.so文件
- 这一步操作由于对linux命令完全不熟悉,才刚入门几天时间,后导致查找了1小时资料,最后又返回终端录入齐全才查出文件位置
错误的查找命令 (以后再了解’'作用是啥)
- 未发现mysql.so文件
root@ubuntu:/# find / -name 'mysql.so'
find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/proc/1367/task/1367/net’: Invalid argument
find: ‘/proc/1367/net’: Invalid argument
- 正确的Ubuntu find命令
# find / -name mysqli.so
/usr/lib/php/20170718/mysqli.so ////存放文件位置
find: ‘/run/user/1000/gvfs’: Permission denied
/mnt/sdb/@syno/@appstore/PHP7.0/usr/local/lib/php70/modules/mysqli.so
find: ‘/proc/1367/task/1367/net’: Invalid argument
find: ‘/proc/1367/net’: Invalid argument