Top Banner
← 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.

✓ 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.