ubuntu16.04安装wordpress
ubuntu16.04安装wordpress和centos7安装wordpress存在一定的差异。 当然共性大于差异。 共性是lamp环境。 wordpress的必备环境。 先共性再差异。 一、搭建lamp环境(Linux+Apache+MySQL+PHP(含phpmyadmin)) (1)安装apache 安装命令 apt-get install apache2 apache常用命令: service apache2 restart 重启 service apache2 status 状态 service apache2 start 启动 service apache2 stop 关闭 (2)安装mysql apt-get install mysql-server mysql-client 会显示让你输入密码 输入密码后会再次显示确认密码 你所做的是确保两次密码一致并回车即可。 mysql命令: service mysql retart service mysql status service mysql start service mysql stop (3)安装php 安装命令: apt-get install php7.0 apt-get install libapache2-mod-php7.0? apt-get install php7.0-mysql ? 重启apache和mysql service apache2 restart service mysql restart 编辑文件 vim /var/www/html/phpinfo.php <?php echo phpinfo();?> 浏览器访问: http:// IP地址/phpinfo.php,出现PHP版本界面? (4)安装phpmyadmin 安装命令 sudo apt-get install phpmyadmin ? 安装时:空格选择apache2,enter确定,下一步配置数据库,输入密码。 sudo ln -s /usr/share/phpmyadmin /var/www/html ? 启用Apache mod_rewrite模块,后面修改wordpress链接会用到 sudo a2enmod rewrite? ? 重启服务 service php7.0-fpm restart ? 配置vim /etc/apache2/apache2.conf 配置文件尾部添加如下内容: AddType application/x-httpd-php .php .htm .html
AddDefaultCharset UTF-8
? 重启apache服务 service apache2 restart ? 通过phpmyadmin在后台建立数据库为wordpress 并添加对应的用户并授权 ? 也可以通过如下的命令行形式: # 登录数据库
mysql -u root -p
# 创建数据库
CREATE DATABASE wordpress;
# 创建数据库用户和密码
CREATE USER wordpressuser@localhost IDENTIFIED BY '123456';
# 设置wordpressuser访问wordpress数据库权限
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY '123456';
# 刷新数据库设置
FLUSH PRIVILEGES;
# 退出数据库
exit
? (5)安装wordpress 说明:中文版和英文版文件后缀名不同,因此解压方式不同存在差异,后面的步骤基本一样,没有变化,本人试验,绝对有效。 centos7同样适用,关于centos7安装方式可以参考:centos7之安装wordpress 下载 wget http://wordpress.org/latest.tar.gz(英文版) 或 wget https://cn.wordpress.org/wordpress-4.8-zh_CN.zip(中文版) 注意:中文版为zip包,需要通过unzip命令进行解压? 解压 tar -xzvf latest.tar.gz 远程批量传输 sudo rsync -avP ~/wordpress/ /var/www/html/wordpress/ 切换到wordpress目录 ?复制wp-config.php文件 编辑wp-config.php文件 默认内容如下:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME','database_name_here');
/** MySQL database username */
define('DB_USER','username_here');
/** MySQL database password */
define('DB_PASSWORD','password_here');
/** MySQL hostname */
define('DB_HOST','localhost');
将其修改为:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME','wordpress');
/** MySQL database username */
define('DB_USER','wordpress');
/** MySQL database password */
define('DB_PASSWORD','123456');
/** MySQL hostname */
define('DB_HOST','localhost');
? 完成后在浏览器输入地址:www.example.com/wordpress/wp-admin/install.php? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |