安装Wordpress+Lamp Ubunut18

sudo apt update
sudo apt install apache2

sudo apt install mysql-server
sudo mysql_secure_installation
sudo mysql
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;
FLUSH PRIVILEGES;
exit

sudo apt install php libapache2-mod-php php-mysql
sudo systemctl restart apache2
sudo systemctl status apache2

sudo nano /var/www/html/info.php

<?php phpinfo(); ?>


http://localhost/info.php

WordPress

mysql -u root -p
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON wordpress.* TO ‘wordpressuser’@‘localhost’ IDENTIFIED BY ‘password’;
FLUSH PRIVILEGES;
EXIT;

sudo apt update
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
sudo systemctl restart apache2

sudo nano /etc/apache2/sites-available/default.conf

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

sudo a2enmod rewrite
sudo systemctl restart apache2

cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
touch /tmp/wordpress/.htaccess
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
sudo cp -a /tmp/wordpress/* /var/www/html/

sudo chown -R www-data:www-data /var/www/html
sudo find /var/www/wordpress/ -type d -exec chmod 750 {} ;
sudo find /var/www/wordpress/ -type f -exec chmod 640 {} ;

https://localhost

注意:全部一行一行单步运行

ssh root@202.182.98.227

更新系统
sudo apt update

安装apache
sudo apt install apache2

http://202.182.98.227

安装mysql
sudo apt install mysql-server

安装库
sudo apt install php libapache2-mod-php php-mysql
sudo systemctl restart apache2
sudo systemctl status apache2

测试php
sudo nano /var/www/html/info.php

<?php phpinfo(); ?>


http://202.182.98.227/info.php

安装WordPress

mysql -u root -p
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON wordpress.* TO ‘root’@‘localhost’ IDENTIFIED BY ‘’;
FLUSH PRIVILEGES;
EXIT;

安装wordpress需要的php扩展
sudo apt update
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
sudo systemctl restart apache2

sudo a2enmod rewrite
sudo systemctl restart apache2

cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
sudo cp -a /tmp/wordpress/* /var/www/html/

sudo chown -R www-data:www-data /var/www/html
cd /var/www/html
rm index.html

http://202.182.98.227