比较好的更新源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget http://centos.ustc.edu.cn/CentOS-Base.repo----这个有误,请自行网站找去或手动修改,2011-11-10
再更新
安装gcc g++
yum install gcc
yum install gcc-c++
yum 失败原因一:
在CentOS下有的时候用yum安装软件的时候最后会提示:
这是由于yum安装了旧版本的GPG keys造成的,解决办法就是
http://hi.baidu.com/tuenhai/blog/item/590879f0f29b0ecf7831aa65.html
http://hi.baidu.com/smyover/blog/item/9d927a4a27df5e2808f7ef53.html
. 安装Apahce, PHP, Mysql, 以及php连接mysql库组件
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-mysql
3. 启动服务配置
/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 ‘新密码’ [引号内填密码]
让mysql数据库更安全
复制内容到剪贴板
代码:
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’|