Debian Linux Stretch – Installing WordPress

Ok, earlier I installed Debian Linux Stretch using this guide.

It was wordy because I wrote it, and it had 26 steps because I wanted to make it absolutely as easy as making breakfast.

It worked because this is being written on that machine.

Next I installed the LAMP stack using this guide.

Not so wordy, and again, that’s this machine.  LAMP is a web server, and if you’re coming here to find out how to install WordPress, you already knew that.

Now I am getting ready to install WordPress.  I’m doing it as I am writing, so assuming I have the right information to guide me, I’ll have success.  I am using this guide to help me.  Also if I haven’t made a thorough hash of installing LAMP, it should “Just Work”.

WordPress is a pretty easy install, I’ve done it before on a Cloud Server, and I’ve done it before on a machine here, and a couple of random places in the past.

My install here expects a few basic things.

  • You followed my guides to build the server and it is running.
  • You have physical access to the server to simplify the process.
  • Commands will be run from the terminal as root.

Creating the database for WordPress:

A) Log In as Root to Mysql or MariaDB

  • mysql -u root -p

B) Create a regular user for WordPress – replace userpassword with a much better password!

  • CREATE USER ‘wpuser’@’localhost’ IDENTIFIED BY ‘userpassword’;

C)  Create wp_database

  • CREATE DATABASE wp_database;

D) Grant the WordPress User full access to the wp_database

  • GRANT ALL ON `wp_database`.* TO `wpuser`@`localhost`;

E) Flush your privileges and exit MySQL/MariaDB

  • exit;

Get WordPress and Unpack it

A) Download the package into your ~/Downloads directory

B) Unpack the package into the WordPress directory

  • tar xpf latest.tar.gz

C)  Remove everything in your web server’s html directory and copy the WordPress package to it.

  • REMEMBER:  If you have anything important in that /var/www/html directory it will be gone so back it up if you need it
  • rm -rf /var/www/html
  • cp -r wordpress /var/www/html

D) Set permissions and ownership for the WordPress install to function as designed.

  • chown -R www-data:www-data /var/www/html
  • find /var/www/html -type d -exec chmod 755 {} \;
  • find /var/www/html -type f -exec chmod 644 {} \;

Set Up WordPress

A) Access the process.  The WordPress setup is Browser Driven.  Surf to your localhost, or the correct web address URL to get to it.  In my case it is in Firefox:

B) Supply wp-admin the correct information.  In my case:

  • Language: English
  • (OK)
  • (Let’s Go)
  • Database: wp_database
  • Username: wpuser
  • Password: userpassword (Yes, Literally ‘userpassword’)
  • Database Host: localhost
  • Table Prefix: wp_
  • Click Submit


C) Run The Install by clicking the button.

The Five Minute WordPress Install Process

At this point, you launch into an install to create the basics for your WordPress website.

A) Information Needed:

  • Site Title – This is the name of the site you wish to create.
  • Username
  • Password
  • Confirm use of weak password if this box appears.
  • Your Email
  • Search Engine Visibility (Click the check box if you do not want to show in searches)
  • Click (Install WordPress) button

B) The Success page will show you your WordPress username and indicate your chosen password for you to proceed.

  • Click Log In

Now you can do a happy dance.  You’re done.  Go create a site.

WordPress will put a red button up for each thing that it needs to have updated.

At this point you may be creative and make a site.  You may want to explore templates, but a basic site can be slapped together quickly.

The results are that if you are on that machine, and surf http://localhost you will get a basic page with the information that you put in.

On the other hand, this is not perfect.  I surfed it from my phone and another computer here, and I got all the text but not the template.  So you will probably have some configuration to do.

But… This is good enough to get started.

Debian Linux Stretch – Installing The LAMP Stack

This Linux Thing is no more difficult than your Windows Thing.  Let that sink in.

It’s an operating system.  You have probably been using Windows since you were a wee brat.  That is bound to be years and years of training.  I’ve been using Linux since the mid 1990s, probably earlier.

Oh and I am still learning.  I like to learn so that’s why I keep coming back.

One very important point – It’s all about how good you are at finding the Correct Instructions.

I spent three hours going through some instructions that were from the Debian Wiki until I hit a road block.  That led me to realize that the Debian Wiki has an incomplete article on how to install the LAMP Stack on an older version of the operating system.  Even if I had read it through top to bottom first, I would not have found that out until I actually started using it.

LAMP is what you are installing.

  • L is Linux.  If you got here, you have it or are researching it.  Debian, or a derivative like Ubuntu.
  • A Is Apache.  That is the actual web server.  You can write basic web pages if you have this installed.
  • M is MySQL or MariaDB.  It’s the database so you can write data driven pages.
  • P is PHP or it could be Python or Perl.  That’s your scripting language.

“Yeah, I know, me too.”  That was basic stuff for people just learning.

At any rate, I went back to the web and found another page from which I am using for my own instructions.  If something isn’t quite right with what I am writing below, then check back there.

This is a recipe so I can come back later when I get interested in trying this on another machine.

Importantly, there is a design strategy called “Don’t Break Debian”.  Don’t install anything outside of Debian’s Repositories or you may end up with a broken install.  While that is a bit impractical in many cases, and I have gone “outside” Debian, things do sometimes not work or they work strangely.

If you find an install somewhere that says add a repository, then your caution flags should go up.

On the other hand, it also implies that you should use Debian’s information first before you go outside to another site.  Since I am writing this, it shows that I don’t agree.  Their info was flawed.

Here are the instructions, as brief as possible:

All commands are done from Terminal as Root.

Prep – Get the Computer up to date.:

  • apt update
  • apt upgrade
  • apt dist-upgrade


  • apt install mariadb-client mariadb-server
  • mysql -u root -p   (add a root password)
  • CREATE USER ‘user’@’localhost’ IDENTIFIED BY ‘password’;
  • GRANT ALL PRIVILEGES ON newdb.* to ‘bill’@’localhost’;
  • quit


  • apt install php7.0 php7.0-mysql


  • apt install apache2 apache2-mod-php7.0

Testing the Server

  • mousepad /var/www/html/index.php
  • enter this on the first line, save, and quit:  <? php phpinfo( ) ?>
  • firefox localhost/index.php
  • Result is you will see information about your system in Firefox, or chrome if you must.


  • apt install phpmyadmin

Answer following questions by hitting space and then tab to OK and enter:

  • Web Server: Apache2
  • MySQL Application Password – same as you created earlier

Test with the following to get to the PHPMyAdmin login page:

  • firefox localhost/phpmyadmin

That’s it.  You’re done.  Took me less time than installing the operating system which was under a half hour.  Granted I’m on a fast computer and reasonable internet speeds.

There is one more thing to consider.  I am not worried about anyone hacking my server because this is not exposed to the internet.  If you are going to proceed with this server serving pages to the world, you will most certainly need to get the security brought up to date.  I don’t believe that this server even has a firewall active at this point.

Is Anyone Writing Documentation Anymore?

So the last exercise I had done before Hurricane Irma hit was to take a computer and completely install a new operating system onto it.

I will be doing that again today, from my own instructions.


Sure, it’s a bit esoteric, some people are good at reading between the lines.


The problem with that is that you end up spinning your wheels and finding that something you assumed, you assumed wrong.


For the record, when I write documentation, I write it as I do it. That way I know it actually works.


It may have taken 26 steps once you had all the pieces, but if you had my hardware and the right software, you’d have a nice happy laptop running Debian. Thinkpad Laptop, X201 or fairly similar, although the version of Debian I used (Non-Free) was fairly liberal with getting what you need for many more laptops. Evil Wifi Drivers not withstanding.


The next step was to find documentation to install a web server.


The trick with installing complex software these days is that you basically have to find the right documentation. Or to be more precise, the correct documentation. Documentation that is complete and actually will work.


Oh and of course you personally have to read and understand what you are reading. No distractions allowed.


However, it is rare that you will find exactly the right documentation to do what you want. Often software is updated and that documentation you used two years ago to do that exact thing no longer works.


Highly common in the open source world, some very minor tweak will change where the files are and you are back online doing a search for what you were looking for.


In the consumer software world, you have a similar situation where the documentation was only partially updated since it was originally released. Think Windows XP vs Windows 8.1 vs Window 10. Things just moved around drastically within Windows itself let alone functionality.


I got “caught short” with trying to install a web server. Did it before. No problem. Since it is an open source project, you get what you pay for sometimes. Following the wrong guide I got the entire web server working. I just don’t have any passwords for anything.


As they say on a football field: Drop Back 5 and Kick.


That would be American Football. I never played Soccer, at least not for any length of time. All that running around annoyed me.


So at some point I’ll re-attempt that mess. FInd another tutorial that promises to install the LAMP stack and write down what I did.

Or I will find that one bug and fix it all. My choice, after all.


That is why I keep this blog. Many times I need to do something more than once. Create a Linux Web Server, save it off, then reproduce the results on a different computer a year later.


So when I post a long diatribe on how to do this and the other thing, I’m doing it for Future Me. So I don’t end up banging my head on a wall.


Like Today. I got it wrong. Happens. Time to start over.


For now, I’ll just go look for the football. Maybe the dog will chase it around the yard. Blow off some steam. Finish my Spanish for the day.

Try, Try again.