1.爲wordprss新建數據庫和用戶名:php
$sudo mysql -u root -pmysql
mysql>CREATE DATABASE wp_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;sql
mysql>GRANT ALL ON wp_db.* TO 'wp_user'@'localhost' IDENTIFIED BY 'password';數據庫
mysql>FLUSH PRIVILEGES;apache
mysql>exit;瀏覽器
2.下載最新的Wordpresside
$ wget https://wordpress.org/latest.tar.gzwordpress
$ sudo tar zxvf latest.tar.gz -C /var/www/rest
3.配置apache2:code
$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
經過瀏覽器安裝Wordpress: