Installing WordPress with WP-CLI

I’ve been wanting to get a blog set up for a while now to start documenting my progress as I learn about Web development. Mission accomplished? Here’s how I did it.

My first step was choosing a domain name. Always tricky. I settled on and registered it. I don’t use my hosting provider as a registrar so I had to point the new domain to my providers DNS servers.

Once all that was taken care of, I logged into my web server via SSH and got to work installing WordPress. My provide provides a handy GUI tool for WordPress installations, but I generally prefer to use the CLI when I can. My hosting provider has WP-CLI set up on my server so the installation process is super easy.

I navigated to the folder where I wanted to install WordPress and entered the following command to download the WordPress core files:

wp core download

Then I logged in to the cPanel for my server and set up a new MySQL database for the WordPress installation.

Once the database was configured, I moved on to setting up the WordPress config file. Once again, WP-CLI makes this simple with the following command:

wp config create --url=domainNameGoesHere --dbhost=localhost
--dbname=databaseNameGoeshere --dbuser=databaseUserName

If you are following along, you’ll want to insert your database information in the relevant fields.

The last step is to execute the WordPress installation.

wp core install --url=yourDomainName --title="Your site title" 
--admin_name=yourAdminUserName --admin_password=yourAdminPassword  

Again, you’ll need to insert your information in the appropriate fields.

That’s it! WordPress has been installed. Congrats!