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