Centos under the Yum command to deploy a detailed tutorial on the lamp environment

Source: Internet
Author: User
Tags flush install php socket socket error iptables


1. Centos the default is to open IP Security policy, that is, 80 ports also prohibit external access, so first deactivate iptables.

Service Iptables Stop

or open to port 80.

Iptables-i rh-firewall-1-input-m state–state new-m tcp-p tcp–dport 80-j ACCEPT

2. Install Apache

Yum Install httpd (only Apache installed), if you want to install additional plug-ins can

Yum-y Install httpd-manual mod_ssl mod_perl mod_auth_mysql

The location of the Web page after installation is/var/www/html

3. Install MySQL

Yum install MySQL mysql-server mysql-devel

After the installation is complete, running MySQL may cause the following error: Can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock There are many kinds of reasons for this error The Mysql.sock file cannot be found under the/var/lib/mysql/directory and can run service mysqld start or (/etc/init.d/mysqld start) If MySQL is successfully launched in/var/lib/ mysql/directory to generate Mysql.sock files, this time will be the MySQL set up when the system starts, automatically start, otherwise it will repeat can ' t connect to the local MySQL server through socket error. The automatic start command is as follows: Chkconfig mysqld on


System defaults will not set the password, is a blank password, if you want to set the MySQL password, the password is set to 123456

Mysqladmin-u Root Password 123456

If you want to open external access to MySQL, you need to set up users for external access

Mysql> GRANT all privileges in *.* to ' username ' @ ' address ' identified by ' password ' with GRANT OPTION;
mysql> FLUSH privileges;

example, allow root user to connect with 123456 password 192.168.6.6

Mysql> grant all privileges in *.* to ' root ' @ ' 192.168.6.6 ' identified by ' 123456 ' with GRANT OPTION;
mysql> FLUSH privileges;

example, allows all external, user root password 123456 connections to the database

Mysql> grant all privileges in *.* to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
mysql> FLUSH privileges;

example, allow IP for 192.168.6.6, user root password 123456 connect the user database

Mysql> grant all privileges in user.* to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
mysql> FLUSH privileges;

4. Install PHP

Yum install php php-mysql php-common php-gd php-mbstring php-mcrtpt php-devel php-xml

Related Article

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.