Friday, June 5, 2015

Part 4 - Installing Wordpress to Centos 6 64Bit

Hello, today we will install wordpress in our VPS hosted by VPS.me, hope you read through the end first, because ONLY in VPS.me that using special treatment.
Before we begin, we must know first what is wordpress, for a few of you that already know wordpress and already use it, you can skip this and go to installing part.
According to wikipedia.com, WordPress is a free and open-source tool and a content management system (CMS) based on PHP and MySQL.


Before we start installing WordPress on our VPS, there are a few thing you must know.
1. Make sure Apache (httpd) process is running
2. Make sure you have mySQL (mysqld) installed in your VPS, if you dont know what is mySQL see Part 3 - Install mySQL in Centos 6 64Bit

If you are not sure about that, open your terminal using PuTTY or another SSH Client, and type
ps -A 

there are a few line of information, what you see is process that running in your VPS. (see pic below)
in your terminal make sure there are httpd and mysqld

what you see in your terminal maybe not same with the picture, just similar, because diffrent vps, has diffrent PID, but the point is you see httpd and mysqld, it means httpd and mysql is installed and running on your VPS.

if there are no httpd, try type
service httpd start

and if there are no mysql, try type
service mysqld start

if both command return error or not found, you must install httpd and mysql, for mySQL, you can see my previous turorial Part 3 - Install mySQL in Centos 6 64Bit for httpd just type
yum install httpd

after you install, start your httpd by type
service httpd start

Step 1. Download, Extract, Install Wordpress
Ok, now we start installing Wordpress
First go to html directory
cd /var/www/html

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

Extracting
tar xzf latest.tar.gz

Set permission
chown -R apache.apache wordpress
chmod -R 755 wordpress

Step 2. Create Database in mySQL
Now, we will entering mySQL, do you still remember your password?
Hmmm... not sure??? Okay, no problem, type 
mysql -u root -p

you'll see like this

if you remember password that you create before, type the password. But, if you feel you never create a password for mySQL before, try press <enter> on your keyboard. (you can skip this step if you have entering mySQL with your password, not blank password)

Condition 1 : Pic above is condition where you NOT type anything, just press ENTER, it means you have set password before.

Condition 2 : Pic above is condition where you NOT type anything, JUST press ENTER, and if you see like pic above, it means, you have successfully entering mySQL with no password set before. Just exit mySQL by type quit

Note : if you get like in Condition 1 and Condition 2 you must do this. Type 
mysqladmin -u root password yourpasswordhere
it means you have change your blank mysql admin password with your password.

Okay, i assume you have know your password, type
mysql -u root -p

Creating database for wordpress
CREATE DATABASE wp_db;

Set permission to wp_user
GRANT ALL ON wp_db.* to 'wp_user'@'localhost' IDENTIFIED BY '_secret_password_';

FLUSH PRIVILEGES;
quit

Step 3. Configure Virtual Host
Now we are going to configure Virtual Host, type
vim /etc/httpd/conf/httpd.conf

go to the end of line, and press INS on your keyboard to entering edit mode


Remove all # mark on the left start from <VirtualHost *:80> until </VirtualHost> (see pic above)
Edit it with this one

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/wordpress
    ServerName mynewvps.com
    <Directory "/var/www/html/wordpress">
         Allowoverride All
    </Directory>

    ErrorLog logs/mynewvps.com-error_log
    CustomLog logs/mynewvps.com-access_log combined
</VirtualHost>

See code above, there are "mynewvps.com" you can change it to anything, eg: yourserver.com, wishmeluck.com, etc.
if you see similar like this, Press ESC and type :wq

After you done, PRESS ESC on your keyboard, and type :wq
Note 
:wq = save and quit
:q! = just quit, nothing saved.

Now restart Apache (httpd)
service httpd restart

or
service httpd stop
service httpd start

Both are same.

Step 4. Installing PHP
now we will install php in order for wordpress to start.
type this
yum install php php-mysql

after that we restart apache
service httpd restart

type this for automatically start mysqld and httpd when you reboot your VPS.
chkconfig httpd on
chkconfig mysqld on

Step 5. Configure Wordpress via web
1. Open your favourite browser (if you are not using free service from VPS.me skip number 2)

2. Login to vps.me, go to My Server >> Manage
2.1 Click on IPv4 Mapping
1. Your Name (eg htt)
2. Your Source Port (choose between 1024 - 65535 as long the port not been used by other)
3. Destination port for web = 80, ftp = 21, just type 80

example condition (in VPS.me free service only)
You want to access Wordpress that installed in your VPS from your home, normally you just enter the IP address on your browser, and it will go to your wordpress site using port 80 automatically.
But if you using free service in VPS.me, port 80 is blocked for user, so you cant access your web normally, but VPS.me provide IPv4 mapping, so VPS.me will automatically redirect to port 80, but from other port as you choose in number 2 (in pic)
ex. in port map you fill like this :

Port Name = htt
Source Port = 7891
Destination Port = 80
 and click addnew

in browser, type http://31.xxx.xxx.180:7891/ - it will go to your wordpress site normally
but you need to add :7891 at the end of your IP address as port.

In case port 7891 has been used by other people, you must put another, like 7890, or 7668, or 2348, etc, the important thing is your port hasn't been use by other.

see number 4 below, i order to type http://<your vps ip>/wp-admin/setup-config.php
it means you must change <your vps ip> to <youripvps>:<port>

Condition in VPS.me as free service -->http://31.xxx.xxx.180:7891/
Condition in Other VPS as paid service --> http://31.xxx.xxx.180/
both are pointing same destination, just diffrent in method, and VPS Host.

Once again, its only in VPS.me as free service, i never use paid service in here, so maybe it can, or maybe it can not.
go to next step.

3. Enter your VPS <IP ADDRESS> Note : if you still see centos welcome page, type below code, if not, skip this, and goto number 4.
vim /etc/httpd/conf.d/welcome.conf
add # at the left to disable welcome page (see pic below)

welcome page are disabled.

4. type your IP address in your browser or type http://<your vps ip>/wp-admin/setup-config.php

5. Select you language and click continue, after this click lets go
6. See pic below 
Database Name = wp_db
Username = root
Password = <your mysql password>
Database Host = localhost
Table Prefix = wp_
Click Submit

7. See pic below, it means WordPress has successfully access your mySQL, if not, you must be wrong input your mySQL password.

8, Click Run the install
Here is information about your WordPress site
Site Title = Title name for your WordPress site.
Username = username for you as admin to manage your WordPress site later
Password = password for entering admin page
Your E-mail = email for other to contact you if they have interest in you or your site.
Privacy = if you want your site indexed by search engine, tick this.
Click install WordPress

9. If you see like below picture, it means you have success installing WordPress.

10. Open your browser. Type http://<your vps ip>/ you will see your WordPress installed in your VPS.

Thats all and congratulation, you already installed WordPress on your VPS, at the same time, you already know one more truth of VPS, that you can Host your own Website on your VPS.

As usually, i'll add a cross reference for installing WordPress on centos 6, with diffrent method, diffrent trick, and diffrent person too, maybe lot of simple than i do :D, you decide it.
1. Etel Sverdlov @ DigitalOcean.com > Click Here
2. Belong to Howtoforge.com > Click Here
3. Kyle Laffoon @ Rackspace.com > Click Here

If you have more reference, post it in comment below, i'll add in this article.
Thanks for reading, and see you in next tutorial.

0 comments:

Post a Comment