DEV Community

MuthuKumar
MuthuKumar

Posted on • Edited on

Install WordPress on Ubuntu using the terminal

To install WordPress on Ubuntu using the terminal, you can follow these steps. This guide assumes you have a LAMP (Linux, Apache, MySQL, PHP) stack already set up on your Ubuntu server. If not, you'll need to set up the LAMP stack first.

Here's how you can install WordPress:

  1. Update and Upgrade Packages: Open a terminal and update the package list and upgrade existing packages:
   sudo apt update
   sudo apt upgrade
Enter fullscreen mode Exit fullscreen mode
  1. Install Additional Packages: Install the required packages for WordPress:
   sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
Enter fullscreen mode Exit fullscreen mode
  1. Create a MySQL Database and User: Log into MySQL and create a database and user for WordPress:
   sudo mysql
Enter fullscreen mode Exit fullscreen mode
   CREATE DATABASE wordpress;
   CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
   GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
   FLUSH PRIVILEGES;
   EXIT;
Enter fullscreen mode Exit fullscreen mode
  1. Download and Configure WordPress: Navigate to your web server's root directory (usually /var/www/html):
   cd /var/www/html
Enter fullscreen mode Exit fullscreen mode

Download the latest WordPress package:

   sudo wget https://wordpress.org/latest.tar.gz
Enter fullscreen mode Exit fullscreen mode

Extract the archive:

   sudo tar -xzvf latest.tar.gz
Enter fullscreen mode Exit fullscreen mode

Rename the WordPress directory:

   sudo mv wordpress your-site-name
Enter fullscreen mode Exit fullscreen mode

Set ownership and permissions:

   sudo chown -R www-data:www-data your-site-name
   sudo chmod -R 755 your-site-name
Enter fullscreen mode Exit fullscreen mode
  1. Configure WordPress: Copy the sample configuration file:
   cd your-site-name
   sudo cp wp-config-sample.php wp-config.php
Enter fullscreen mode Exit fullscreen mode

Edit the configuration file:

   sudo nano wp-config.php
Enter fullscreen mode Exit fullscreen mode

Set the database details you created earlier:

   define('DB_NAME', 'wordpress');
   define('DB_USER', 'wordpressuser');
   define('DB_PASSWORD', 'password');
Enter fullscreen mode Exit fullscreen mode

Save and close the file (Ctrl+O to save, Ctrl+X to exit).

  1. Access WordPress Installation: Open a web browser and navigate to your server's IP address or domain followed by /your-site-name (e.g., http://your_server_ip/your-site-name).

Follow the WordPress installation wizard to complete the setup.

  1. Complete the Installation:
    Provide the site title, admin username, password, and email address.

  2. Access the WordPress Admin Dashboard:
    Once the installation is complete, you can access the WordPress admin dashboard by going to http://your_server_ip/your-site-name/wp-admin.

That's it! You've successfully installed WordPress on your Ubuntu server using the terminal. Remember to configure any additional settings and security measures as needed.

Top comments (0)