Install WordPress from the Command Prompt

Today I was thinking to myself, “Why do I have to upload all these files via FTP each time I install WordPress?”. I think this because I install WordPress probably close to a hundred times a year being a web developer who specializes in WordPress. Therefore, I decided to provide this tutorial on how to install WordPress from the Linux command line for those of you with Linux servers. Windows servers will have a very similar method, so this mostly applies there as well. I did this on an Amazon Linux AMI in an EC2 instance, but the instructions are almost the same for any Linux web server. Let’s get started!

Installing WordPress from the command line is a lot faster than downloading it, unzipping it and then uploading it using an FTP client such as FileZilla. Here is how to install WordPress on an Amazon Linux web server using an EC2 instance as I am in this example. You can make minor adjustments to the process for other servers. Here are the steps:

  1. Open up a command prompt – I use Putty for this. In putty, you enter the IP address or domain name of the server first. If you are using Amazon EC2, you will also have to point it to the public key file by clicking on SSH/Auth/browse and then selecting the location of your .ppk key file. After entering the IP or domain and providing a key file location if needed, click on “open” to open a command prompt and enter a username and password if required to get to a command prompt.
  2. Once you have your command prompt,  go to your web root directory which should be something like var/www/html and you can then type:    wget http://wordpress.org/latest.tar.gz from the command prompt to download WordPress from thier main repository.
  3. To untar, type:   tar xvzf latest.tar.gz -C /var/www/html   where /var/www/html should be replaced with your web root or where you want WordPress to reside in your file system. Or if you are in the correct directory where you want it you can simply use: tar xfz latest.tar.gz 
  4. WordPress will now be in /var/www/html/wordpress. If you don’t want to access http://yourdomain.com/wordpress and want WordPress at http://yourdomain.com instead, move it there by typing the following at the command line:
    mv /var/www/html/wordpress/* /var/www/html

Now you will have WordPress where you want it. You may have to play with permissions on some servers to get it to work right but this tutorial should have gotten you far enough to finish the job now. Good luck.

Leave a Reply

Your email address will not be published. Required fields are marked *