1. Install apache,mysql,php with Yum.
1.1 Installing Apache
Yum Install httpd Httpd-devel
When the installation is complete, start Apache with/etc/init.d/httpd start
Set to boot: Chkconfig httpd on
1.2 Installing MySQL
Yum install MySQL mysql-server mysql-devel
Again, when done, start MySQL with/etc/init.d/mysqld start
1.3 Setting the MySQL password
mysql>; Use MySQL;
mysql>; UPDATE user SET Password=password (' newpassword ') WHERE user= ' root ';
mysql>; FLUSH privileges;
The MySQL password can also be set by: Mysql_secure_installation command
1.4 Allow remote Logins
Mysql-u root-p
Enter Password: <your new password>
Mysql>grant all privileges on * * to ' user name ' @ '% ' identified by ' password ' with GRANT OPTION;
When you're done, you can manage MySQL remotely with Mysql-front.
Set to boot
Chkconfig mysqld on
1.5 Installing PHP
Yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/ETC/INIT.D/HTTPD start
2. Test
Create a new test.php file in/var/www/html/, write the following, and then save.
<?
Phpinfo ();
?>
Firewall configuration
A. Add. Allow access to port {80:http}.
-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
B. Turn off firewall {not recommended}.
Service Iptables Stop
C. Resetting the load firewall
Service Iptables Restart
6. Then open the http://serverip/test.php in the client browser, if successful display, the installation is successful.
This completes the installation.
CentOS installs the lamp environment using Yum