• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Wordpress installation via command line.

HostSailor

Member
WordPress is a famous Content Management System(CMS) running with PHP and MySQL. We can setup WordPress in different ways. The most used method is by using a tool such as Softaculous and install it graphically. Here we are describing the steps to do the WordPress installation via command line with an Apache server and MySQL on a Centos 7 server. You can watch the video tutorial by clicking here.

  1. Create a database and user to use with the WordPress.

    a. Login to MySQL:
    mysql -u root -p
    Provide the MySQL root password and login.

    b. Create a new database:
    CREATE DATABASE wordpress;
    Replace the DB name 'wordpress' with the actual name you needed.

    c. Create a user:
    CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
    Replace the user 'wordpressuser' with actual one and provide the actual password you need to use in the place of 'password'.

    d. Set up the privileges:
    GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
    Replace the DB 'wordpress',user 'wordpressuser' with actual ones and provide the correct password in the place of 'password'.

    e. Then run the following commands:
    FLUSH PRIVILEGES;

    exit
  2. Download and install WordPress:

    a. Download WordPress:
    b. Extract the file:
    tar xzvf latest.tar.gz
    c. Move the WordPress files inside the extracted directory to the actual Apache home directory. If you are using any hosting control panel, the directory might be different such as /home or /var/www/ etc. based on the panel. Here I am considering the home directory as /var/www/html/
    cp -avr wordpress/* /var/www/html/
    d. Access the home directory and set the required ownership as per the control panel:
    cd /var/www/html

    chown -R apache:apache /var/www/html/
    e. Rename the configuration file and editing the DB details:
    mv wp-config-sample.php wp-config.php

    vi wp-config.php
    Find the line specifying the DB name, username and DB password and replace them with the actual ones you set in the first step:

    define('DB_NAME', 'wordpress');

    define('DB_USER', 'wordpressuser');

    define('DB_PASSWORD', 'password');

    Replace the DB 'wordpress',user 'wordpressuser' with actual ones and provide the correct password in the place of 'password'.

    Once done save the file.

  3. We can access it with the site URL from the browser and you will get the WordPress initial setup page and you are done.
 
Back
Top