1.UseYumInstallApache, Mysql, PHP.
1.1 install Apache
Yum install httpd-devel
After the installation is complete, start apache with/etc/init. d/httpd start
Set to boot: chkconfig httpd on
1.2 install mysql
1.2.1 yum install mysql-server mysql-devel
Similarly, start mysql with/etc/init. d/mysqld start
1.2.2 set the mysql password
Mysql>; USE mysql;
Mysql>; UPDATE user SET Password = PASSWORD ('newpassword') WHERE user = 'root ';
Mysql>; flush privileges;
1.2.3 Allow Remote Login
Mysql-u root-p
Enter Password: <your new password>
Mysql> grant all privileges on *. * TO 'username '@' % 'identified by 'Password' with grant option;
After that, you can use mysql-front to remotely manage mysql.
1.2.4 set to boot
Chkconfig mysqld on
2.InstallPhp
Yum install php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/Etc/init. d/httpd start
3.Test
3.1 create a test. php file in/var/www/html/, write the following content, and save the file.
<?
Phpinfo ();
?>
3.2 Firewall Configuration
A. Add. Allow access to port {21: ftp, 80: http }.
Iptables-I RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 21-j ACCEPT
Iptables-I RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT
B. Disable the firewall {not recommended }.
Service iptables stop
C. Reset and load the Firewall
Service iptables restart
3.3 then open http: // serverip/test. php In the client browser. If it is displayed successfully, the installation is successful.
Enable port 80 of the firewall on CentOS
Note: Sometimes the installation may be inaccessible and port 80 must be enabled.
The main reason is the Firewall:
Run the/etc/init. d/iptables status Command to check whether port 80 is enabled. If port 80 is not enabled, you can use either of the following methods:
1. Modify the vi/etc/sysconfig/iptables command to add the firewall to open port 80
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 80-j ACCEPT
2. Disable the Firewall
/Etc/init. d/iptables stop
# Start
# Restart
Permanently disable the firewall chkconfig -- level 35 iptables off