1.为wordprss新建数据库和用户名:

$sudo mysql -u root -p

mysql>CREATE DATABASE wp_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

mysql>GRANT ALL ON wp_db.* TO 'wp_user'@'localhost' IDENTIFIED BY 'password';

mysql>FLUSH PRIVILEGES;

mysql>exit;

image

2.下载最新的Wordpress

$ wget https://wordpress.org/latest.tar.gz

$ sudo tar zxvf latest.tar.gz  -C /var/www/

3.配置apache2:

$sudo nano /etc/apache2/sites-available/wordpress.conf

 

<Directory /var/www/wordpress/>
    AllowOverride All
</Directory>

 

$sudo a2enmod rewrite

$sudo apache2ctl configtest

$sudo systemctl restart apache2

$touch /var/www/wordpress/.htaccess

$sudo chown -R www-data:www-data /var/www/wordpress

 

$sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \;

$sudo find /var/www/wordpress/ -type f -exec chmod 640 {} \;

 

$sudo nano /var/www/wordpress/wp-config.php

image

通过浏览器安装Wordpress:

http://ServerIP

image

image

image

image

image