- Joined
- May 16, 2014
- Messages
- 20
- Points
- 1
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.
- Create a database and user to use with the WordPress.
a. Login to MySQL:
Provide the MySQL root password and log in.mysql -u root -p
b. Create a new database:
Replace the DB name 'wordpress' with the actual name you needed.CREATE DATABASE wordpress;
c. Create a user:
Replace the user 'wordpressuser' with actual one and provide the actual password you need to use in the place of 'password'.CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
d. Set up the privileges:
Replace the DB 'wordpress',user 'wordpressuser' with actual ones and provide the correct password in the place of 'password'.GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
e. Then run the following commands:
FLUSH PRIVILEGES;
exit - Download and install WordPress:
a. Download WordPress:
b. Extract the file:wget :wordpress.org/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/tar xzvf latest.tar.gz
d. Access the home directory and set the required ownership as per the control panel:cp -avr wordpress/* /var/www/html/
e. Rename the configuration file and edit the DB details:cd /var/www/html
chown -R apache:apache /var/www/html/
Find the line specifying the DB name, username, and DB password and replace them with the actual ones you set in the first step:mv wp-config-sample.php wp-config.php
vi wp-config.php
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.
- We can access it with the site URL from the browser and you will get the WordPress initial setup page and you are done.







