当前位置:网站首页>How to build and run WordPress on raspberry pie
How to build and run WordPress on raspberry pie
2022-07-24 13:47:00 【Brother Xing plays with the clouds】
This simple tutorial allows you to run your... On raspberry pie WordPress Website .
WordPress Is a very popular open source blog platform and content management platform (CMS). It's easy to build , There is also an active developer community to build websites 、 Create themes and plug-ins for others to use .
Although through one button WordPress Setting up to get managed packages is easy , But you can also simply use the command line in Linux The server Set your own hosting package on , And raspberry pie is a pretty good way to try it and learn something by the way .
A frequently used Web The four parts of the kit are Linux、Apache、MySQL and PHP. Here is what you need to know about each of them .
Linux
The system running on raspberry pie is Raspbian, This is a base Debian, Optimized for running on raspberry pie hardware Linux Distribution version . You have two choices : Desktop version or compact version . The desktop version has a familiar desktop and many educational software and programming tools , Like LibreOffice Kit 、Mincraft, One more web browser . The compact version has no desktop environment , So it only has the command line and some necessary software .
This tutorial can be used in both versions , But if you use a lite version , You must have another computer to visit your site .
Apache
Apache Is a popular web The server application , You can install it on your raspberry pie to serve your web page . In itself ,Apache Can pass HTTP Provide static HTML file . Use additional modules , It can also be used like PHP The scripting language of provides dynamic web pages .
install Apache It's simple . Open a terminal window , Then type the following command :
sudo apt install apache2 -y
Apache By default, a test file is placed in a web Directory , You can access it from your computer or other computers in your network . Just open it web browser , Then enter the address <http://localhost>. perhaps ( Especially if you use Raspbian Lite Words ) Enter your raspberry pie IP Address substitution localhost. You should see such content in your browser window :
That means yours Apache It's already working !
This default web page is just a file in your file system . It's in your local /var/www/html/index/html. You can use Leafpad Text editor write some HTML To replace the contents of this file .
cd/var/www/html/sudo leafpad index.html
Save and close Leafpad Then refresh the page , See your changes .
MySQL
MySQL( pronounce as “my S-Q-L” perhaps “my sequel”) Is a very popular database engine . It's like PHP, It is widely used in Web Services , That's why it's like WordPress The same project chose it , And why these projects are so popular .
Enter the following command in a terminal window to install MySQL service (LCTT Translation notes : It's actually installed MySQL Branch MariaDB):
sudoapt-get install mysql-server -y
WordPress Use MySQL Store articles 、 page 、 User data 、 There are many other things .
PHP
PHP It's a preprocessor : It is the code that runs when the server accepts the web page request through the web browser . It addresses the content that needs to be displayed on the web , Then send these pages to the browser . Unlike static HTML,PHP Be able to show different content in different situations .PHP It's a web A very popular language on ; A lot like Facebook and Wikipedia All projects use PHP To write .
install PHP and MySQL Plug in for :
sudoapt-get install php php-mysql -y
Delete index.html, Then create index.php:
sudorm index.htmlsudo leafpad index.php
Add the following to it :
<?php phpinfo();?>
preservation 、 sign out 、 Refresh your web page . You will see PHP Status page :
WordPress
You can use wget Command from the wordpress.org download WordPress. Abreast of the times WordPress Always used wordpress.org/latest.tar.gz This web site , So you can grab these files directly , There is no need to check inside the web , The current version is 4.9.8.
Make sure you're in /var/www/html Directory , Then delete all the contents :
cd/var/www/html/sudorm*
Use wget download WordPress, Then extract the contents , And move the extracted WordPress The contents of the directory are moved to html Under the table of contents :
sudowget http://wordpress.org/latest.tar.gzsudotar xzf latest.tar.gzsudomv wordpress/* .
Now you can delete the compressed package and empty wordpress Catalogue :
sudorm-rf wordpress latest.tar.gz
function ls perhaps tree -L 1 Command display WordPress Contents included under the project :
.├── index.php├── license.txt├── readme.html├── wp-activate.php├── wp-admin├── wp-blog-header.php├── wp-comments-post.php├── wp-config-sample.php├── wp-content├── wp-cron.php├── wp-includes├── wp-links-opml.php├── wp-load.php├── wp-login.php├── wp-mail.php├── wp-settings.php├── wp-signup.php├── wp-trackback.php└── xmlrpc.php3 directories,16 files
This is a WordPress The default installation source for . stay wp-content Directory , You can edit your custom installation .
You should now change the ownership of all documents to Apache Running users of www-data:
sudochown-R www-data:.
WordPress database
To build your WordPress Site , You need a database . What we use here is MySQL.
Run in the terminal window MySQL Safe installation commands :
sudo mysql_secure_installation
You will be asked a series of questions . There was no password here , But in the next step, you should set one . Make sure you remember the password you entered , Later you need to use it to connect your WordPress. Press enter to confirm all the following questions .
When it's finished , You will see “All done!” and “Thanks for using MariaDB!” Information about .
Run in the terminal window mysql command :
sudo mysql -uroot -p
Enter the root password (LCTT Translation notes : No Linux Systematic root password , yes MySQL Of root password ). You will see “Welcome to the MariaDB monitor.” Welcome to . stay “MariaDB [(none)] >” Use the following command at the prompt , For you WordPress Create a database for the installation of :
create database wordpress;
Pay attention to the semicolon at the end of the declaration , If the command is executed successfully , You will see the following prompt :
Query OK,1 row affected (0.00 sec)
Give the database permission to root The user enters the password at the bottom of the statement :
GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
In order for the changes to take effect , You need to refresh database permissions :
FLUSH PRIVILEGES;
Press Ctrl+D sign out MariaDB Prompt , Back to Bash shell.
WordPress To configure
In your Raspberry pie Open a web browser , Address field input http://localhost. Choose one you want in WordPress The language used , And then click “Continue”. You will see WordPress Welcome interface for . Click on “Let’s go!” Button .
Fill in the basic site information as follows :
DatabaseName: wordpressUserName: rootPassword:<YOUR PASSWORD>DatabaseHost: localhostTablePrefix: wp_
Click on “Submit” continue , And then click “Run the install”.
Fill in the following format : Set a title for your site 、 Create a username and password 、 Enter your email Address . Click on “Install WordPress” Button , Then log in with the account you just created , You are now logged in , And your site has been set up , You can enter... In the browser address bar http://localhost/wp-admin Check your website .
Permanent link
Change your permanent link settings , Make your URL Being more friendly is a good idea .
To do this , First log in to your WordPress , Go to the dashboard . Get into “Settings”,“Permalinks”. choice “Post name” Options , And then click “Save Changes”. Then you need to turn on Apache Of rewrite modular .
sudo a2enmod rewrite
You also need to tell the virtual hosting service , The site allows rewriting requests . Edit for your virtual host Apache The configuration file :
sudo leafpad /etc/apache2/sites-available/000-default.conf
Add the following after the first line :
<Directory"/var/www/html">AllowOverride All</Directory>
Make sure there is something like this <VirtualHost *:80>:
<VirtualHost *:80><Directory"/var/www/html">AllowOverride All</Directory>...
Save this file , And then quit , restart Apache:
sudosystemctl restart apache2
next step ?
WordPress It can be highly customized . Click on your site name in the banner at the top of the website , You will enter the dashboard . Here you can modify the theme 、 Add pages and articles 、 Edit menu 、 Add the plug-in 、 And many other things .
Here are some interesting things you can try on the raspberry pie web service :
- Add pages and articles to your website
- Install different themes from the appearance menu
- Customize your website theme or create your own
- Use your website services to display useful information to others on your network
Don't forget it , Raspberry pie is a Linux The computer . You can also use the same structure to run Debian perhaps Ubuntu On the server of WordPress.
via: https://opensource.com/article/18/10/setting-wordpress-raspberry-pi
author :Ben Nuttall Topic selection :lujun9972 translator :dianbanjiu proofreading :wxy
This paper is written by LCTT Original compilation ,Linux China Honor roll out
边栏推荐
- 开放环境下的群智决策:概念、挑战及引领性技术
- 2022年全国职业院校技能大赛赛项比赛时间、承办校信息统计表(第二批)
- HCIP第十三天
- Soft link, hard link
- rhcsa第六次笔记
- Common OJ questions of stack and queue
- The scroll bar in unity ugui is not displayed from the top when launching the interface in the game
- 网络安全——Web渗透测试
- Why are there "two abstract methods" in the functional interface comparator?
- Detailed explanation of switch link aggregation [Huawei ENSP]
猜你喜欢

网络安全——文件上传黑名单绕过

脑注意力机制启发的群体智能协同避障方法

rhcsa第六次笔记

Bayesian width learning system based on graph regularization

Nmap安全测试工具使用教程

Simulate the implementation of the library function memcpy-- copy memory blocks. Understand memory overlap and accurate replication in detail

How to quickly wrap lines in Excel table

网络安全——使用Evil Maid物理访问安全漏洞进行渗透

网络安全——文件上传渗透测试

How to generate expected data? Emory University and others' latest "deep learning controllable data generation" review, 52 page PDF, covering 346 documents, comprehensively expounds the controllable g
随机推荐
The scroll bar in unity ugui is not displayed from the top when launching the interface in the game
基于典型相关分析的多视图学习方法综述
Happy number ~ ~ ~ (in fact, I'm not happy at all) & ugly number
[untitled] rhcsa first operation
申请了SSL数字证书如何进行域名验证?
R语言epiDisplay包的kap函数计算Kappa统计量的值(总一致性、期望一致性)、对多个评分对象的结果进行一致性分析、评分的类别为多个类别、如果评分中包含缺失值则标准误及其相关统计量则无法计算
CSDN garbage has no bottom line!
Flinktable & SQL (VI)
Flinktable & SQL (VII)
RHCE first operation
Detailed explanation of switch link aggregation [Huawei ENSP]
网络安全——过滤绕过注入
支持鹏程系列开源大模型应用生态演化的可持续学习能力探索
游戏思考04总结:针对帧、状态、物理同步的总结(之前写的太长,现在简略下)
Network security - file upload blacklist bypass
开放环境下的群智决策:概念、挑战及引领性技术
Bayesian width learning system based on graph regularization
JS execution mechanism
NOIP2021 T2 数列
Network security - function bypass injection