Yum Install lamp under CentOS
1.Install apache,mysql,php with Yum.
1.1 Installation Apache
Yum Install httpd Httpd-devel
When the installation is complete, use/etc/init.d/httpd StartStart Apache
Set to boot : Chkconfig httpd on
1.2 Installation MySQL
1.2.1 Yum install MySQL mysql-server mysql-devel
Again, when done, use/etc/init.d/mysqld StartStartMysql
1.2.2 Set upMySQLPassword
mysql>; Use MySQL;
mysql>; UPDATE user SET Password=password (' newpassword ') WHERE user= ' root ';
mysql>; FLUSH privileges;
1.2.3 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;
You can use it when you're done.Mysql-frontRemote ManagementMySQLThe
1.2.4 Set to boot
Chkconfig mysqld on
2. Install PHP
Yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/ETC/INIT.D/HTTPD start
3. Test it.
3.1 In/var/www/html/Create a newtest.phpFile, write the following, and then save.
<?
Phpinfo ();
?>
3.2 Firewall configuration
A. Add to.Allow access to ports{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. Shutting down the firewall{Not recommended}.
Service Iptables Stop
C. Reset Load Firewall
Service Iptables Restart
3.3 and open it in the client browser.http://serverip/test.php, the successful display indicates that the installation was successful.
This completes the installation. FeelingYumIt's so good.
CentOS Open Firewall 80 port
Note: Sometimes installation may not be accessible and needs to be opened Port
The big reason is the firewall:
through/etc/init.d/iptables StatusWhether the command query has an open thePort, if there are no two ways to handle it:
1.ModifyVi/etc/sysconfig/iptablescommand add to make firewall open thePort
-A rh-firewall-1-input-m State--state new-m tcp-p TCP--dport 80-j ACCEPT
2.shutting down the firewall
/etc/init.d/iptables Stop
#startOpen
#restart Restart
permanently shut down the firewallchkconfig--level iptables off
Yum Install lamp under CentOS