linux下使用yum安裝Apache+php+Mysql+phpMyAdmin
適用redhat于32位及64位,前提架設好本地源。在這里不再贅述。
1 安裝Apache+php+Mysql
a、安裝Apahce, PHP, Mysql, 以及php連接mysql庫組件 yum -y install httpd php mysql mysql-server php-mysql
b、安裝mysql擴展 yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
或一次性粘貼安裝:
yum -y install httpd php mysql 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
c、設置mysql數據庫root帳號密碼。
mysqladmin -u root password ‘newpassword’ [引號內填密碼]
d、 讓mysql數據庫更安全
mysql -u root -p [此時(shí)會(huì )要求你輸入剛剛設置的密碼,輸入后回車(chē)即可
mysql> DROP DATABASE test; [刪除test數據庫]
mysql> DELETE FROM mysql.user WHERE user = ”; [刪除匿名帳戶(hù)]
mysql> FLUSH PRIVILEGES; [重載權限]
e、 按照以上的安裝方式, 配置出來(lái)的默認站點(diǎn)目錄為/var/www/html/新建一個(gè)php腳本:
<?php
phpinfo();
?>
2、安裝phpMyAdmin
進(jìn)入phpMyAdmin官方下載(不要最新版本,下phpMyAdmin 2.11.9.5就行了,3.1以上需php 5.2以上),上傳到你的網(wǎng)站目錄下,然后進(jìn)行配置。只需幾步即可搞定。
I. config.sample.inc.php更名為config.inc.php;
II. 打開(kāi)config.inc.php文件,進(jìn)行以下修改;
// $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_pages'] = ‘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’;
去掉每行前面的//;
II.$cfg['blowfish_secret'] = ”; |修改為| $cfg['blowfish_secret'] = ‘http’;
IV.$cfg['Servers'][$i]['controluser'] = ‘pma’; |把’pma’修改為你的帳號|$cfg['Servers'][$i]['controlpass'] = ‘pmapass’; |把’pmapass設置為你的mysql登錄密碼|
V. $cfg['blowfish_secret'] = ”; | 添加短語(yǔ)密碼例如:$cfg['blowfish_secret'] = ‘onohot’;
3、//安裝php的擴展
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
4、//安裝apache擴展
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
5、 配置防火墻
添加允許訪(fǎng)問(wèn)HTTP、FTP端口
iptables -I RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPTiptables -I RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
重啟iptables: service iptables restart