Centos-yum-lamp environment, centosyum. In the centos-yum-lamp environment, centosyum first installs the Apache2 command: after yum-yinstallhttpd is set to press enter, yum will prompt the currently installed httpd version and update it automatically; if the centos-yum-lamp environment is not available
First install Apache2
One command:
Yum-y install httpd
After you press enter, yum will prompt the currently installed httpd version and update it automatically. if not, yum will automatically install it. Note that "Y" is entered during the yum installation process to confirm the installation.
After installing Apache, manually start Apache2:
/Etc/init. d/httpd start
In this case, enter the server IP address in the browser to view the default page of Apache2. At this time, Apache can only provide HTTP services, and cannot execute php or connect to the MySQL database.
Install MySQL
Because CentOS already contains MySQL, you only need yum:
Yum-y install mysql-server
Run the following command to start the MySQL service:
/Etc/init. d/mysqld start
Install php5
Run the following command to install php5:
Yum install php
After installing php5, you must restart Apache for php to take effect:
/Etc/init. d/httpd restart
Apache can parse and execute the php script. Because the default Apache website root directory is located at:/var/www/html/, an info. php file is created in this directory to test whether Apache + PHP is correctly installed or not:
Vi
Then access/info. php in the browser, and the output of PHPINFO is displayed:
PHP and Apache have been correctly installed.
Next, install the MySQL database and other modules (such as the GD graphics library and mbstring Library ):
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. Restart Apache again:
/Etc/init. d/httpd restart
Re-open the IP/info. php page in the browser and find MySQL, GD, mbstring, and other modules:
The LAMP runtime environment has been initially installed. Finally, you need to set the LAMP component to auto start:
1
Chkconfig -- levels 2345 httpd on
2
Chkconfig -- levels 2345 mysqld on
Finally, we will introduce the related configuration and environment.
Apache Main configuration file:/etc/httpd/conf/httpd. conf
Apache Main configuration Directory. you can classify different types of configuration into this directory:/etc/httpd/conf. d/
Apache website root directory:/var/www/html/
Apache log file directory:/var/log/httpd
MySQL my. cnf configuration file:/etc/my. cnf
MySQL database file location:/usr/lib/mysql
Run the yum-y install httpd command to install Apache2 first. after you press enter, yum will prompt the currently installed httpd version and update it automatically. if not...