22 February 2022

Install Wordpress With Apache On Centos 8

This time I am going to cover how to install apache, php and mariadb on Centos 8. Then install wordpress with minimal apache configuration.

1. Install Apache

yum install httpd

Start apache

systemctl start httpd

Restart apache

systemctl restart httpd

Status of the apache

systemctl status httpd

2. Install mariadb server

yum install mariadb-server

Start mariadb server

systemctl start mariadb

Restart mariadb server

systemctl restart mariadb

Status of the mariadb server

systemctl status mariadb

To secure mariadb server, do this.


The following will be prompted.

● Enter current password for root (enter for none): --> Hit enter

● Set root password? --> Y

● Remove anonymous users? --> Y

● Disallow root login remotely? --> Y

● Reload privilege tables now? --> Y



In order to log into MariaDB to secure it, we'll need the current

password for the root user.  If you've just installed MariaDB, and

you haven't set the root password yet, the password will be blank,

so you should just press enter here.

Enter current password for root (enter for none):

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB

root user without the proper authorisation.

Set root password? [Y/n] y

New password:

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone

to log into MariaDB without having to have a user account created for

them.  This is intended only for testing, and to make the installation

go a bit smoother.  You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n] y

... Success!

Normally, root should only be allowed to connect from 'localhost'.  This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y

... Success!

By default, MariaDB comes with a database named 'test' that anyone can

access.  This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n] y

Dropping test database...

... Success!

Removing privileges on test database...

... Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB

installation should now be secure.

Thanks for using MariaDB!

3. Install PHP

yum -y install php php-mysqlnd

Then Restart apache.

systemctl restart httpd

Create a file named info.php

nano /var/www/html/info.php

Add the following lines.

<?php phpinfo(); ?>

Type the following into a web browser's address bar, then hit enter


Install Wordpress With Apache On Centos 8

4. Install Wordpress

To install wordpress, follow these steps.

a. Login into your database server

mysql -uroot -p

b. Create database name

create database wpcentos8;

c. Create database user

CREATE USER 'wpusercentos8'@'localhost' IDENTIFIED BY 'Gle48erGRrr*&#';

d. Grant all privileges of the database user on database name

GRANT ALL PRIVILEGES ON wpcentos8.* TO 'wpusercentos8'@'localhost';

e. Download wordpress

cd /var/www/html

wget http://wordpress.org/latest.tar.gz

f. Extract latest.tar.gz

tar xzvf latest.tar.gz

g. Now Navigate to "http://ip_address" in web browser will gets you to the installation of wordpress app

You will see the following page on your computer screen.

Install Wordpress With Apache On Centos 8

Press "Let's Go" button.

h. Put the database you have just created into the following page. Then hit "submit" button

● Database Name --> Put your database name here.

● Username --> Put your database username here.

● Password --> Put your database password here.

Install Wordpress With Apache On Centos 8

i. Create wp-config.php based on the following page And click "run the installation"

Install Wordpress With Apache On Centos 8

After the text : "You can create the wp-config.php file manually and paste the following text into it", you will find the wp-config.php you have to create.

The example of wp-config.php.

 3 * The base configuration for WordPress
 4 *
 5 * The wp-config.php creation script uses this file during the
 6 * installation. You don't have to use the web site, you can
 7 * copy this file to "wp-config.php" and fill in the values.
 8 *
 9 * This file contains the following configurations:
10 *
11 * * MySQL settings
12 * * Secret keys
13 * * Database table prefix
14 * * ABSPATH
15 *
16 * @link https://codex.wordpress.org/Editing_wp-config.php
17 *
18 * @package WordPress
19 */
21// ** MySQL settings - You can get this info from your web host ** //
22/** The name of the database for WordPress */
23define( 'DB_NAME', 'wpdatabase' );
25/** MySQL database username */
26define( 'DB_USER', 'wpuser' );
28/** MySQL database password */
29define( 'DB_PASSWORD', 'Cwo48*&#' );
31/** MySQL hostname */
32define( 'DB_HOST', 'localhost' );
34/** Database Charset to use in creating database tables. */
35define( 'DB_CHARSET', 'utf8' );
37/** The Database Collate type. Don't change this if in doubt. */
38define( 'DB_COLLATE', '' );
41 * Authentication Unique Keys and Salts.
42 *
43 * Change these to different unique phrases!
44 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
45 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
46 *
47 * @since 2.6.0
48 */
50define('AUTH_KEY',         'b&pCKl@v)?,Pw[BY#uaU^?rJI8p9u5/>`nU/:C9AWIRA27KwRG?!#-}`t6Y`Y+nn');
51define('SECURE_AUTH_KEY',  '[a6tJ(2`sxm![v2HdW!k72+ZV~^Wu:TP8R-[4{~H|]HWJTE%6&:GC7n3U)yITPsF');
52define('LOGGED_IN_KEY',    'xn@V/-c3>0i%z}wV5`R-|GL/e>C4dMYlIWH>-oKmc=P [#QFOv}O-^%@ajz0-h<`');
53define('NONCE_KEY',        'MxFMeyczY:zi7r98k(wg_,5J^o+yumK smFrPIlQ~2fZeEbjg+t*1IfDXD(%gh$-');
54define('AUTH_SALT',        '||zuN%h-*wgEBk<V|aVA_K8fkR@31t8M<9Sq&O X5<vZw4FnvU^u@!-|H`L`1!Wh');
55define('SECURE_AUTH_SALT', 'e-C)g5=e5!)Q_B@71^v<r%+ * 1r-[u&XrMf`T@x!`(.%te|GM-MH[FH>Os>n-z~');
56define('LOGGED_IN_SALT',   '?W9YVziA8]mMSt,7&16hbbg QDN:7Ip TM/J[Kzeu4/;eA$L{LT9}@#^_X:Je!WV');
57define('NONCE_SALT',       '[PWqef,WJ3*i 1:1[Mup9%`1?^XUIjaO2D!|+c!HAhZ{.DbObb$b4}+BWl|*s@}T');
62 * WordPress Database Table prefix.
63 *
64 * You can have multiple installations in one database if you give each
65 * a unique prefix. Only numbers, letters, and underscores please!
66 */
67$table_prefix = 'wp_';
70 * For developers: WordPress debugging mode.
71 *
72 * Change this to true to enable the display of notices during development.
73 * It is strongly recommended that plugin and theme developers use WP_DEBUG
74 * in their development environments.
75 *
76 * For information on other constants that can be used for debugging,
77 * visit the Codex.
78 *
79 * @link https://codex.wordpress.org/Debugging_in_WordPress
80 */
81define( 'WP_DEBUG', false );
83/* That's all, stop editing! Happy publishing. */
85/** Absolute path to the WordPress directory. */
86if ( ! defined( 'ABSPATH' ) ) {
87    define( 'ABSPATH', dirname( __FILE__ ) . '/' );
90/** Sets up WordPress vars and included files. */
91require_once( ABSPATH . 'wp-settings.php' );

j. Provide the information about your blog: Site title, Username, Password and Your Email. Do not check the Search Engline Visibility. Fill out the information and click "Install Wordpress."

Install Wordpress With Apache On Centos 8

k. If the installation of wordpress app is successful, you can login to wordpress admin with the username and password you have provided

Install Wordpress With Apache On Centos 8

Install Wordpress With Apache On Centos 8

Comments are closed