CentOS 5.5 using the Yum install lamp (PHP environment) steps to share

Source: Internet
Author: User
    1. cd/etc/yum.repos.d/
    2. CP Centos-base.repo Centos-base.repo.bak
Copy Code

1.2 Replace the source with VI open Centos-base.repo, and empty the contents, then copy the contents below and save.

    1. Yum-y Update
Copy Code

2. Install apache,mysql,php with Yum.

2.1 Installing Apache

    1. Yum Install httpd Httpd-devel
Copy Code

After the installation is complete, use/ETC/INIT.D/HTTPD start to start Apache to boot:

    1. Chkconfig httpd on
Copy Code

2.2 Installing MySQL 2.2.1

    1. Yum install MySQL mysql-server mysql-devel
Copy Code

Again, when done, start MySQL with/etc/init.d/mysqld start

2.2.2 Setting the MySQL password

    1. mysql>; Use MySQL;
    2. mysql>; UPDATE user SET Password=password (' newpassword ') WHERE user= ' root ';
    3. mysql>; FLUSH privileges;
Copy Code

2.2.3 Allow remote logins

    1. Mysql-u root-p
    2. Enter Password:
    3. Mysql>grant all privileges on * * to ' user name ' @ '% ' identified by ' password ' with GRANT OPTION;
Copy Code

When you're done, you can manage MySQL remotely with Mysql-front.

2.2.4 Set to boot

    1. Chkconfig mysqld on
Copy Code

3. Install PHP

    1. Yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
    2. /ETC/INIT.D/HTTPD start
Copy Code

4. Test installation Results 4.1 Create a new test.php file in/var/www/html/, write the following, and then save.

    1. Phpinfo ();
    2. ?>
Copy Code

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
Copy Code

B. Turn off firewall {not recommended}.

    1. Service Iptables Stop
Copy Code

C. Reset load Firewall service iptables restart

4.3 Open http://serverip/test.php In the client browser, if successful display, 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.