Install LAMP on yum in CentOS

Source: Internet
Author: User

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

 

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.