How to configure LAMP and Wordpress 4.0 on CentOS 7.0
Check your IP address:
ip addr
Check available Repos:
yum repolist
If you want to save time, downloading at least 'base' packages, configure local 'base'repo.
First install FTP daemon,
yum -y install vsftpd ftp
Loop mount your DVD ISO to copy packages,
mount -o loop,ro /home/yogesh/Downloads/CentOS7.iso /mnt
To check run,
mount
Now, create folder,
mkdir -p /var/ftp/pub/Centos7
And copy cd contains to your newly created folder,
rsync -av -P /mnt/* /var/ftp/pub/Centos7/.
restorecon -RFvv /var/ftp/pub/Centos7*
Install createrepo package if not installed,
yum -y install createrepo
Execute createrepo,
createrepo -v /var/ftp/pub/Centos7
Start FTP daemon, and open ftp ports in local host.
systemctl start vsftpd
systemctl enable vsftpd
firewall-cmd --permanent --add-service=vsftp
firewall-cmd --permanent --add-service=ftp
Change default repo,
cd /etc/yum.repos.d/
vim CentOS-Base.repo <Add following line in 'base' section,
enabled=0
Create local repo,
vim local-base.repo
[localbase]
name=CentOS 7 Local Repo
baseurl=ftp://192.168.1.253/pub/Centos7
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Lets also install EPEL repo for CentOS 7,
yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
yum clean all ; yum repolist
yum clean all ; yum repolist
First we will install & configure apache,
yum -y install httpd
systemctl start httpd
systemctl enable httpd
firewall-cmd --permanent --add-service=http
systemctl restart firewalld
We will test with web page later,
Now lets install mariadb database,
yum -y install mariadb-server mariadb
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
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!
Remove anonymous users? [Y/n] Y
... Success!
Disallow root login remotely? [Y/n]
... Success!
Remove test database and access to it? [Y/n]
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? [Y/n]
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
After mariadb, we will install php.
yum -y install php php-mysql php-gd php-pear
vim /var/www/html/testphp.php
<?php
phpinfo();
?>
You can install GUI Web based php admin console called 'phpmyadmin',
yum -y install phpmyadmin
vim /etc/httpd/conf.d/phpMyAdmin.conf
Comment and add following lines:
#<Directory /usr/share/phpMyAdmin/>
# <IfModule mod_authz_core.c>
# # Apache 2.4
# <RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
# </RequireAny>
# </IfModule>
# <IfModule !mod_authz_core.c>
# # Apache 2.2
# Order Deny,Allow
# Deny from All
# Allow from 127.0.0.1
# Allow from ::1
# </IfModule>
#</Directory>
<Directory /usr/share/phpMyAdmin/>
Options none
AllowOverride Limit
Require all granted
</Directory>
Now open following file:
vim /etc/phpMyAdmin/config.inc.php
<And replace 'cookie' with 'http' in following line>
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
systemctl restart httpd
Now your are ready with LAMP server!! :D
Lets see how do we install Wordpress 4.0 (Latest) in the same,
Lets first add hostname in following hosts file,
vim /etc/hosts
192.168.1.25 centos7.localdomain centos7 <Change as per your hostname and IP>
Download latest package file from wordpress,
wget http://WordPress.org/latest.zip
Unzip and copy over to http root,
unzip latest.zip
cp -R wordpress/. /var/www/html/
Also make sure you have taken care of Selinux context(If you are using selinux in enforcing mode)
getsebool -a |grep home
setsebool -P httpd_enable_homedirs on
restorecon -RFvvv /var/www/html/*
Now lets setup mariadb for wordpress database,
mysql -u root -p
Enter password:
MariaDB [(none)]> create database wpdb;
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> GRANT ALL ON wpdb.* TO wpuser@localhost IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
cd /var/www/html/
cp wp-config-sample.php wp-config.php
vim wp-config.php
define('DB_NAME', 'wpdb'); <Wordpress database name>
/** MySQL database username */
define('DB_USER', 'wpuser'); <Wordpress user name>
/** MySQL database password */
define('DB_PASSWORD', 'centos'); <Wordpress user password>
Rest just keep default values.
Now, you are ready with Word press. Open your system URL in browser, in my case its, http://192.168.1.253
Word press will ask you for basic inputs like Site Title, Username, password, email address, etc. After providing those you can open and start using your wordpress!
:)
Happy Wordpressing!!!
this one i know :D
ReplyDelete