Yum Install lamp under CentOS

Source: Internet
Author: User

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

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.