CentOS5.5 install LAMP (php environment) using yum

Source: Internet
Author: User
CentOS5.5 install LAMP (php environment) using yum

  1. Cd/etc/yum. repos. d/
  2. Cp CentOS-Base.repo CentOS-Base.repo.bak

1.2 replace the source open the CentOS-Base.repo with vi, clear the content, copy the following content into and save.

  1. Yum-y update

2. install Apache, Mysql, and PHP with yum.

2.1 install Apache

  1. Yum install httpd-devel

After the installation is complete, start apache with/etc/init. d/httpd start and set it to boot:

  1. Chkconfig httpd on

2.2 install mysql 2.2.1

  1. Yum install mysql-server mysql-devel

Similarly, start mysql with/etc/init. d/mysqld start

2.2.2 set the mysql password

  1. Mysql>; USE mysql;
  2. Mysql>; UPDATE user SET Password = PASSWORD ('newpassword') WHERE user = 'root ';
  3. Mysql>; flush privileges;

2.2.3 allow remote logon

  1. Mysql-u root-p
  2. Enter Password:
  3. Mysql> grant all privileges on *. * TO 'username '@' % 'identified by 'password' with grant option;

After that, you can use mysql-front to remotely manage mysql.

2.2.4 set to boot

  1. Chkconfig mysqld on

3. install php

  1. Yum install php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
  2. /Etc/init. d/httpd start

4. test the installation result 4.1. create a test. php file in/var/www/html/, write the following content, and save the file.

  1. Phpinfo ();
  2. ?>

4.2 iptables firewall configuration a. add. allow access to port {21: ftp, 80: http }.

  1. Iptables-I RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 21-j ACCEPT
  2. Iptables-I RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT

B. disable the firewall {not recommended }.

  1. Service iptables stop

C. reset and load the firewall service iptables restart

4.3 Open http: // serverip/test. php in the client browser. if it is displayed successfully, the installation is successful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.