"Getting" The Latest WordPress Installation From The Command Line

There are several ways to install WordPress, I have found that installing it via the command line is fast and efficient. Don't worry, it's easy! This is not an exhaustive tutorial on the command line, but simply how to copy the WordPress code on your server without downloading it to your computer.

First off - this is the Windows version of this tutorial as that's what I'm working off of right now (and so are 75% of the readers here according to Brandon's stats!). If anyone has notes on how this differs in an Apple OS environment, let us know in the comments!

Step 1 Set up Putty

First, I want to mention something that may be confusing to someone who hasn't worked much with servers, or hosts. You may work on a windows based computer, but chances are, you website is running on a Linux server. While there are Windows servers, most run on Linux. Your host can tell you if you are not sure.

One of the most popular and simple ways to utilize the command line on Windows, is through a program called "Putty" (http://www.putty.org/). The installation of Putty is well documented, and simple. There are several different downloads at the Putty page, and unless you are well versed in various installation methods, I recommend using the putty.exe download. It will self extract and install when clicked.

Once you have installed Putty, it is easy to start a session. You click on the shortcut and you will see a dialog box. This dialog box allows you to control everything PuTTY can do. You don't usually need to change most of the configuration options. To start our session, all you need to do is to enter your domain name of the website you want to install WordPress on in the `Host Name' box. On the left menu, you will click on "data" under Connection. Where it says "Auto-login Username", you will put the username you use to login to your domain (used in FTP also).

Once you do this, hit Open, and another window will open. This is the Command Line. It will ask you for your password. You WILL NOT see the letters as you type in the password, but they are there.

QUICK TIP: I like to open Notepad, and type out the password, then copy and paste it into the command line window, since you can't see the password as you type it. This can save you from typing in the wrong password by accident. Also, on the command line, when you right click, it automatically pastes whatever you have copied, or if you have something selected in the command line, it will copy/paste it. For more information, you can reference the Putty website.

When you finish typing the password, hit ENTER. If you have used the correct information, you will see a dialog in the command window, that tells you the username you are using, the last login, and some other data. The you will see where you are in your host. This may look like: [username@domain ~]$. This is where you start typing. There is a good resource for basic commands at http://www.tuxfiles.org/linuxhelp/fileman.html

Important Note!: It is very easy to wreak havoc on the command line. With the wrong term, you can erase great amounts of data, and there is not an magical undo function, so take care with what you do. It is very important that you follow this tutorial exactly, and if you want to venture further into the command line, learn the basics at least first. Complete websites can be erased with a simple command. This is not an exhaustive tutorial on the command line. One resource is http://linuxcommand.org with a guided tour at http://linuxcommand.org/lts0040.php.

Step 2 Getting WordPress

Now the really fun part. Grabbing the current WordPress installation with a line of code!

Getting the current installation of WordPress without downloading it

Now, on your command line, make sure you are in the directory you want to install WordPress in. Remember, many hosts have a public_html or ht_docs folder that houses your "root", so make sure you are inside that if applicable. If you want to install in a subdirectory, if it doesn't exist, create it by typing

(where foldername is the name of the directory you are creating). This stands for "make directory foldername". If the folder already exists, type

which stands for change directory foldername. Once you are in the directory you want to install WordPress in type:

and hit

You will see a lot of lines of code go by, and voila! WordPress' latest version is now yours!

Now you need to extract it, you have what is called a "tarball"; which is much like a zip file. To extract it, type

and it will extract the WordPress files. Now you will have a folder called WordPress with all the files in it. We need to take the files out of the folder, so now we will change directories to the WordPress folder. To do that, we type

(change directory WordPress), and now we are inside the WordPress directory. Now we type

which will move everything (*) to the folder above the one you are in, which should be the directory you want your installation. We are still in the WordPress directory, so to check that the files moved, we can type

which means show directory, and if we see nothing, we are good. If the files are still there, we did not succeed in moving them, so we will try again. Now that the files are moved, we can type

and we will be moved to the directory above (AKA parent), where the files are. Again, we can type

to ensure they are there. If so, we can

to get rid of the WordPress folder which is empty, and we are done. We can now go to the browser and begin the installation process.

Step 3 Setting Up Your Database

If you have not already setup your database for the WordPress installation, you will need to do that now. If you use Cpanel, you should have easy access to the MySQL database installer. Create the database, (I like to copy the username/password details to notepad for later). If you don't use Cpanel, and don't know where your database installer is, contact your host.

Step 4 Installation

Now point your browser to the address of the WordPress installation. You can now begin the installation of WordPress, and you didn't have to download the code! I will be writing more about custom installations in a later tutorial. For now, enjoy the time you save with your installations, and hopefully for some of you, this will open a whole new world of capabilities and learning!



Related Articles