How to install WordPress locally on your Windows desktop using WAMP

How to install WordPress locally on your Windows desktop using WAMP

WAMP Server: How we can use it to edit WordPress sites offline

Now that we have a fundamental understanding of how a WordPress theme functions, it’s time to start using WordPress.

To run WordPress on any machine there are a few requirements:
  • PHP version 5.6 or greater
  • MySQL version 5.6 or greater OR MariaDB version 10.0 or greater
  • ‘Web server software such as Apache

This may seem like an intimidating list of software to source and download one-by-one, but that won’t be necessary. This is where WAMP comes into play!

What is WAMP and why do I need it?

WampServer is a Windows web development environment. It allows you to create web applications with Apache2, PHP and a MySQL database. Alongside, PhpMyAdmin allows you to manage easily your databases. An all-in-one package which contains everything that WordPress requires so our lives had suddenly become much easier. There are other clients for Windows such as XAMPP with the biggest difference being that WAMP runs on Windows, XAMPP is multi-platform. Aside from that it’s a matter of personal preference. They both provide you with an Apache-MySQL-PHP environment that runs pretty much the same under both systems.

Installing wampserver on Windows

Before installing WordPress you will need to download and install wampserver on your Windows desktop. Double click on the downloaded file and just follow the instructions. Everything is automatic. The WampServer package is delivered with the latest releases of Apache, MySQL and PHP.

You will need to choose the installation directoy for WAMP – The recommendation being that you do not install to “Program Files” but instead install it in a folder in the root directory as there could potentially be some permissions issues. I installed it to C:WAMP which worked fine. At one point during the installation, WampServer will ask for the location of the default web browser and text editor. WampServer will automatically choose notepad.exe and Internet Explorer as the default options but these can be changed if needed.

Once the installation completes successfully you should see the ‘W’ icon in your notification area:

wamp server icon in notification area
If you don’t you will need to start wampserver by finding the entry in your start menu. On Windows 8 my entry looked like this:

wamp erserver icon in start menuCreating a database for WordPress to use

Before installing WordPress you will need to create a database that WordPress can use. To do this we will need to access one of the wampserver features named phpMyAdmin. Easiest method of accessing this is to left-click the wampserver icon and click on phpMyAdmin:

phpmyadmin entry in wamp server

This will open a new browser window to http://localhost/phpmyadmin with a login prompt (Or you can just go to this URL manually). The default credentials here are root with no password. When you log in you may notice the big warning at the bottom of the page stating “You are connected as ‘root’ with no password, which corresponds to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user ‘root’.” Sounds scary but this is not a problem as long as this is only a local installation.

Click on the databases tab at the top of the page which will give you a list of the current databases and allow you to create a new database. In the ‘Create database’ menu enter a name for your database. I called mine ‘wordpress’ for simplicity sake:

wordpress database in wamp phpmyadmin

Download and install WordPress on Windows

Don’t worry we’re almost there! Now it’s time to go and grab yourself a copy of WordPress from their website. This will download a .zip file which you will need to unzip. Once unzipped you will find a wordpress folder which you will need to move to C:\WAMP\www. So my directory structure looks like C:\WAMP\www\wordpress. As soon as the copy completes you should be able to access WordPress via your web browser via http://localhost/wordpress. If you rename the wordpress folder to mysite then you would access it via http://localhost/mysite. You should be prompted to choose your language for WordPress. WordPress will then inform you that it is going to create a wp-config file using the provided information in the following steps. If for any reason this automatic file creation doesn’t work, don’t worry. All this does is fill in the database information to a configuration file. You may also simply open wp-config-sample.php in a text editor, fill in your information, and save it as wp-config.php.

One the next page you will need to enter your database details. Here is what mine looks like:

Wordpress database information using wamp

If you recall in the earlier steps I created a database named wordpress and we logged in using the default credentials of root and no password. If this works you can proceed to the next steps with a very friendly message:

All right, sunshine! You’ve made it through this part of the installation. WordPress can now communicate with your database. 

Now we can proceed with actually installing WordPress!

On the next page it will ask you for:

  • A website title – What is the name of your website? I just named mine offline.
  • A username for logging in with
  • A password for the above username
  • An email address

If the installation succeeds you should then be brought to the login prompt where you will need to enter the username and password you just created.

What now?

Whatever you want! You now have a fully functional installation of WordPress which you can use testing and offline development. Have fun!!

If you want to learn more take a look at a few of my other WordPress posts:

WORDPRESS – THE THEME HIERARCHY

HOW TO EDIT A WORDPRESS SITE OFFLINE ON YOUR WINDOWS DESKTOP USING WAMP

WordPress – The theme hierarchy

WordPress – The theme hierarchy

Theme hierarchy in WordPress – The anatomy of a theme

What is the WordPress theme hierarchy / template hierarchy? Well, let me explain..

My cousin asked me to develop a website for her Father’s business. Initially I thought this would be a great learning experience as I knew the basics of web development (HTML, CSS, PHP, and a bit of JavaScript) but had never completed a full website before. I slowly but surely realised just what I had landed myself into… !

To cut a long story short I decided it would be best to create and implement a WordPress theme. I’ve always heard this makes content management very straightforward and doesn’t require much knowledge of PHP / HTML for managing. Sounds perfect – Unless you’re the one developing the WordPress theme in which case it’s an absolute pain!

Had I known how difficult this would be I definitely would not have chosen to develop a WordPress theme for my first development job. The first hurdle I encountered was understanding the theme hierarchy. See what I did at first was simply hard code an index.php and styles.css and upload them as a “theme”. Then I tried to create a new page from within WordPress and that wouldn’t work – It kept bringing me back to index.php. I had also tried to create a contact.php with the company contact details – Now how do I get this to appear in WordPress? Hmmmm..

At this point I learned about the WordPress Theme Hierarchy. I didn’t really understand it, but I knew it was how WordPress determines which template file(s) to use on individual pages. So I kept trying numerous different implementations, none of which worked. Read multiple blog posts and just ended up confused. Until I saw the ‘template-loader.php’ being mentioned somewhere and this is what finally made me understand the theme hierarchy template. Show me in code and I’ll understand!

Let’s take a look:

wordpress theme hierarchy

Examining this file is what finally made everything click with me in terms of how pages get selected, and the reason why creating a new page in the WordPress GUI was not working. I only had an index.php! Basically, this code steps through each of the query context conditionals in a specific order, and defines the template to use for the first one that returns true. So in my case, only index.php was being found and so only the contents of index.php were being returned.

When a person browses to your website, WordPress selects which template to use for rendering that page. As we learned earlier in the Template Hierarchy, WordPress looks for template files in the following order:

  • Page Template — If the page has a custom template assigned, WordPress looks for that file and, if found, uses it.
  • page-{slug}.php — If no custom template has been assigned, WordPress looks for and uses a specialized template that contains the page’s slug. A slug is a few words that describe a post or a page. If the page slug is recent-news, WordPress will look to use page-recent-news.php.
  • page-{id}.php — If a specialized template that includes the page’s slug is not found, WordPress looks for and uses a specialized template named with the page’s ID. If the page ID is 6, WordPress will look to use page-6.php.
  • page.php — If a specialized template that includes the page’s ID is not found, WordPress looks for and uses the theme’s default page template.
  • index.php — If no specific page templates are assigned or found, WordPress defaults back to using the theme’s index file to render pages

I realise this is just the basic knowledge needed but I hope to discuss this further. Writing here helps me understand and get my thoughts clear.

Setting up the Plex container in unRAID 6

Setting up the Plex container in unRAID 6

unRAID: How to set up the Plex container

Now that I have unRaid up and running, in this post I am going to discuss how I went about adding the Plex container in unRAID 6. It’s a fairly straightforward process and didn’t cause me many headaches thankfully. I was originally running the server from my desktop but that wasn’t an ideal solution because I don’t leave my desktop on all the time.

Plex logo
Plex logo (https://plex.tv/)

Enabling Docker

The first step involved here was enabling Docker. If you’re not familiar with what Docker is, then take a look at my post where I explained how the application server works in unRAID.

To do this you simply navigate to the Settings tab, click Docker, and then use the drop down menu to enable Docker. PlexMediaServer is one of the default docket templates that comes packaged by lime-technology in unRAID 6. Navigate to the new Docker tab and you will see a section named ‘Add container’. From there you want to choose ‘PlexMediaServer’ under the limetech heading.

Plex docker template

There is only one required folder named ‘config’ for this docker but you’re going to want add more. The config folder does exactly what it says on the tin – Stores the configuration settings for this particular docker. I originally made the silly mistake of pointing this folder to a directory on the flash drive running unRAID. As soon as I rebooted the server I lost all the configuration I had spent the previous setting up – bummer. So for this directory you’re going to want to specify a directory on the array. I created a folder called ‘DockerConfig’.

In order to add any media you will also need to specify these directories too. I added one named /movies pointing to /mnt/user/Movies and another named /series pointing to /mnt/user/Series.

Plex container volumes

All that is left now it to allow unRAID to create the docker container. Simple as.

Configuring Plex

There wasn’t a whole lot of configuration required with Plex assuming you only want to use it locally within your home. If you plan on streaming media externally you will need to setup remote access. There are three steps required in doing this. The first step required is to sign into your Plex account, assuming you created one. If not you will need to register an account. The second is port forwarding – By default Plex will use port 32400 but you can specify another port if you prefer. You will need to forward this port to the IP of your server. Lastly you need to edit the settings of your plex server for remote access and manually specify whatever port you chose by ticking the box to manually specify.

unRAID 6 benchmarks

unRAID 6 benchmarks

unRAID 6 benchmarks

Now that I’ve got unRAID up & running I thought it would be interesting to run some benchmarks so I could determine what kind of speed to expect. Bear in mind this is without a cache device installed as I am waiting on my SATA controller to arrive before installing the SSD. Why? The optical drive SATA port runs at SATA I speeds, hence the reason for buying the additional SATA controller. This way I can have 4 drives in the bay slots and the cache drive hooked into the second SATA controller.

The program I used to run these benchmarks is called ‘CrystalDiskMark‘. CrystalDiskMark is designed to quickly test the performance of your hard drives. The program allows you to measure sequential and random read/write speeds for a specific drive. In order to test unRAID I needed to mount one of the unRAID NAS shares as a volume within Windows (N:).

This is 5 x 4GB passes with two WD Red 3TB drives, one of which is acting as a parity disk:

unRAID benchmark speeds

And here are the results with 5 x 1 GB passes:

unRaid benchmark speeds

I don’t think that’s too bad considering I don’t have a cache device set up yet. With a cache device I think I should be hitting much higher numbers because I won’t need to read/write from the disk array. Still slower than my desktop mechanical drive for both sequential read and write speeds but I doubt I will notice the difference when it comes to real world usage – Hopefully anyway. Parity certainly had more of an impact on the speeds than I would have liked. My internal 1TB WD Blue mechanical drive clocked the below speeds. Much faster for sequential reads and writes but a hell of lot slower for the 4k metrics.

Desktop drive benchmark speeds
I might revisit this in the future when the SATA controller arrives so I can set up my cache device. Watch this space!

SSD benchmark – My desktop SSD

SSD benchmark – My desktop SSD

SSD benchmark – My desktop SSD

Time for a SSD benchmark test! My desktop currently has a 120GB M500 Crucial SSD installed for booting my OS and related applications. It’s not exactly a top-of-the-line drive by any means but it’s more than enough for every day use. The spec sheet for this model claims I should be getting up to 500 MB/second reads and 400MB/s writes. So when I saw the results of my CrystalDiskMark SSD benchmark test I was underwhelmed to say the least. It’s worth nothing that this drive was 75% full at the time of the test so I understand this has the potential to affect speeds – But not this much!

desktop ssd benchmark

56MB/s sequential writes?? Time to figure out what’s going on here..

Troubleshooting steps

First off I needed to ensure that AHCI was enabled. AHCI stand for Advance Host Controller Interface. This is a hardware mechanism that allows software to communicate with Serial ATA (SATA) devices such as SSDs. Windows supports AHCI out-of-the-box by default but just to be sure I went into device manager to confirm the AHCI controller was enabled and running.

ssd device manager

So it’s enabled – Great! Now I just need to confirm that the SSD is being managed by this controller. Right click the controller, choose properties, then navigate to the ‘Details’ tab. In this section you are greeted with a drop down menu where I chose ‘Children’ and could see my SSD listed so AHCI is definitely enabled.

ssd controller properties

Then I needed to confirm that ‘TRIM’ was enabled. TRIM support is essential for an SSD to run the way it should to avoid slow writing times. This command allows an operating system to inform a solid-state drive (SSD) which blocks of data are no longer considered in use and can be wiped internally. To test if this is enabled you can run the command “fsutil behavior query DisableDeleteNotify”. If this returns as 0 then TRIM is enabled.

The next step was to make sure I was at the latest revision of the firmware. The firmware download for my SSD comes as an ISO package so I stuck it onto a USB using unetbootin and made a backup of my current SSD before proceeding – I’ve had enough bad experiences to warrant backups! Thankfully the installation completed successfully without any issues and I was upgraded from MU03 to the MU05 revision. Rebooted and went through another SSD benchmark with CrystalDiskMark. No improvement whatsoever.

ssd desktop benchmark

So considering there was little to no change in the speeds I figured I would confirm the results with another benchmark tool Atto disk benchmark. Now I’m seeing more along the lines of the expected speeds! At my maximum I reached over 500MB/s reads and maxed out about 140MB/s writes. I’m still a little disappointed with the write speeds though but this is a start at least.

atto disk benchmark
As this was an SSD I was recommended to test out ‘AS SSD Benchmark’ which also confirmed that AHCI was enabled and my alignment was okay. This reported speeds were pretty much along the same lines as what I’ve seen so far with write speeds being reported between 113MB/s and 134MB/s. Still disappointing.

ssd benchmark

I went ahead and asked someone else to run the same test on their Crucial M4, which is an older model than mine. He was clocking double my write speeds with similar read speeds using the same test config as me. Only other difference between his test and mine was that his drive has higher total capacity with about 50% free whereas I only had 25% free. I went about reducing the space consumed on my drive and then re-ran the test only to receive roughly the same numbers again..

The conclusion

Sorry to get your hopes up folks! After a bit more digging I realised this was down to false advertising rather than anything being wrong with my drive / configuration. The M500 series drives are capable of up to 400MB/s write speed at the higher capacity spectrum of drives. My specific model – CT120M500SSD1 – I found is only capable of about 130MB/s which more or less matches up with the speeds I was recording in some of the benchmarks. Here is a screenshot from the product page on newegg:

newegg specifications ssd

If you found this interesting, take a look at my unRAID benchmark tests also!

 

Installing unRAID 6 on my HP Proliant Gen8 Microserver G1610T

Installing unRAID 6 on my HP Proliant Gen8 Microserver G1610T

Installing unRAID 6 on my HP Proliant Gen8 Microserver G1610T

As discussed in my previous posts I decided on unRAID for my HP Microserver OS. For now I simply have a trial version but I can already tell I will end up buying a license. The installation process is super easy as you will see below:

Downloading the unRAID image

Before going about installing unRAID I was under the impression that it would come in an ISO package like every other OS. However unRAID just comes as a package of files with a ‘make-bootable’ executable inside. Preparing the USB is easy! First of all your USB needs to be formatted to FAT32 and the volume label must be set to UNRAID in capital letters.

Microserver unRAID USB format

Then simply transfer all the files to the root directory of the USB (i.e. not in a folder) and then run the ‘make-bootable.bat’ file as administrator (Right click -> Run as administrator). A CMD prompt will appear just asking you to confirm you want to proceed – Press any button to continue and hey presto job done.

Microserver unRAID make bootable

Now you just need to eject the usb from your computer, connect it to the internal USB slot of the microserver and boot it up. Mine booted into the USB straight away without editing any BIOS options of my microserver but your mileage may vary. After successfully booting up I was able to navigate to http://tower from my desktop and was greeted with the web GUI. It really was that easy!

Microserver unRAID GUI

unRAID Licensing

Before you’re able to do anything you will need a license key. Upon first installation you’re entitled to a 30 day evaluation period to test out the software. To activate your license navigate to ‘Tools -> Registration’. You will need to enter in your email address so the license URL can be sent to you which you then paste into the box provided.

Microserver unRAID registration

After that you’re pretty much good to go! Stay tuned for more unRAID and microserver posts!

New components for my HP G1610T Gen8 Microserver – Upgrades!

New components for my HP G1610T Gen8 Microserver – Upgrades!

G1610T Gen8 Microserver upgrades!

I decided it would be best to invest some more money into my G1610T Gen8 Microserver rather than trying to struggle through with the limited resources available in the server itself. I also needed some hard drives to fill up the drive bays for my NAS.

What did I buy?

2 x 3TB WD Red NAS drives
1 x 2 Port SATA Controller
3 x Cat6a ethernet cables
2 x 8GB ECC DDR3 RAM

G1610T Gen8 Microserver components

The NAS drives will obviously going into the bays available at the front of the server so I can set up my NAS. As I only have two drives at the moment this means the array will only have 3TB usable space due to the parity disk. Realistically that is all I need to start with as my media collection is only about that large at the moment. The SATA controller card I bought because the internal SATA connector only runs at SATA I speeds while this PCI card runs at SATA III. This will be used to connect up my cache devices if I ever get around to implementing that.

G1610T Gen8 Microserver sata controller

The requirements for running unRAID are pretty minimal compared to FreeNAS with unRAID only requiring about 1GB of RAM if you have the intention of running it as a pure NAS system. However once you start playing around with containers and virtualising machines you will understandably get tight on resources. With that in mind I decided it would be best to upgrade to 16GB RAM which is the most this machine will accept. This didn’t come cheap at about €160 for the two stick set – ECC RAM is bloody expensive and is unfortunately a necessity for this particular model.

G1610T Gen8 Microserver ram

Lastly I decided to invest in some decent cat6a cables for connecting up my server and desktop to the network along with a 1Gb switch. I’ve been running on cat5e cables for quite a long time because in all honesty I just had no requirement for the additional benefits in cat6 cables. Now that I will be regularly transferring files to and from the NAS I felt the additional bandwidth might be beneficial.