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 [此時會要求你輸入剛剛設置的密碼,輸入後回車即可

mysql> DROP DATABASE test; [刪除test數據庫]
mysql> DELETE FROM mysql.user WHERE user = ”; [刪除匿名帳戶]
mysql> FLUSH PRIVILEGES; [重載權限]

e、 按照以上的安裝方式, 配置出來的默認站點目錄爲/var/www/html/新建一個php腳本:
phpinfo();
?>

2、安裝phpMyAdmin
進入phpMyAdmin官方下載(不要最新版本,下phpMyAdmin 2.11.9.5就行了,3.1以上需php 5.2以上),上傳到你的網站目錄下,然後進行配置。只需幾步即可搞定。
I. config.sample.inc.php更名爲config.inc.php;
II. 打開config.inc.php文件,進行以下修改;
// $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'] = ”; | 添加短語密碼例如:$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、 配置防火牆
添加允許訪問HTTP、FTP端口
iptables -I RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT

iptables -I RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
重啓iptables: service iptables restart
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章