To install WordPress on Ubuntu using the terminal, you'll need to set up a LAMP (Linux, Apache, MySQL, PHP) stack, as WordPress is a PHP-based application that requires a web server and a database. Here are the steps to install WordPress:
- Update System Packages: Open a terminal and run the following commands to update your system's package repositories and upgrade existing packages:
sudo apt update
sudo apt upgrade
- Install Apache Web Server: Install the Apache web server by running:
sudo apt install apache2
After installation, Apache should start automatically. You can check its status using:
sudo systemctl status apache2
- Install MySQL Database: Install MySQL server and follow the prompts to set a root password:
sudo apt install mysql-server
Run the MySQL secure installation script to enhance security:
sudo mysql_secure_installation
- Install PHP and Required Modules: Install PHP and its required modules:
sudo apt install php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
- Configure Apache for PHP: Enable the necessary Apache modules and restart Apache:
sudo a2enmod php
sudo systemctl restart apache2
- Download and Configure WordPress: Navigate to your Apache web root directory:
cd /var/www/html
Download the latest WordPress release:
sudo wget https://wordpress.org/latest.tar.gz
Extract the downloaded archive:
sudo tar -xzvf latest.tar.gz
Rename the WordPress directory:
sudo mv wordpress your-site-name
Set appropriate permissions:
sudo chown -R www-data:www-data your-site-name
- Create MySQL Database and User: Log in to MySQL:
sudo mysql -u root -p
Inside the MySQL shell, create a database and user for WordPress:
CREATE DATABASE your_database_name;
CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON your_database_name.* TO 'your_username'@'localhost';
FLUSH PRIVILEGES;
EXIT;
- Configure WordPress: Open your web browser and navigate to your server's IP address or domain followed by the directory name where you installed WordPress (e.g., http://your_server_ip/your-site-name).
Follow the WordPress setup instructions. Provide the database details you created earlier.
- Complete Installation: Finish the WordPress installation through the web interface, setting up your admin account and site settings.
That's it! You've successfully installed WordPress on your Ubuntu system using the terminal.
Top comments (0)