在centos中使用yum安裝lamp比較方便, php
apache安裝:yum install httpd mysql
php安裝:yum install php sql
mysql安裝:yum install mysqld apache
安裝mysql以後要設置密碼,而後輸入命令:mysql_secure_installation; centos
系統提示: xml
In order to log into MySQL to secure it, we'll need the current rpc
password for the root user. If you've just installed MySQL, and string
you haven't set the root password yet, the password will be blank, it
so you should just press enter here. io
Enter current password for root (enter for none): (通常剛裝上mysql,root沒有密碼,在此直接Enter)
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] Y
New password: 12345678 //設定新密碼
Re-enter new password:12345678 //再次確認密碼
以後一路Enter就能夠了
讓PHP支持mysqlyum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring
.配置httpd、mysqld開機自啓動
chkconfig mysqld on
chkconfig httpd on
重啓httpd,