Install Apache + php + Mysql on yum on CentOS5

Source: Internet
Author: User
The online yum installation in Centos is slow. replace the following with the CentOS image server in China!

1. install and configure Apache + php + Mysql

The online yum installation in Centos is slow. replace the following with the CentOS image server in China!

China official image site: http://centos.ustc.edu.cn/

/* Instructions */

Cd/etc/yum. repos. d [go to the yum. repos. d Directory]

Mv CentOS-Base.repo CentOS-Base.repo.save [modifying source file name backup]

Wget http://centos.ustc.edu.cn/centos-base.repo.5 download]

Mv CentOS-Base.repo.5 CentOS-Base.repo [renamed downloaded file]

1. update the system kernel to the latest version.

Yum-y update

After the system is updated, if an error message is prompted During yum installation, run the following command to fix the problem.

Rpm-import/etc/pki/rpm-gpg/RPM-GPG-KEY *

2. install Apahce, PHP, Mysql, and php to connect to the mysql Library component.

// Install mysql

Yum-y install httpd php mysql-server php-mysql

// Install mysql extension

Yum-y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql

// Install php extension

Yum-y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc

// Install apache extension

Yum-y install httpd-manual mod_ssl mod_perl mod_auth_mysql

One-time paste installation:

Yum-y install httpd php mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql

3. start service configuration

/Sbin/chkconfig httpd on [set apache to self-start]
/Sbin/chkconfig -- add mysqld [mysql Service]

/Sbin/chkconfig mysqld on [mysqld Service]

/Sbin/service httpd start [self-starting httpd service]

/Sbin/service mysqld start [self-starting mysqld service]

4. set the password of the root account of the mysql database.

Mysqladmin-u root password 'new password' [enter the password in quotation marks]

5. make mysql database more secure

Mysql-u root-p [this requires you to enter the password you just set, enter it and press enter.
Mysql> drop database test; [delete the test DATABASE]

Mysql> delete from mysql. user WHERE user = "; [deleting anonymous accounts]

Mysql> flush privileges; [reload permissions]

According to the above installation method, the default site directory configured is/var/www/html/to create a php script:

Phpinfo ();

?>

6. firewall configuration (important) reference: http://blog.haohtml.com/index.php/archives/5246

A. add. allow access to port {21: ftp, 80: http }.

/Sbin/iptables-I INPUT-p tcp-dport 80-j ACCEPT
/Sbin/iptables-I INPUT-p tcp-dport 22-j ACCEPT

B. Save

Service iptables save

C. reset and load the firewall

Service iptables restart

7. install Zend Optimizer in CentOs 5

The above method, by default has installed ZendOptimizer, if the system is not installed, please refer to here to install http://blog.haohtml.com/index.php/archives/5251

8. test the configuration to create a new info. php file under the default htdocs directory/var/www/html/of apache. (note that the file permission must be readable, otherwise it cannot be accessed !) Or you can directly use vi to create one. # Vi/var/www/html/info. php Wq save. then open http: // 127.0.0.1/info. php in the client browser. If php information is displayed, the installation is successful. Of course, you can also install some apache mysql extensions, such
# Yum-y install httpd-manual mod_ssl mod_perl mod_auth_mysql # yum-y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
So far, the installation is complete. Yum is really easy to use. In addition, the php configuration file is in/etc/php. ini and/etc/php. d/
Put the php modules in the configuration file of apache under/usr/lib/php/modules and open the configuration file httpd. conf of apache under/etc/httpd/conf/to add
AddType application/x-httpd-php. php. php3AddType application/x-httpd-php-source. phps
Change allowoveride to all so that. htaccess can work normally. other detailed configurations are not described much. you can refer to the detailed apache configuration instructions. This should be done!

9. install phpMyAdmin. download the latest phpMyAdmin version, upload it to your website directory, and configure it. You can do this in just a few steps.

A. config. sample. inc. php is renamed as config. inc. php;

B. open the config. inc. php file and make the following changes;

// $ Cfg ['servers'] [$ I] ['controluser'] = 'PMA ';

// $ Cfg ['servers'] [$ I] ['controlpass'] = 'pmapass ';

// $ Cfg ['servers'] [$ I] ['pmadb'] = 'phpmyadmin ';

// $ Cfg ['servers'] [$ I] ['bookmarktable'] = 'PMA _ bookmark ';

// $ Cfg ['servers'] [$ I] ['relation'] = 'PMA _ relation ';

// $ Cfg ['servers'] [$ I] ['Table _ info'] = 'PMA _ table_info ';

// $ Cfg ['servers'] [$ I] ['Table _ coords '] = 'PMA _ table_coords ';

// $ Cfg ['servers'] [$ I] ['PDF _ page'] = 'PMA _ pdf_pages ';

// $ Cfg ['servers'] [$ I] ['column _ info'] = 'PMA _ column_info ';

// $ Cfg ['servers'] [$ I] ['History '] = 'PMA _ history ';

// $ Cfg ['servers'] [$ I] ['designer _ coords '] = 'PMA _ designer_coords ';

Remove the // before each line //;

C. $ cfg ['blowfish _ secret'] = "; | modified to | $ cfg ['blowfish _ secret'] = 'http ';

D. $ cfg ['servers'] [$ I] ['controluser'] = 'PMA'; | modify 'PMA' to your account |

E. $ cfg ['servers'] [$ I] ['controlpass'] = 'pmapass'; | set 'pmapass to your mysql logon password |

F. $ cfg ['blowfish _ secret'] = "; | add a phrase password, for example, $ cfg ['blowfish _ secret'] = 'onohot '|

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.