ubuntu 14.04 Apache搭建wordpress博客

安装相关文件

#安装apache
wyj@wyj-virtual-machine:~$ dpkg -l|grep apache
wyj@wyj-virtual-machine:~$ sudo apt-get install apache2
wyj@wyj-virtual-machine:~$ dpkg -l|grep apache
ii  apache2                                               2.4.7-1ubuntu4.20                                   amd64        Apache HTTP Server
ii  apache2-bin                                           2.4.7-1ubuntu4.20                                   amd64        Apache HTTP Server (binary files and modules)
ii  apache2-data                                          2.4.7-1ubuntu4.20                                   all          Apache HTTP Server (common files)

#安装php5
wyj@wyj-virtual-machine:~$ dpkg -l|grep php5
ii  php5-common                                           5.5.9+dfsg-1ubuntu4.25                              amd64        Common files for packages built from the php5 source
ii  php5-fpm                                              5.5.9+dfsg-1ubuntu4.25                              amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php5-json                                             1.3.2-2build1                                       amd64        JSON module for php5
ii  php5-mysql                                            5.5.9+dfsg-1ubuntu4.25                              amd64        MySQL module for php5
wyj@wyj-virtual-machine:~$ sudo apt-get install php5

#安装Mysql
wyj@wyj-virtual-machine:~$ dpkg -l|grep mysql-server
ii  mysql-server                                          5.5.60-0ubuntu0.14.04.1                             all          MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.5                                      5.5.60-0ubuntu0.14.04.1                             amd64        MySQL database server binaries and system database setup
ii  mysql-server-core-5.5                                 5.5.60-0ubuntu0.14.04.1                             amd64        MySQL database server binaries
#我已经安装有  安装命令sudo apt-get install mysql-server

wyj@wyj-virtual-machine:~$ sudo apt-get install libapache2-mod-php5

wyj@wyj-virtual-machine:~$ sudo vim /etc/apache2/apache2.conf 
#在最后加上ServerName localhost:80
wyj@wyj-virtual-machine:~$ sudo service apache2 restart 
 * Restarting web server apache2
   ...done.

#其他模块安装
wyj@wyj-virtual-machine:~$ sudo apt-get install libapache2-mod-php5
wyj@wyj-virtual-machine:~$ sudo apt-get install libapache2-mod-auth-mysql
wyj@wyj-virtual-machine:~$ sudo apt-get install php5-mysql
wyj@wyj-virtual-machine:~$ sudo apt-get install php5-gd

  • 前两个很容易明白,要想apache能够解析PHP,就需要借助这两个模块来找到php engine。
  • 第三个在php操作mysql数据库时用到
  • 第四个GD库。

 

测试


安装完apache2,根目录在/var/www/html下,可以通过http://localhost/测试一下是否好用。

去官网安装安装phpadmin与wordpress,下载后解压缩到/var/www/html

wyj@wuyj:~/下载$ ls

phpMyAdmin-4.8.3-all-languages.zip  wordpress-4.9.8.tar.gz

#unzip 解压缩 phpMyAdmin到/var/www/html

wyj@wuyj:~/下载$ sudo tar -xzf wordpress-4.9.8.tar.gz -C /var/www/html/

wyj@wuyj:~/下载$ cd /var/www/html/
wyj@wuyj:/var/www/html$ ls
!  index.html  phpmyadmin  phpMyAdmin-4.8.3-all-languages  test.html  wordpress

浏览器访问phpmyadminip/phpMyAdmin-4.8.3-all-languages

登录账号为root,密码为mysql设置的密码

建立数据库,语言选utf8_general_ci,如果你擅长SQL语句,可以直接用SQL语句创建数据库 create database wordpress;

浏览器输入ip/wordpress 

数据库名称填刚创建的,数据库用户名,数据库密码,下面默认

出现如下错误 

wyj@wuyj:/var/www/html$ cd wordpress/

wyj@wuyj:/var/www/html$ sudo cp  wp-config-sample.php wp-config.php
wyj@wuyj:/var/www/html$ sudo vim  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');#database_name_here填数据库名称

/** MySQL database username */
define('DB_USER', 'username_here');#username_here数据库用户名称

/** MySQL database password */
define('DB_PASSWORD', 'password_here');#/数据库密码  

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

#保存退出

#wordpress安装完成

参考博客:https://blog.csdn.net/YhL_Leo/article/details/50520915

我的博客:http://wuyujun.iok.la/wordpress/

猜你喜欢

转载自blog.csdn.net/caijiwyj/article/details/82086143
今日推荐