Chat on WhatsApp
CR Guard
CloudRevol
← Back to Blog

Easy WordPress Installation With WP-CLI

Easy WordPress Installation With WP CLI

WP-CLI allows administrators and developers to install, manage and automate WordPress deployments directly from the command line. This guide demonstrates how to install WordPress quickly on Ubuntu 22.04 LTS.

WordPressWP-CLIUbuntuHosting

In This Guide

✓ Install WP-CLI
✓ Download WordPress
✓ Configure WordPress
✓ Install WordPress
✓ Plugin Management
✓ Theme Management
✓ User Management
✓ Database Optimization
✓ Backup Commands
✓ Best Practices

Prerequisites

  • ✓ Ubuntu 22.04 LTS
  • ✓ LAMP Stack Installed
  • ✓ Database Created
  • ✓ Shell Access With sudo Privileges
  • ✓ Domain Name Configured

Step 1: Download WP-CLI

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Step 2: Make WP-CLI Executable

chmod +x wp-cli.phar

Step 3: Move To Binary Path

sudo mv wp-cli.phar /usr/local/bin/wp

Verify Installation

wp --info

Step 4: Navigate To Web Directory

cd /var/www/html/

Step 5: Download WordPress Core

wp core download --allow-root

Step 6: Configure WordPress

wp core config --dbhost=localhost --dbname=wp_db_name --dbuser=db_user --dbpass=db_password --allow-root

Step 7: Install WordPress

wp core install --url="https://yoursite.com" --title="Your Site" --admin_user=wp_admin --admin_password=StrongPassword123 [email protected] --allow-root

Plugin Management

wp plugin list
wp plugin install wordfence --activate
wp plugin update --all
wp plugin delete plugin-name

Theme Management

wp theme list
wp theme install astra --activate
wp theme update --all

User Management

wp user list
wp user create editor [email protected] --role=editor

Database Optimization

wp db optimize
wp db check
wp db repair

Backup WordPress Database

wp db export backup.sql

WP-CLI Best Practices

🚀 Keep WP-CLI Updated

wp cli update

💾 Backup Before Changes

wp db export backup.sql

⚡ Automate Tasks

Use WP-CLI in deployment pipelines and scripts.

🔒 Avoid Root Access

Use --allow-root only when absolutely necessary.

Frequently Asked Questions

What is WP-CLI?

WP-CLI is the official command-line interface for WordPress. It allows administrators and developers to install, configure, update and manage WordPress websites directly from the terminal.

Is WP-CLI safe to use?

Yes. WP-CLI is maintained by the WordPress community and is widely used in production environments. Always verify commands before executing them on live websites.

Can I install WordPress without using the web installer?

Yes. WP-CLI can download WordPress, create configuration files, connect databases and complete the entire installation process without opening a browser.

How do I update WordPress using WP-CLI?

Use the command:

wp core update

How do I update all plugins using WP-CLI?

Use:

wp plugin update --all

Can WP-CLI manage WordPress users?

Yes. WP-CLI can create, update, delete and manage users, reset passwords and assign roles without using wp-admin.

How do I backup a WordPress database using WP-CLI?

wp db export backup.sql

This exports the WordPress database to a SQL file that can be restored later if needed.

Can WP-CLI improve WordPress performance?

WP-CLI itself does not speed up WordPress, but it simplifies maintenance tasks such as database optimization, plugin updates, cache management and automation.

Does WP-CLI work with WooCommerce?

Yes. WP-CLI can manage WooCommerce plugins, themes, cron jobs and WordPress core updates on WooCommerce stores.

Why do hosting providers use WP-CLI?

Hosting providers use WP-CLI to automate WordPress installations, migrations, updates, backups and large-scale management tasks across thousands of websites.

✓ Trusted Managed WordPress Hosting

Need Help Hosting Your WordPress Website?

Focus on growing your business while CloudRevol handles performance, security, updates, backups and migrations. Our AcceleronX hosting stack delivers exceptional speed and reliability without management fees.

🚀

AcceleronX Performance

Optimized stack for faster page loads and improved user experience.

🔄

Free Website Migration

Move your existing WordPress website with zero hassle.

🛡️

Security Protection

Malware scanning, firewall protection and proactive monitoring.

💾

Automated Backups

Daily backups with quick recovery options.

👨‍💻

Expert Support

Real engineers available when you need assistance.

💰

No Management Fees

Technical support included without additional management charges.