How to Install WordPress on CentOS Using the Command Line

  • March 13, 2025
  • 0 Comments

Want to get WordPress running on your CentOS server? Using the command line is a neat way to do it! Let's walk through the steps together.

What You'll Need:

  • A CentOS server (like one from Hostaira!)
  • SSH access to your server
  • A little bit of patience!

 

Step 1: Update Your Server

First, let's make sure your server is up-to-date. Open your terminal and type:

<code>sudo yum update -y</code>

This command updates the available software on your server.


Step 2: Install Apache, MariaDB, and PHP

WordPress needs these three things to run. Type:

<code>sudo yum install httpd mariadb-server php php-mysqlnd php-gd php-xml php-mbstring -y</code>

Apache is the web server, MariaDB is the database, and PHP is the programming language.


Step 3: Start and Enable Apache and MariaDB

Now, let's start the web server and database, and make sure they start automatically when your server boots up. Type:

<code>sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb</code>

 

Step 4: Secure MariaDB

Let's secure your database. Type:

<code>sudo mysql_secure_installation</code>

Follow the prompts to set a root password and secure your database.


Step 5: Create a Database

Now, let's make a database for WordPress. Type:

<code>sudo mysql -u root -p</code>

Enter your MariaDB root password. Then, type these commands, pressing Enter after each one:

<code>CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;</code>
 

Replace your_password with a strong password!


Step 6: Download WordPress

Let's download the WordPress files. Type:

<code>wget https://wordpress.org/latest.tar.gz</code>

Then, unzip the files:

<code>tar -xzvf latest.tar.gz</code>

Step 7: Move WordPress Files

Move the WordPress files to your website's folder. Type:

<code>sudo mv wordpress/* /var/www/html/</code>

Step 8: Configure WordPress

Go to your website in your browser (like http://your_server_ip). You'll see the WordPress installation screen. Follow the instructions to connect to your database.


Important Tips:

  • Be careful when typing commands!
  • Always use strong passwords.
  • If you have any questions, Hostaira support is ready to help! Just click here to submit a ticket

 

That's it! You've installed WordPress on your CentOS server. Hostaira also offers great WordPress hosting plans too! You can check them out here.

How helpful was this article to you?

Posting has been disabled.