Generally, the latest official version is installed. Unless you have special requirements and want to install the specified version, this article will not discuss it for the moment. From the very beginning, complete an available Linux host a little bit. Here we will introduce how to install the LAMP component on CentOS 6.0. After the following statement is installed, the current version is:
 
 
 - PHP: 5.3.2
- Apache: 2.2.15
- MySQL: 5.1.52
1. Install MySQL
 
First, install MySQL. Open the Super Terminal and enter:
 
[root@localhost ~]# yum install mysql mysql-server
 
After installation, MySQL can be automatically started with the system:
 
[root@localhost ~]# chkconfig --levels 235 mysqld on[root@localhost ~]# /etc/init.d/mysqld start
 
Set the password for the root account of MySQL Data:
 
[root@localhost ~]# mysql_secure_installation
 
Press enter when prompted as follows:
 
Enter current password for root
 
Press enter again as follows:
 
Set root password? [Y/n]
 
The following prompt is displayed: enter the password you want to set. Press enter and enter a confirmation message:
 
New password:
 
There will be four further confirmations:
 
Remove anonymous users? [Y/n]Disallow root login remotely? [Y/n]Remove test database and access to it? [Y/n]Reload privilege tables now? [Y/n]
 
Press enter.
 
Ii. install Apache Components
 
Since CentOS has encapsulated Apache, run and install it directly:
 
[root@localhost ~]# yum install httpd
 
Configure the system to enable Apache with the system:
 
[root@localhost ~]# chkconfig --levels 235 httpd on
 
After the configuration is complete, start Apache:
 
[root@localhost ~]# /etc/init.d/httpd start
 
Now you can access your server. If you don't miss it, you can see the Test Page of "Apache 2 Test Page powered by CentOS. NOTE: If other machines cannot access this service and the page is accessible directly on this server, the built-in firewall of CentOS is generally disabled. You only need to enter the firewall and open the "80" port corresponding to "WWW.
 
 
Note: In CentOS, the default Apache root directory is/var/www/html, and the configuration file/etc/httpd/conf/httpd. conf is used. Other configurations are stored in the/etc/httpd/conf. d/directory.
3. install PHP
 
Run the following command to install PHP:
 
[root@localhost ~]# yum install php
 
You need to restart the Apache service:
 
[root@localhost ~]# /etc/init.d/httpd restart
 
Iv. Test PHP Information
 
This step can be omitted, but to test whether the installation is successful, you can create a new PHP page for testing and use the vim editor to create a new one:
 
[root@localhost ~]# vi /var/www/html/info.php
 
Press the "I" key and enter:
 
<?phpphpinfo();?>
 
After editing, Press ESC to exit the editing mode, and then enter:
 
:wq
 
Press enter to save and exit.
 
In this case, you can visit your site address, such as "http: // 192.168.1.2/info. php", to check whether the relevant PHP information can be seen.
 
 
The following figure shows that PHP is successfully installed.
 
5. Associate the PHP module with the MySQL Module
 
You also need to associate PHP with MySQL to work properly. Search module:
 
[root@localhost ~]# yum search php
 
Install related modules:
 
[root@localhost ~]# yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
 
Restart the Apache module to take effect:
 
[root@localhost ~]# /etc/init.d/httpd restart
 
Refresh the "info. php" page just created, and pull down to find the relevant MySQL module to see if relevant information is detected.
 
 
If you see the relevant information, it means that MySQL is working properly.
 
Vi. Summary
 
This article describes how to install the LAMP component (Apache + MySQL + PHP) in CentOS 6.0 to familiarize more beginners with the server configuration environment.
 
However, at this point, the Environment configuration is complete, and many things are still lacking, and there are still some important problems, such as directory permission configuration problems or management problems, such as creating FTP. These contents will be discussed later.