Centos 裏的 yum 在線安裝很慢.如下是替換爲中國CentOS鏡像服務器!
中國官方鏡像網站: http://centos.ustc.edu.cn/
/* 使用說明 */
cd /etc/yum.repos.d[進入yum.repos.d目錄]
mv CentOS-Base.repo CentOS-Base.repo.save[修改源文件名稱備份]
wget http://centos.ustc.edu.cn/CentOS-Base.repo.5[下載]
mv CentOS-Base.repo.5 CentOS-Base.repo[下載後的文件改名]php
1. 更新系統內核到最新.
yum -y update
系統更新後,若是yum安裝時提示錯誤信息,請執行如下命令修復.
rpm –import /etc/pki/rpm-gpg/RPM*mysql
2. 安裝Apahce, PHP, Mysql, 以及php鏈接mysql庫組件sql
yum -y install httpd php mysql mysql-server php-mysql數據庫
//安裝mysql擴展
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
//安裝php的擴展
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
//安裝apache擴展
yum -y install httpd-manual mod_ssl mod_perl mod_auth_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-mysqlapache
3. 啓動服務配置centos
/sbin/chkconfig httpd on [設置apache爲自啓動]
/sbin/chkconfig –-add mysqld [mysql服務]
/sbin/chkconfig mysqld on [mysqld服務]安全
/sbin/service httpd start [自啓動 httpd 服務]
/sbin/service mysqld start [自啓動mysqld服務]服務器
4.設置mysql數據庫root賬號密碼。
mysqladmin -u root password ‘新密碼’ [引號內填密碼]tcp
讓mysql數據庫更安全ide
複製內容到剪貼板
代碼:
mysql -u root -p [此時會要求你輸入剛剛設置的密碼,輸入後回車便可
mysql> DROP DATABASE test; [刪除test數據庫]
mysql> DELETE FROM mysql.user WHERE user = 」; [刪除匿名賬戶]
mysql> FLUSH PRIVILEGES; [重載權限]
5. 防火牆配置
a.添加.容許訪問端口{21: ftp, 80: http}.
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
鬱悶.請把上面複製到記事本里,而後把–state這段–改爲小寫的,再操做.不然粘貼時會出現亂碼.
b.關閉防火牆{不推薦}.
service iptables stop
c.重置加載防火牆
service iptables restart
6. 安裝phpMyAdmin
進入phpMyAdmin官方下載最新版本後,上傳到你的網站目錄下,而後進行配置。只需幾步便可搞定。
a. config.sample.inc.php改名爲config.inc.php;
b. 打開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’;
去掉每行前面的//;
c.$cfg['blowfish_secret'] = 」; |修改成| $cfg['blowfish_secret'] = ‘http’;
d.$cfg['Servers'][$i]['controluser'] = ‘pma’; |把’pma’修改成你的賬號|
e.$cfg['Servers'][$i]['controlpass'] = ‘pmapass’; |把’pmapass設置爲你的mysql登陸密碼|
f. $cfg['blowfish_secret'] = 」; | 添加短語密碼例如:$cfg['blowfish_secret'] = ‘onohot’|