ubuntu build wordpress personal blog

ubuntu build wordpress personal blog

1. Prepare the LAMP environment

LAMP is the abbreviation of Linux, Apache, MySQL and PHP, and is the basic operating environment on which the Wordpress system depends. Let's prepare the LAMP environment first:

1.1, install apache2

Terminal command input:

sudo apt-get install apache2 -y

After the installation is successful, you can enter http://ip, visit the web page to see "it work" indicating that the installation is successful.

1.2, install PHP

Terminal command input:

sudo apt-get install php7.0 -y
sudo apt-get install software-properties-common

sudo apt-add-repository ppa:ondrej/php

Install php related components:

sudo apt-get install libapache2-mod-php7.0
1.3, install mysql service

Terminal command input:

sudo apt-get install mysql-server -y

Install php MySQL related components:

sudo apt-get install php7.0-mysql
1.4, install phpmyadmin

Use apt-get to install phpmyadmin. During the installation process, you need to select apache2 as prompted, and then enter the root password and database password:

sudo apt-get install phpmyadmin -y

Establish a soft connection under /var/www/html:

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

Restart MySQL service

sudo service mysql restart

Restart apache service

sudo systemctl restart apache2.service
2. Install and configure wordpress
2.1. Download a Wordpress compressed package
wget https://cn.wordpress.org/latest-zh_CN.zip

If the download is slow, you can download the win first by yourself, and then transfer it to the server through fileilla. After the
download is complete, unzip the compressed package

sudo unzip latest-zh_CN.zip

Enter mysql, enter the following code, and enter your MySQL password as prompted:

mysql -u root -p

Create a database called wordpress for wordpress:

CREATE DATABASE wordpress;

Set a user for this database as wordpressuser:

CREATE USER wordpressuser;

Configure a password for this user as 123456:

SET PASSWORD FOR wordpressuser= PASSWORD("123456");

Configure database access permissions for this user:

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser IDENTIFIED BY"123456";

Take effect

FLUSH PRIVILEGES;

Then exit mysql

exit;
2.2, configure wordpress

Since PHP accesses the /var/www/html/ folder by default, we need to copy all the files in the wordpress folder to the /var/www/html/ folder

sudo mv wordpress/* /var/www/html/

Modify the permissions of the /var/www/html/ directory:

sudo chmod -R 777 /var/www/html/

Specify apache to index.html

sudo mv /var/www/html/index.html /var/www/html/index~.html

Restart the Apache service:

sudo systemctl restart apache2.service

There will be ftp restrictions when changing the theme, enter the following command:

sudo chown-R www-data /var/www/html
sudo chmod-R 775 /var/www/html

Note: login problem: log in to the
background by yourself: ip/wp-admin/
login by others: ip

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_45125250/article/details/107419291