In this tutorial we will learn how to install latest wordpress in CentOS 6.Installing the WordPress is quite easy but here we will create a database user which only has access to wordpress database.This practical is applied to VPS,Cloud Server,virtual server and dedicated server.
Note: VPS,Cloud Server,virtual server are based on Virtualisation techninque
We are doing this practical on freshly minimal installed CentOS 6.4 hence some additional package we will install.
Follow the given below steps to install WordPress
Login into Server with user root
Step 1: Install wget package to download the WordPress with command line.
yum -y install wget
Step 2: Now download the latest WordPress package in server by using wget command
cd /root wget http://wordpress.org/latest.tar.gz
Step 3: Installed the required dependency,web server(apache) and database server(MySQL)
yum install httpd mysql-server php php-mysql php-pdo
Step 4: Now extract the downloaded WordPress package in /var/www/html
tar -xvzf /root/latest.tar.gz -C /var/www/html
Step 5: Rename the extracted out directory called wordpress to some other name, Here I am renaming it to blog. (It is your choice to rename or give some other name)
Give ownership and group apache also to /var/www/html/blog directory.
mv /var/www/html/wordpress /var/www/html/blog chown -R apache:apache /var/www/html/blog
Step 6: Disable SELINUX if it is in enforcing mode. Replace the word enforcing to disable in SELINUX value
Edit the file /etc/sysconfig/selinux
See the below given reference.
[root@localhost ~]# vi /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
Step 7: Now restart the machine
Step 8: Now login to server again. Start the apache and mysql server.
/etc/init.d/httpd start /etc/init.d/mysqld start
Note: If you already have MySQL installed in Server and have root login,you can skip Step 9. The setup is for first time installation
Step 9: Now setting mysql root password. Use the command
/usr/bin/mysql_secure_installation read the instructions and give your input
Below given is reference
[root@localhost ~]# /usr/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, 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 MySQL 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 MySQL installation has an anonymous user, allowing anyone to log into MySQL 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, MySQL 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 MySQL installation should now be secure. Thanks for using MySQL! [root@localhost ~]# [root@localhost ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 10 Server version: 5.1.69 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> exit
Step 10: Now starting and configuring web server .
Note: We have extracted the wordpress package in /var/www/html and renamed the wordpress directory to blog. Hence the DocumentRoot is /var/www/html/blog
Starting web server
Edit the file /etc/httpd/conf/httpd.conf file and in last line paste the given below contents.
Note: Replace the example.com with your domain name (You must have your Registered domain name, if you do not have we can use example.com for practical purpose and can map it in our linux laptop or Desktop in /etc/hosts file [Add in last line of /etc/hosts file ip-address-of-server example.com])
ServerAdmin email@example.com DocumentRoot /var/www/html/blog ServerName example.com ErrorLog logs/example.com-error_log CustomLog logs/example.com-access_log common
Now restart the Web server once again
Step 11: Creating MySQL username password. Log into MySQL server
mysql -u root -p
Now mysql > will appear, create database user,password and provide privileges to this user
mysql> create database wordpress; mysql> create user 'wordpressuser'@'localhost' IDENTIFIED BY 'GivePassword'; mysql> GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost'; mysql> flush privileges; mysql> exit;
Step 12: Stopping iptables service
/etc/init.d/iptables off ;chkconfig iptables off
Note: If you want to use iptable then do not stop the service ,you can use below given iptable rule command. You only have to hit this command in terminal
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
Step 13: Now open the web browser and type domain name in Address bar.
Here,we have used domain name example.com (replace with your domain name which you have given)
Now it is easy to install WordPress,follow the instructions and fill up the required information
After installation get completed,you can check you blog by typing http://example.com and to login into Admin panel use wp-admin as suffix means http://example.com/wp-admin
Below given are the screenshots of installation:
Leave a Reply