Install lamp--rpm on centos

Source: Internet
Author: User

Install lamp--rpm on centos

I. Required software and environment:

System Environment: centos 5.5x64

MySQL version: mysql-5.0.77-3.el5

PHP version: php-5.1.6-23.2.el5_3

Apache version: httpd-2.2.3-31.el5.centos


Ii. Install MySQL

[[email protected] ~]# yum install mysql mysql-server

After installation, MySQL can be automatically started with the system:

[[email protected] ~]# chkconfig --levels 235 mysqld on[[email protected] ~]# /etc/init.d/mysqld start

Set the password for the root account of Mysql Data:

[[Email protected] ~] # Mysqladmin-u Root Password '000000' Note: 123456 is the password you want to set

3. install Apache Components

[[email protected] ~]# yum install httpd

Configure the system to enable Apache with the system:

[[email protected] ~]# chkconfig --levels 235 httpd on

After the configuration is complete, start Apache:

[[email protected] ~]# /etc/init.d/httpd start

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/38/E1/wKioL1O0yNuDXlmdAAQ7x7fVWDU980.jpg "Title =" apa.png "alt =" wkiol1o0ynudxlmdaaq7x7fvwdu980.jpg "/>

NOTE: If other machines cannot access this service and the page is accessible directly on this server, the built-in firewall of centos is generally disabled. Run the following command:

[[email protected] ~]#service iptables stop[[email protected] ~]#setenforce 0

Of course, you can also go to the firewall and open the "80" port corresponding to "www.

Note: In centos, the default Apache root directory is/var/www/html,

Configuration file/etc/httpd/CONF/httpd. conf,

Other configurations are stored in the/etc/httpd/CONF. d/directory.


4. install PHP

Run the following command to install PHP:

[[email protected] ~]# yum install php

You need to restart the apache service:

[[email protected] ~]#service httpd restart

V. Test PHP Information

[[email protected] ~]# vi /var/www/html/test.php

The content is as follows:

<?php   phpphpinfo();?>

Save and exit.

At this point, you can access your site address, such as "http: // 192.168.1.2/test. php", to check whether the relevant PHP information can be seen.

The following figure shows that PHP is successfully installed.


6. Associate the PHP module with the MySQL Module

If you need to work, you also need to associate PHP with MySQL. Therefore, you need to install the following sections to work properly.

Install related modules:

[[email protected] ~]# yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php

Restart the Apache module to take effect:

[[email protected] ~]# /etc/init.d/httpd restart

Refresh the "test. php" page just created to check whether the MySQL module can be detected,

If you see information about the MySQL module, it means that MySQL is working properly.




This article from "Wipe red dust eventually hurt" blog, please be sure to keep this source http://weihuanjie.blog.51cto.com/3709233/1433848

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.