当前位置:网站首页>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
边栏推荐
- rhcsa第六次笔记
- Network security - file upload penetration test
- Bayesian width learning system based on graph regularization
- CSDN garbage has no bottom line!
- 申请了SSL数字证书如何进行域名验证?
- The R language uses the DOTPLOT function of epidisplay package to visualize the frequency of data points in different intervals in the form of point graphs, uses the by parameter to specify the groupi
- RHCE first operation
- 在LNMP架构中搭建Zabbix监控服务
- 网络安全——文件上传白名单绕过
- R language test sample proportion: use the prop.test function to perform a single sample proportion test to calculate the confidence interval of the p value of the successful sample proportion in the
猜你喜欢

JS execution mechanism

Aggregation measurement of robot swarm intelligence based on group entropy

Overview of multi view learning methods based on canonical correlation analysis

网络安全——Web渗透测试

Common OJ questions of stack and queue

Hcip day 13

CSDN垃圾的没有底线!

Unity行人随机行走不碰撞

Network security - file upload blacklist bypass

Network security - war backdoor deployment
随机推荐
R语言tidyr包的gather函数将从宽表转化为长表(宽表转化为长表)、第一个参数指定原多个数据列名称生成的新数据列名称、第二个参数指定原表内容值、第三个和第四个参数通过列索引指定不变的列名称列表
交换机链路聚合详解【华为eNSP】
网络安全——报错注入
CSP2021 T1 廊桥分配
网络安全——使用Exchange SSRF 漏洞结合NTLM中继进行渗透测试
The latest and complete Flink series tutorials in 2021_ Preliminary exploration of Flink principle and flow batch integration API (II. V) V2
The R language uses the DOTPLOT function of epidisplay package to visualize the frequency of data points in different intervals in the form of point graphs, uses the by parameter to specify the groupi
代码签名证书与SSL证书区别
The R language uses the sort function to sort vector data and return the actually sorted data (ascending by default)
Detailed explanation of MSTP protocol for layer 3 switch configuration [Huawei ENSP experiment]
Group knowledge map: distributed knowledge transfer and federated map reasoning
2022年全国职业院校技能大赛赛项比赛时间、承办校信息统计表(第二批)
Editor formula
Browser failed to get cookies, browser solution
MPLS中的包交换和标签交换
网络安全——文件上传白名单绕过
Flink综合案例(九)
在LNMP架构中搭建Zabbix监控服务
数据类型二进制字符串类型
网络安全——Web信息收集