How to install LAMP and WordPress (yum based)

LAMP(Linux, Apache, MySQL, and PHP)  is open source Web application platform that runs on Linux systems.

Note: To install all above,  the user needs to have root privileges.

1. To install Apache, open terminal and type in this command:

yum install httpd

To start Apache, type next command:

service httpd start

 

2. To install MySQL, open terminal and type in this command:

yum install mysql-server

During the installation, MySQL will ask you for your permission twice. After you say Yes to both, MySQL will install.

With the following command starts the MySQL:

service mysqld start

 

3.To install PHP, open terminal and type in this command:

yum install php php-mysql

Once you answer yes to the PHP prompt, PHP will be installed.

Install WordPress

 

1. Download WordPress:

cd /tmp

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

Then extract:

tar -xvzf latest.tar.gz -C /var/www/html

 

2.Connect to MySQL server and run the following commands to create database and grant privileges.

## Connect to MySQL server and enter password ##

mysql -u root -p

Enter password:

## Create new user for WordPress database ##

CREATE USER wordpress@localhost IDENTIFIED BY "yuor_password_here";

## Create new database ##

create database wordpress;

## Grant privileges to database ##

GRANT ALL ON wordpress.* TO wordpress@localhost;

## Flush privileges ##

FLUSH PRIVILEGES;

## Exit ##

exit

Please replace the text in quotes with the proper password.  

3.Open the file /etc/httpd/conf/httpd.conf with gedit editor.

gedit /etc/httpd/conf/httpd.conf

Add the following lines of code at the bottom of the file. Replace the text shown in red color with your required settings.

<VirtualHost *:80>

Server Admin [email protected]

DocumentRoot /var/www/html/wordpress

ServerName wordpress

ErrorLog /var/log/httpd/wordpress-error-log

CustomLog /var/log/httpd/wordpress-acces-log common

Next, restart the Apache service to reflect changes. service httpd restart

Add the following line to /etc/hosts file. 127.0.0.1 wordpress

Copy default wp-config-sample.php to wp-config.php to configure WordPress installation.

cd /var/www/html/wordpress cp wp-config-sample.php wp-config.php

Open wp-config.php file and change database settings.

gedit wp-config.php

/** The name of the database for WordPress */

define(‘DB_NAME’,’database_name’);

/** MySQL database username */

define(‘DB_USER’,’username’);

/** MySQL database password */ 

define(‘DB_PASSWORD’,’password’);

/** MySQL hostname */

define(‘DB_HOST’,’localhost’);

Open your browser and type the following address. httpd://localhost

tags: & category: -