{"id":2,"date":"2022-11-15T14:23:22","date_gmt":"2022-11-15T14:23:22","guid":{"rendered":"http:\/\/koner.mywire.org\/?page_id=2"},"modified":"2022-11-15T16:43:48","modified_gmt":"2022-11-15T16:43:48","slug":"sample-page","status":"publish","type":"page","link":"https:\/\/koner.mywire.org\/index.php\/sample-page\/","title":{"rendered":"How to Setup WordPress on the Raspberry Pi"},"content":{"rendered":"\n<p>For those who do not know,\u00a0WordPress is a content management system\u00a0that is used by over 60 million websites. It is very popular amongst bloggers, but is also used by large websites such as TechCrunch.<\/p>\n\n\n\n<p>I currently have WordPress running on my Raspberry Pi to act as a development server as it\u2019s faster than using something like XAMPP.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Setting up WordPress on the Raspberry Pi is not hugely complicated. Once you have Apache, PHP and the MYSQL server set up, it is smooth sailing.<\/p>\n\n\n\n<p>Before you go too far ahead in this tutorial, make sure that you have your MYSQL root password ready. We will be running through the steps to setting up a database for WordPress and showing you how to set up an SQL user to interact with the database all by using the MYSQL Command line.<\/p>\n\n\n\n<p>If you\u2019re interested then now is the time to set up WordPress on the&nbsp; Raspberry Pi.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"has-text-align-left wp-block-heading\">Equipment List<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Below are all the bits and pieces that I made use of for this Raspberry Pi WordPress tutorial.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Recommended<\/h3>\n\n\n\n<ul class=\"wp-block-list\" id=\"recommended_equipment\">\n<li>Raspberry Pi<\/li>\n\n\n\n<li>Micro SD Card<\/li>\n\n\n\n<li>Power Supply<\/li>\n\n\n\n<li>Ethernet Cable\u00a0or\u00a0Wi-Fi<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Optional<\/h3>\n\n\n\n<ul class=\"wp-block-list\" id=\"optional_equipment\">\n<li>Raspberry Pi Case<\/li>\n\n\n\n<li>USB Keyboard<\/li>\n\n\n\n<li>USB Mouse<\/li>\n\n\n\n<li>HDMI Cable<\/li>\n\n\n\n<li>Monitor<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Setting up WordPress on a Raspberry Pi<\/strong><\/h4>\n\n\n\n<p>Before you start this tutorial make sure you have<a href=\"https:\/\/pimylifeup.com\/raspberry-pi-apache\/\">&nbsp;setup Apache and PHP<\/a>. You will also need to have a&nbsp;<a href=\"https:\/\/pimylifeup.com\/raspberry-pi-mysql\/\">MYSQL server running<\/a>&nbsp;and accessible. As I mentioned earlier, you will need to have your MYSQL root password ready.<\/p>\n\n\n\n<p><strong>1.<\/strong>&nbsp;To start, we need to download and extract WordPress to our \u201c<code>\/var\/www\/<\/code>your_domain\/public_html\u201d directory on our Raspberry Pi.<\/p>\n\n\n\n<p>We will also need to take ownership of the \u201c<code>\/var\/www<\/code>\/your_domain\/public_html\u201d folder with the&nbsp;<strong>\u201c<\/strong><code>www-data<\/code>\u201d user and group. Doing this will allow PHP to process WordPress without running into any permission errors.<\/p>\n\n\n\n<p>To achieve all of this, we will run a few commands, just type each line below into the terminal.<\/p>\n\n\n\n<p>cd <code>\/var\/www<\/code>\/your_domain\/public_html<\/p>\n\n\n\n<p>sudo wget http:\/\/wordpress.org\/latest.tar.gz <\/p>\n\n\n\n<p>sudo tar xzf latest.tar.gz <\/p>\n\n\n\n<p>sudo mv wordpress\/* .\/ <\/p>\n\n\n\n<p>sudo rm -rf wordpress latest.tar.gz <\/p>\n\n\n\n<p>sudo usermod -a -G www-data user <\/p>\n\n\n\n<p>sudo chown -R -f www-data:www-data <code>\/var\/www<\/code>\/your_domain\/public_html<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Now that WordPress is downloaded and extracted to our Raspberry Pi, we will also need to set up a database within MYSQL for WordPress to store its information.<\/p>\n\n\n\n<p>We need to first use the MySQL command to login. Use the \u201c<code>\u2013p<\/code>\u201d&nbsp;<strong>flag for the password<\/strong>&nbsp;and \u201c<code>\u2013u<\/code>\u201d&nbsp;<strong>for the username<\/strong>. Make sure your password is written right next to the \u201c<code>-p<\/code>\u201c<strong>&nbsp;tag<\/strong>&nbsp;with&nbsp;<strong>no space<\/strong>.<\/p>\n\n\n\n<p><strong>Note:<\/strong>&nbsp;Replace&nbsp;<strong>password<\/strong>&nbsp;with the one you set up for the root user when you setup MySQL<\/p>\n\n\n\n<p>sudo mysql -u root -p<\/p>\n\n\n\n<p>Now that we have logged into the MYSQL server, we can issue a command to create a database for WordPress using this simple line:<\/p>\n\n\n\n<p>CREATE DATABASE wordpress;<\/p>\n\n\n\n<p>Now we will create a separate user for this database, this is far safer from a security perspective.<\/p>\n\n\n\n<p>While still in MYSQL issue the following command:<\/p>\n\n\n\n<p>CREATE USER &#8216;new_user&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;new_password&#8217;;<\/p>\n\n\n\n<p><strong>Note:<\/strong>&nbsp;Make sure you replace&nbsp;<code>new_user<\/code>&nbsp;and&nbsp;<code>new_password<\/code>&nbsp;with details of your choosing, just remember what you choose as you will need to know both when we setup WordPress.<\/p>\n\n\n\n<p><strong>5.<\/strong>&nbsp;Once we have a new user, we will need to give it permissions to manage our new database.<\/p>\n\n\n\n<p>We can do that with the command below, make sure you swap&nbsp;<code>new_user<\/code>, with whatever you entered in the previous step.<\/p>\n\n\n\n<p>GRANT ALL ON wordpress.* TO &#8216;new_user&#8217;@&#8217;localhost&#8217;;<\/p>\n\n\n\n<p>Now we have created our database and our user that we want to interact with it. We need to quit out of the MYSQL command interface.<\/p>\n\n\n\n<p>We can do that by pressing&nbsp;<kbd>CTRL<\/kbd>&nbsp;+&nbsp;<kbd>D<\/kbd>.<\/p>\n\n\n\n<p>&nbsp;With that all done, we can now finally finish setting up WordPress, we can start this process by going to your Raspberry Pi\u2019s IP address in a web browser.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"806\" src=\"https:\/\/koner.mywire.org\/wp-content\/uploads\/2022\/11\/wordpress1.png\" alt=\"\" class=\"wp-image-35\" srcset=\"https:\/\/koner.mywire.org\/wp-content\/uploads\/2022\/11\/wordpress1.png 709w, https:\/\/koner.mywire.org\/wp-content\/uploads\/2022\/11\/wordpress1-264x300.png 264w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p>You will now need to enter various details so that WordPress can connect to the MySQL database we setup.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Database Name<\/strong>&nbsp;\u2013 This is the database WordPress will connect to. Earlier in this tutorial we created a database called&nbsp;<code>wordpress<\/code>.<\/li>\n\n\n\n<li><strong>Username<\/strong>&nbsp;\u2013 This is the user we created in&nbsp;<strong>step 4<\/strong>, make sure you get this detail correct as it needs to connect to the above database.<\/li>\n\n\n\n<li><strong>Password<\/strong>&nbsp;\u2013 This is the password we set while creating the MYSQL user in&nbsp;<strong>step 4<\/strong>, again make sure you enter this correctly as it\u2019s needed to connect to the database.<\/li>\n\n\n\n<li><strong>Database Host<\/strong>&nbsp;\u2013 Keep this to the default setting, we only need it to connect locally.<\/li>\n\n\n\n<li><strong>Table Prefix<\/strong>&nbsp;\u2013 Keep this to the default setting as well, there is no real need to change this<\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<p>Assuming you entered all the correct details, you will now be able to press \u201c<strong>Submit<\/strong>\u201d to successfully install the software, follow the rest of the prompts to finalize the installation.<\/p>\n\n\n\n<p>There is quite a bit more to learn about WordPress such as installing a WordPress theme or setting up plugins. Using a Raspberry Pi is a great way to learn all the basics without investing in an expensive web server.<\/p>\n\n\n\n<p>You should now have WordPress setup on the Raspberry Pi and accessible. <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For those who do not know,\u00a0WordPress is a content management system\u00a0that is used by over 60 million websites. It is very popular amongst bloggers, but is also used by large websites such as TechCrunch. I currently have WordPress running on my Raspberry Pi to act as a development server as it\u2019s faster than using something [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-2","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/koner.mywire.org\/index.php\/wp-json\/wp\/v2\/pages\/2","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/koner.mywire.org\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/koner.mywire.org\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/koner.mywire.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/koner.mywire.org\/index.php\/wp-json\/wp\/v2\/comments?post=2"}],"version-history":[{"count":14,"href":"https:\/\/koner.mywire.org\/index.php\/wp-json\/wp\/v2\/pages\/2\/revisions"}],"predecessor-version":[{"id":68,"href":"https:\/\/koner.mywire.org\/index.php\/wp-json\/wp\/v2\/pages\/2\/revisions\/68"}],"wp:attachment":[{"href":"https:\/\/koner.mywire.org\/index.php\/wp-json\/wp\/v2\/media?parent=2"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}