Install WordPress With LAMP
LAMP
Linux, Apache, MySQL, PHP
1 sudo apt update
2 sudo apt-get install apache2 -y # apache2
3 sudo apt install php libapache2-mod-php # php, libapache2-mod-php
4 sudo systemctl restart apache2 # restart apache2
5 sudo apt-get install mariadb-server php-mysql -y # MariaDB Server and PHP-MySQL packages
6 sudo systemctl restart apache2 # restart apache2 again
7 cd /var/www/html/ # open web folder
8 sudo rm * # remove old files
9 sudo wget http://wordpress.org/latest.tar.gz # download WordPress
10 sudo tar xzf latest.tar.gz # extract WordPress tarball
11 sudo mv wordpress/* . # move WordPress files to /var/www/html/*
12 sudo rm -rf wordpress latest.tar.gz # remove wordpress folder and WordPress tarball
13 sudo apt install tree
14 tree -L 1
15 .
16 ├── index.php
17 ├── license.txt
18 ├── readme.html
19 ├── wp-activate.php
20 ├── wp-admin
21 ├── wp-blog-header.php
22 ├── wp-comments-post.php
23 ├── wp-config-sample.php
24 ├── wp-content
25 ├── wp-cron.php
26 ├── wp-includes
27 ├── wp-links-opml.php
28 ├── wp-load.php
29 ├── wp-login.php
30 ├── wp-mail.php
31 ├── wp-settings.php
32 ├── wp-signup.php
33 ├── wp-trackback.php
34 └── xmlrpc.php
35
36 3 directories, 16 files
37
38 sudo chown -R www-data: . # change ownership of all these files to Apache user
39 sudo mysql_secure_installation # MariaDB
40 sudo mysql -uroot -p # run MySQL
41 MariaDB [(none)]> create database wordpress;
42 Query OK, 1 row affected (0.001 sec)
43 MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'hostname' IDENTIFIED BY '<YOUR PASSWORD>';
44 Query OK, 0 rows affected (0.012 sec)
45 MariaDB [(none)]> FLUSH PRIVILEGES;
46 Query OK, 0 rows affected (0.001 sec)
47 # Exit the MariaDB prompt with Ctrl + D
48 sudo reboot # restart Raspberry Pi
Write php file to test:
<?php phpinfo();
Save to test.php
, then access http://<ip>/test.php
, will see the
phpinfo.
After execute sudo mysql_secure_installation
:
- You will be asked
Enter current password for root (enter for none):
- If you had set root password jusst input, or you can press Enter to set it. - Type in Y and press Enter to
Set root password?
. - Type in a password at the
New password:
prompt, and press Enter . Important: remember this root password, as you will need it later to set up WordPress. - Type in Y to
Remove anonymous users
. - Type in Y to
Disallow root login remotely
. - Type in Y to
Remove test database and access to it
. - Type in Y to
Reload privilege tables now
.
When complete, you will see the message All done!
and
Thanks for using MariaDB!
.
Install WordPress
Then begin the WordPress installation.
Database Name: wordpress User Name: root Password: <YOUR PASSWORD> Database Host: localhost Table Prefix: wp_
After input these, if you get Server Down
error, just run
sudo systemctl restart apache2
.
Then:
Site Title: tianheg Username: root Password: <Set a password> Email: user@domain
I like https://zenhabits.net/'s theme, I download it, install it.
Install WordPress Theme
- Access
http://address/wp-admin/
- Click Appearance/Themes
- Find Add New/Upload Theme, you can just upload the zh2 zip file. That's it!
- Custom it as you want.
Support HTTPS
Before test these activity, must backup the site:
ref: