Installing WordPress on Raspberry Pi

Please share with your friends...
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

⇐ BackPageNext ⇒

WordPress

Now that all the prerequisites are in place, we can finally install and configure WordPress!

  1. Change to the root of the user’s home directory, using the following command:
    cd ~
  2. Download the latest release of WordPress:
    wget http://wordpress.org/latest.tar.gz
  3. Extract all the source files from the WordPress gzip archive, and then remove the downloaded archive:
    tar xzvf latest.tar.gz && sudo rm latest.tar.gz
  4. Move all the source files from the wordpress directory to the root of the web server, and then remove the wordpress directory:
    sudo mv wordpress/* /var/www/html/ && rm -rf wordpress
  5. To make sure all the WordPress source files are readable by Nginx, run the following command:
    sudo chown -R www-data:www-data /var/www/html
  6. Use your web browser to visit your Raspberry Pi’s address, and assuming all has gone well, you will see the WordPress Locale page:
    WordPress: Locale

    WordPress Locale

  7. Select your chosen locale, and click Continue. The Welcome to WordPress page will be displayed.
    Welcome to WordPress

    Welcome to WordPress

  8. Click Let’s go! The WordPress database connection details page will be displayed.
    WordPress: Database Connection Details

    Database Connection Details

  9. Enter the details of the MySQL database that was setup earlier in this article. The example details were:
    Database Name wordpress
    User Name wordpress
    Password Password1
    Database Host localhost:/var/run/mysqld/mysqld.sock
    Table Prefix wp_

    Make sure to enter the Database Host correctly so that the database connection between WordPress and MySQL will use Unix sockets, and completely bypass the need for any TCP-based network connections. Do not change the default Table Prefix unless you have a good reason.

  10. Click Submit. The All right sunshine! page will be displayed.
    WordPress: All right, Sunshine!

    All right, Sunshine!

  11. Click Run the install. The Welcome to the famous five-minute WordPress installation process! page will be displayed.
    Welcome to the famous five-minute WordPress installation process!

    Welcome to the famous five-minute WordPress installation process!

    Enter the details for your initial WordPress site setup.

  12. Click Install WordPress. The WordPress has been installed page will be displayed.
    WordPress has been installed

    WordPress has been installed

  13. Click Log in. The WordPress Log in page will be displayed.
    WordPress: Log In

    WordPress Log In

    Before logging in, we need to make a couple of final configuration changes.

  14. Use the nano editor to modify the WordPress configuration file:
    sudo nano /var/www/html/wp-config.php
  15. Find the existing DB_COLLATE entry and amend the line so that it reads as follows:
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', 'utf8mb4_general_ci');

    This fixes a bug in multisite creation that existed in version 4.2.2.

  16. Directly below the DB_COLLATE entry, add the following FS_METHOD line:
    define('FS_METHOD', 'direct');

    This line enables direct download of plugins and updates rather than using FTP, which is known to be problematic under certain circumstances.

  17. Just above the comment That’s all, stop editing! Happy blogging, add the following WP_ALLOW_MULTISITE line:
    /* Multisite */
    define('WP_ALLOW_MULTISITE', true);
    
    /* That's all, stop editing! Happy blogging. */

    This line enables Multisite setup.

  18. Save and exit nano.
  19. Log in to WordPress!

You have successfully installed and configured WordPress! Now time to start customising your server with themes and plugins, and build that blogging site! 🙂

⇐ BackPageNext ⇒

Please share with your friends...
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

4 comments

  1. Thanks for this tutorial, Chris. I was just wondering, do you have any tips for helping to “harden” the web server? I guess I’m a tiny bit paranoid and wish to deter would be intruders …

    1. Hi Ben,

      The Nginx configuration is already very lean and should be secure (barring code vulnerabilities – remember to keep Raspbian and WordPress updated!).

      However, you will get lots of bruit-force login attempts though the standard WordPress Log In page. I decided to use a Google Authenticator plugin to enable two-factor authentication.

      Kind Regards,
      Chris.

  2. Excellent tutorial!
    I’m getting blank page with index.php like but not when i remove “!–” to
    What would be the steps to add multi-site subdomain such as – http://www.example.com and wiki.example.com?

    1. Hi idris,

      Thanks for letting me know about the “!–” for the phpinfo() page – that was a bug in my tutoral!! I’ve fixed it up now 🙂

      If you have followed all the steps in the tutorial, you should be setup for multi-site subdomains. You just need to run the configuration.

      The most important steps of the tutorial for WordPress multi-site are:
      PHP step 5 – adding *.example.com to the server_name list; and
      WordPress step 17 – adding the WP_ALLOW_MULTISITE line to wp-config.php.

      This bit is from memory (I need to write a tutorial on this bit too). Log in to the WordPress Dashboard and go to Tools > Network Setup. You should have the option of creating a Subdomain or Subdirectory site install.

      http://codex.wordpress.org/Create_A_Network

      Also, for a Subdomain setup to work, WordPress expects that you have DNS wildcard subdomains setup with your DNS provider.

      Hope that gets you started! 🙂
      Chris

Leave a Reply