apt-get install apache2
service apache2 restart/status/start/stop
ufw allow 80
访问http://Ubuntu的IP,出现It Works!网页,
apt-get install mysql-server mysql-client
mysql -u root -p
service mysql retart/status/start/stop
ufw allow 3306
apt-get install php7.0
apt-get install libapache2-mod-php7.0
apt-get install php7.0-mysql
service apache2 restart
service mysql restart
vim /var/www/html/phpinfo.php
echo phpinfo();?>
sudo apt-get install phpmyadmin
安装时:空格选择apache2,enter确定,下一步配置数据库,输入密码。
sudo ln -s /usr/share/phpmyadmin /var/www/html
sudo a2enmod rewrite
service php7.0-fpm restart
提示服务没找到?不去管它
service apache2 restart
浏览器访问:http:// ubuntu 地址/phpmyadmin
vim /etc/apache2/apache2.conf
AddType application/x-httpd-php .php .htm .html
AddDefaultCharset UTF-8
service apache2 restart
sudo apt-get install ufw
sudo mysql -u root -p
Enter Password:…mysql> CREATE DATABASE wordpressdb;
mysql>CREATE USER wordpressuser@localhost IDENTIFIED BY ‘wordpresspassword’;
mysql>GRANT ALL PRIVILEGES ON wordpressdb.* TO wordpressuser@localhost;
mysql>FLUSH PRIVILEGES;
mysql>exit
sudo service apache2 restart
sudo service mysql restart
mkdir temp
cd temp
wget http://wordpress.org/wordpress-4.x.tar.gz
wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz
下面以英文版为例,如果想安装中文版,可以将文件名替换为中文版文件名
tar zxf wordpress-4.x.tar.gz -C /var/www/html/
mkdir -p /var/www/html/wordpress/wp-content/uploads
sudo chown -R www-data .www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress
sudo chown -R :www-data /var/www/html/wordpress/wp-content/uploads
cd /var/www/html/wordpress/
cp wp-config-sample.php wp-config.php
vim wp-config.php
/* The name of the database for WordPress /
define(‘DB_NAME’, ‘wordpressdb’);
/* MySQL database username /
define(‘DB_USER’, ‘wordpressuser’);
/* MySQL database password /
define(‘DB_PASSWORD’, ‘wordpresspassword’);
中文版按照自带的readme.html操作,或者:
cd /var/www/html/wordpress/
cp wp-config-sample.php wp-config.php
vim wp-config.php
define('DB_NAME', 'wordpressdb');
/* MySQL database username /
define('DB_USER', 'wordpressuser');
/* MySQL database password /
define('DB_PASSWORD', 'wordpresspassword');
访问wordpress安装
问题:
1.可能会出现 wordpressuser 密码错误(using password yes)
以root用户登陆:
set password for user@localhost = password(“your password”);
2.
你没有建立数据库