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