Jun 28, 2011

Configure VPS | Install LAMP on Centos VPS Part 1

Few days before when I had a VPS and needed to install wordpress, I found it very difficult because very few resources were available on google
So I am here now with my new post, On HOW TO INSTALL LAMP ON CENTOS
First buy an unmanaged VPS, and get ssh access
Then install Putty software in your computer, and start it
Then Follow the further steps
Start Putty software and then enter your IP for eg. 255.255.255.254
it will ask for username
generally its root and then enter the password
after that start typing the following code
IMPORTANT: IF YOU ARE NOT FAMILIAR WITH SSH COMMAND THEN BE CAREFUL. JUST COPY PASTE THE CODES.
First we will install yum

[php]
yum install -y yum-priorities

[/php]


After this we need to download updated repositories for php and mysql

[php]
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

[/php]


Then we will extract that by following command
code:

[php]

rpm -Uvh epel-release-5-4.noarch.rpm

rpm -Uvh remi-release-5.rpm

[/php]

After This we give priorities to repo and exclude php mysql and phpmyadmin from repository
code:

[php]

vi /etc/yum.repos.d/CentOS-Base.repo
[/php]

After this a file will be opened, press I from the keyboard to edit it, and after editing press esc button and type :x to save it
code:

[php]

priority=1
exclude=*php* *mysql* *phpmyadmin*

[/php]

Copy paste this above code five times before the following lines

[php]
#released updates
#packages used/produced in the build but not released
#additional packages that may be useful
#additional packages that extend functionality of existing packages
Copy paste the next lines before this line #contrib - packages by Centos Users

[/php]



[php]
priority=2
exclude=*php* *mysql* *phpmyadmin*

[/php]

Just one line above priority=2 their will be a line enabled=0 just make that to 1
After this press esc and type :x to save the file
Now same thing for epel and remi repository


[php]

vi /etc/yum.repos.d/epel.repo
[/php]

Just Above this line [epel-debuginfo] insert this code(inserting and saving is been explained on top)
Code:

[php]

priority=3

[/php]

Now after saving that, we will now edit the same code with just different filename
Code:

[php]

vi /etc/yum.repos.d/remi.repo

[/php]

And now in this, just above [remi-test] line, change the value of enable=0 to 1
and paste this code exactly above the [remi-test] line
Code:

[php]

priority=3

[/php]

Save it and now we will install apache web server,


[php]
yum install -y httpd

[/php]

After this we will install php,

[php]

yum install php

[/php]

During the installation it will prompt you for importing GPG key for the new repositories, just type y and press enter, this will be come for two times
Now we will start the Apache server
Code:

[php]

/etc/init.d/httpd start

[/php]

Just to test our Apache and php, we will create a phpinfo file


[php]

vi /var/www/html/info.php

[/php]

A new file will be created, insert this code into it, and then save it



[php]

<?
phpinfo();
?>

[/php]

Now in your browser, enter this URL, http://your IP or localhost/info.php
Now a PHP INFO file should open, where it will display php and servers information
if not then restart the apache server,
To restart the server,



[php]

/etc/init.d/httpd restart

[/php]

Now we will install MySql



[php]

yum install -y mysql-server mysql php-mysql

[/php]

Now the next code is used to configure Apache , to start MySql when server is rebooted.


[php]
chkconfig httpd on
chkconfig mysqld on

[/php]

Fire up MySql Server


[php]

/etc/init.d/mysqld start

[/php]

Now we will set the root password of mysql

Code:

[php]

mysql -u root password password
[/php]

Here the second password is the actual root password, you can change it with your's own.

Now its time to do last job, thats installing phpmyadmin



[php]

yum install -y phpmyadmin
[/php]

Now we have to edit phpMyAdmin config file to avoid the Forbidden Access Error



[php]

vi /etc/httpd/conf.d/phpMyAdmin.conf

[/php]

Search for a line,

[php]

deny from all# deny from all

[/php]

Comment the above line just by inserting # before the line, so after that, it should look like the following,

# deny from all

Save it and restart the Apache server

Code:

[php]

/etc/init.d/httpd restart

[/php]

Done
Now goto the browser and type this URL
http://IP or localhost/phpmyadmin
Now the page will appear, just enter username as root and password as password

Check my next post, Part-2, on how to transfer a wordpress site from existing hosting to your newly configured VPS
Feel free to give suggestions.

4 comments :

  1. [...] Part 2: As now, you have configured VPS, Now its time to move your old wordpress site to our new VPS(Which is already configured with LAMP). If you have not configured till yet, then it is my suggestion that you go back to my first tutorial Configure VPS | Install LAMP on Centos VPS Part 1 [...]

    ReplyDelete
  2. [...] Posted on June 28, 2011 by ntechi var addthis_product = 'wpp-261'; var addthis_config = {"data_track_clickback":true};Part 2: As now, you have configured VPS, Now its time to move your old wordpress site to our new VPS(Which is already configured with LAMP). If you have not configured till yet, then it is my suggestion that you go back to my first tutorial Configure VPS | Install LAMP on Centos VPS Part 1 [...]

    ReplyDelete
  3. torqueinduction15/4/12 5:09 PM

    You have smiley coming up instead of :X I think.

    ReplyDelete
  4. euro-space.net29/9/12 6:56 AM

    Useful article, explains all the necessary steps.

    ReplyDelete