Advertisement
Creative Coding

"Getting" The Latest WordPress Installation From The Command Line

by

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

mkdir  foldername

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

cd foldername

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

wget http://wordpress.org/latest.tar.gz

and hit

ENTER

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

tar -zxvf latest.tar.gz

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

cd WordPress

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

 move -i * ../

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

ls

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

cd ..

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

ls

to ensure they are there. If so, we can

 rm -rf WordPress

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 Posts
  • Code
    Web Development
    How to Use New Relic With PHP & WordPressRelic retina preview
    Today we will look at how to monitor a PHP application using New Relic. More specifically we will set up a basic WordPress installation and get some performance data about it, in the New Relic dashboards.Read More…
  • Code
    Web Development
    Easily Deploy Redis Backed Web Apps With DockerDocker wide retina preview
    Learn how to setup and deploy a Redis powered Python web app using Docker.Read More…
  • Code
    WordPress
    An Introduction To Deploying WordPress with MinaImage400
    As a PHP application, WordPress is usually deployed by a very old method: uploading files via FTP. We have some deployment tools, but they often requires some type of Ruby skill. For example, one popular, powerful tool is Capistrano, but it's also very heavy with many Ruby/Rails related features. I also think that it's little bit tricky to install Capistrano for a PHP developer without any Ruby knowledge. So what options do we have as WordPress developers? In this tutorial, I will introduce you Mina: A small, light tool aims to fast deployment and server automation.Read More…
  • Code
    PHP
    Setting Up a Local Mirror for Composer Packages With SatisComposer retina preview
    Installing all your PHP libraries with Composer is a great way to save time. But larger projects automatically tested and run at each commit to your software version control (SVC) system will take a long time to install all the required packages from the Internet. You want to run your tests as soon as possible through your continuous integration (CI) system so that you have fast feedback and quick reactions on failure. In this tutorial we will set up a local mirror to proxy all your packages required in your project's composer.json file. This will make our CI work much faster, install the packages over the local network or even hosted on the same machine, and make sure we have the specific versions of the packages always available.Read More…
  • Code
    PHP
    Validation and Exception Handling: From the UI to the BackendProcedural to oop php retina preview
    Sooner or later in your programming career you will be faced with the dilemma of validation and exception handling. This was the case with me and my team also. A couple or so years ago we reached a point when we had to take architectural actions to accommodate all the exceptional cases our quite large software project needed to handle. Below is a list of practices we came to value and apply when it comes to validation and exception handling.Read More…
  • Code
    Articles
    Coding With KodingCoding with koding retina preview
    Cloud IDEs have been around for a little while now, and they have been pretty good for things like pair programming, or cases where you want to code consistently no matter where you are. Koding just came out of private beta, and they would like to take this notion a couple steps further, with their "cloud ecosystem". In this article we will take a look at what Koding is, as-well as some of the benefits you can get from using it.Read More…