After installing apache2 a command first: yum-y install httpd Enter, Yum will prompt for the currently installed HTTPD version and automatically update it, if it is not installed, it will be installed automatically. Note Enter "Y" during the Yum installation process to confirm the installation. When the Apache installation is complete, manually start the apache2: /etc/init.d/httpd start at this point, you can see the default page of Apache2 by entering the IP address of the server directly in the browser. At this point, Apache can only provide HTTP services, cannot execute PHP, and can not connect to MySQL database. Installation mysql since the CentOS is already included with MySQL, so only yum can be: yum-y install MySQL mysql-server complete, Use the following command to start the MySQL service: /etc/init.d/mysqld start Install php5 install PHP5 using the following command: Yum install php After installing PHP5, you must restart Apache for PHP to take effect: /etc/init.d/httpd restart at this point, Apache has been able to parse and execute PHP scripts. Since Apache's default Web site root is located at:/var/www/html/, this directory establishes a info.php to test apache+ PHP for proper installation or not: VI <?php phpinfo ( ); then access/info.php in the browser, with phpinfo output information: PHP and Apache installed correctly. Next install MySQL database and other modules (such as GD Graphics library, mbstring library, etc.): yum -y install php-mysql php-gd php-imap php-ldap php-odbc Php-pear Php-xml php-xmlrpc The installation process may be slow, please wait patiently. Restart apache: /etc/init.d/htt after completionPD restart re-opens the ip/info.php page in the browser, should be able to find the MySQL, GD, mbstring and other modules: at this time lamp operating environment has been initially installed. Finally, you need to set the lamp component to start automatically: 1 chkconfig--levels 2345 httpd on 2 chkconfig--levels 2345 mysqld on Finally introduce the relevant configuration and environment Apache Master profile:/etc/httpd/conf/httpd.conf Apache master configuration directory, you can classify different types of configuration into this directory:/etc/ httpd/conf.d/ Apache web site root directory:/var/www/html/ Apache log file directory:/var/log/httpd mysql my.cnf profile:/etc/ my.cnf MySQL database file location:/usr/lib/mysql In order to reduce the time you can write these safe commands into the. SH script inside to execute the SH scripts to install.
Centos Yum Build lamp environment