Install lamp with the Yum mode under CentOS

Source: Internet
Author: User
Tags fully qualified domain name

First install Apache CentOS to install Apache directly from Yum.

Configure NetEase 163 Yum Source http://www.cnblogs.com/carbon3/p/5635403.html

First, install Apache
Command: Yum install httpd//Follow the prompts and enter Y installation to install successfully

Then launch Apache and set up the system to let Apache boot automatically.
Command:
Service httpd start//Launch Apache
Chkconfig httpd on//set power On self-start

When you start the service, the following error occurs:
Httpd:could not reliablydetermine the server ' s fully qualified domain name, using localhost.localdomainfor ServerName
Workaround:

Found it:
#ServerName www.example.com:80
Modified to:
ServerName localhost:80

second, firewall settings. shut down the kernel firewall selinux, and the Iptables firewall policy set up 80 ports to run the Web site, and 3306 ports for the database.
Command:
Setenforce 0
Vi/etc/selinux/config//Turn off the kernel firewall and change the selinux=enforcing to selinux=disabled
Vi/etc/sysconfig/iptables//Add the following 2 records
-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
Or: Iptables-f

third, install MySQL, here also direct Yum installation
Command:
Yum install MySQL mysql-server. Install MySQL
Service mysqld start//installs and starts services with a command.
Mysql_secure_installation//Set MySQL password, 1 direct enter, 2 according to the prompt input y,3 and then will let enter 2 times you want to set the password, 4 follow the prompts always press Y on the line.
Last seen: Thanks for using mysql! set success
Chkconfig mysqld on//Same as Apache Setup boot
Service mysqld restart//restart MySQL

Iv. installing PHP, and PHP components ,
Command:
Yum Install PHP
Yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-b Cmath Php-mhash Libmcrypt
This is where our Apache, MySQL, and PHP are installed. Restart Apache and MySQL here
Service httpd Restart
Service mysqld Restart

Five, the Apache default site directory is/var/www/html, write a PHP test page.
Command:
Cd/var/www/html
VI test.php

<? PHP Phpinfo ();? >

Install lamp with the Yum mode under CentOS

Related Article

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.