Quantcast
Channel: YinPress » Tips & Tricks
Viewing all articles
Browse latest Browse all 19

Installing WordPress Locally on OS X

$
0
0

How do you run WordPress locally? Of course, you can open any old HTML file in your browser, but WordPress runs on PHP, so how do we setup your machine to parse these files? In today’s tutorial, we’re going to show you how to prepare your Mac for WordPress.

Choose your Software

We need to install an *AMP stack. Depending on your operating system, you might have MAMP, LAMP, or WAMP. The core part of this is AMP: Apache, MySQL, and PHP.

For OS X, there are a large number of options, but we’re going to cover two.

MAMP

MAMP is very easy to get started with, and definitely my go-to for local WordPress development.

Once you’ve downloaded MAMP, install the package by running the next next next next yes next gauntlet.

And that brings us to MAMP. It’s a very simple interface and will start the servers when opening.

By default, MAMP will run an Apache server in the folder /Application/MAMP/htdocs. Though we’ll be going into this in a later lesson, if you want to challenge yourself, see if you can’t figure out how to get WordPress running in that folder.

When the servers are running, the MAMP Web Start page will open up, and provide information on the services currently running. All of the packages we’re looking at feature something of this sort.

You’ll also note phpMyAdmin in the top navigation bar. This is a common feature over the different software packages that we’re installing today, and will be covered when installing WordPress.

MAMP Pro

MAMP has a big brother of sorts, MAMP Pro, and on launch it will que you to try it. MAMP Pro provides a lot of additional features over MAMP, but none of it is absolutely required for what we’re doing. That said, I still encourage you to open MAMP Pro at some point and play around with it, but know that it will be hard to go back if you get used to it, you’ll love the additional functionality.

XAMPP

Download and install XAMPP, just as simply as we did with MAMP. When installed, open it up, and start the Apache and MySQL servers.

XAMPP is another great option, and not too dissimilar to MAMP, inclusive of the simple interface. However, it doesn’t allow you to change the folder the server runs in but very much like MAMP, you can put your files in /Applications/XAMPP/htdocs/. When the servers are up, you can visit http://localhost to open the starting XAMPP screen.

Choose your preferred language and head through to the welcome page, and from the menu on the left, select Status.

It’s just a rundown of what’s running (yep, even Perl) from XAMPP. Again, you’ll note phpMyAdmin is available down the bottom of the left-hand menu.

Downloading WordPress

Hop over to WordPress.org and start downloading. Once complete, extract the contents, then, copy the WordPress folder into the directory that your servers are running. The default for OS X and MAMP is /Applications/MAMP/htdocs.

Setting Up

With WordPress extracted, you’ll be able to open http://localhost:8888/wordpress and will be greeted with the following.

Naturally, hit “Create Configuration File,” where you’ll then be given a list of the information you need.

Click “Lets Go!”

Now, we need to create a database and get some credentials ready!

Introducing phpMyAdmin

phpMyAdmin is a tool provided with most AMP stacks, it helps simplify creating MySQL Databases, users for them, managing user privileges, and so on. There should be a way to easily access this, usually a link from the web-start page of your AMP software. MAMP has a link in the top navigation of localhost/MAMP, XAMPP, through the equivalent page, but on the left hand navigation, and Ampps has it on it’s web start page.

Here’s the phpMyAdmin start page, and what we want to do is create a new database straight up, fortunately it’s possible to do this from here.

I’ve chosen to name my database yinandyang. Simply enter that as the name, and click create. If all is well, you’ll see a confirmation message like so

For the purpose of this exercise, we’re going to create a new user, so navigate to the Privileges tab, and select Add a New User

You can enter any username and password that you like, just make sure you use the ‘local’ host setting. Also be sure to grant all privileges on the appropriate database, which is selected by default. Once you’ve filled that out, scroll down to the bottom, and on the right hand side there’s a “Go” button

If all is well, you’ll have another confirmation message available.

Back to WordPress

Now, we need to go back to the tab/window where we left the WordPress setup, and just have to fill in the fields with our values and hit submit.

Table Prefix and Security

A note on the Table Prefixing. You are welcome to leave it as wp_, however, it’s very insecure to leave wp_ as the default database prefix in the real world. It’s good to get in the habit of changing it from the get go.

Hit submit, WordPress will make sure it can connect to the Database,

Now it’s time for filling in more fields, choose whatever you’d like for this.

Click through, and we’re almost ready to log in!

Congratulations!

And that’s it! You’ve just installed WordPress on your local machine! Not to mention creating a database and user for it. Make sure you remember or save the username and password, because we’re going to be using this install to create our theme.

Alternatives

Of course, there are a wild world of alternatives, there’s the Bitnami MAMP Stack, which comes with the Zend, CakePHP, and CodeIgniter frameworks. Another option is AMPPS, providing the same functionality as MAMP/XAMPP, and we’ll be demonstrating use of this with Windows.

If you’re feeling particularly adventurous, you can install the required services independent of one another with command line applications such as Homebrew. However, it will require familiarity with the command line, Apache configuration, and MySQL, some of which is covered in Preparing your environment on Ubuntu

The post Installing WordPress Locally on OS X appeared first on YinPress.


Viewing all articles
Browse latest Browse all 19

Trending Articles