Here is a really simple way to manually manage WordPress installations on Ubuntu.
My previous WordPress (and related) guides
- Setting up Google Analytics on your website
- Deploying WordPress to a Vultr VM via command line
- Add Google AdWords to your WordPress blog
- Securing an Ubuntu VM with a free LetsEncrypt SSL certificate in 1 Minute
- Improving the speed of WordPress
- Optimize images automatically in WordPress
- Essential WordPress Plugins
- Why choose a WordPress website over a static HTML site edited with Dreamweaver
- Building a WordPress site from scratch
My Server Setup Guides
- Useful Linux Terminal Commands
- Moving WordPress to a new self managed server away from CPanel
- Setting up a Vultr VM and configuring it
- Creating and configuring a CentOS server on Digital Ocean
- How to buy a new domain and SSL cert from NameCheap, a Server from Digital Ocean and configure it.
- Creating an AWS EC2 Ubuntu 14.04 server with NGINX, Node and MySQL and phpMyAdmin
- The quickest way to setup a scalable development ide and web server
- Adding a commercial SSL certificate to a Digital Ocean VM
Go to https://make.wordpress.org/cli/handbook/installing/ and read the install instructions.
How to install wp-cli on Ubuntu
First read this post too install WordPress from the command line. You should install WordPress here.
Telnet to your server (SSH)
Did the file download?
Execute
Make the file executable and move it to /usr/local/bin/wp
Now you can run wp-cli by typing the following from the command line
Read the official wp-cli quick start guide https://make.wordpress.org/cli/handbook/quick-start/
Ever since I moved my WordPress to a self-managed server I have not been able to update my plugins and I have not installed an FTP server (by choice for security reasons).
Let’s see if we can update plugin with wp-cli
Yes, it worked
I have now updated all active plugins from one command line.
I have been unable to update WordPress itself since I moved my website (without an FTP server).
Let’s try and update WordPress with wp-cli.
Run this command.
Success
Awesome 🙂
Now time to create a few executable bash files to update plugins and WordPress files in future.
Update WordPress Plugins Bash Script
Contents
Make Executable
Update WordPress Bash Script
sudo nano /scripts/updatewordpress.sh
Contents
Make Executable
More Commands
More commands can be found here: https://developer.wordpress.org/cli/commands/
Information on exporting tables can be found here https://developer.wordpress.org/cli/commands/db/export/
Site Wide Search and Replace
Results
If you are updating past pages and post links do include https look for www alos
When you are ready to run the replace remove the
As always, backup your database and files before you make changes.
This was the easiest way to update my WordPress site and force existing links use https links. Of course, you can downgrade https links if you don’t want to have https anymore.
Troubleshooting
wp needs to be run from the root folder of your web server (or it will report an error). You can specify a path location as a parameter too ( –path=’/path/to/wordpress’)
All the following the wp command if you are logged in as root (not recommended for security reasons).
Adding “Advertisement” text above Google ads in all WordPress pages and posts, read this guide on setting up AdSense on your blog (unless you go Auto Ads).
Official Troubleshooting guide here
I had an issue where I received error messages running the wp tool, iI fixed this editing my php.ini file and changing this..
memory_limit = 128
to
memory_limit = 128M
The M made all the difference after I restarted PHP/NGINX.
to this
Thank You, Kerry Hoath for the tip on this awesome cli tool.
fyi: WordPress fixed a SQL injection vulnerability and the wp-cli tool helped me update WordPress from the CLI.
Update Themes
Update Plugins
Update WordPress Core
Donate and make this blog better
Ask a question or recommend an article
[contact-form-7 id=”30″ title=”Ask a Question”]
v1.5 Updating WordPress themes, plugins or core
v1.42 added ‘cd /www’ before calling wp cli.