Posts Tagged: centos


31
十 10

几个软件仓库的粗略统计

粗略统计,只在数量级上有可参考性

按仓库中包含的“包”的数量列表如下:

1. Ubuntu (33468 )

2. Debian ( 29272 )

3. Fedora release 13 (Goddard) ( 18217 )

4. openSUSE 11.3 ( 9453 )

5. ArchLinux ( 4855 )

6. CentOS 5.5 ( 3756 )

7. Mandriva 2010 ( 3421 )

8. Slackware 13.1.0 ( 1011 )

 

详情和统计方法如下(不完全统计):

Debian: 2.9 万

#apt-cache stats

Total package names: 29272 (1171k)

Normal packages: 22114
Pure virtual packages: 369
Single virtual packages: 2072
Mixed virtual packages: 206
Missing: 4511
Total distinct versions: 22621 (1176k)
Total distinct descriptions: 22621 (543k)
Total dependencies: 138199 (3870k)
Total ver/file relations: 47172 (755k)
Total Desc/File relations: 22621 (362k)
Total Provides mappings: 4533 (90.7k)
Total globbed strings: 50 (411)
Total dependency version space: 571k
Total slack space: 96.7k
Total space accounted for: 7159k

 

Ubuntu: 3.3 万

#apt-cache stats

Total package names: 33468 (1,339k)
Normal packages: 25433
Pure virtual packages: 779
Single virtual packages: 1696
Mixed virtual packages: 294
Missing: 5266
Total distinct versions: 30432 (1,704k)
Total distinct descriptions: 30432 (730k)
Total dependencies: 214553 (6,007k)
Total ver/file relations: 31133 (498k)
Total Desc/File relations: 30432 (487k)
Total Provides mappings: 6700 (134k)
Total globbed strings: 129 (1,650)
Total dependency version space: 1,103k
Total slack space: 89.7k
Total space accounted for: 9,774k

 

CentOS 5.5 (x86_64):3.4K

#yum list | wc -l
3756

http://mirrors.sohu.com/centos/5.5/os/x86_64/CentOS/ 中包含: 3455 个软件包。

 

openSUSE 11.3 :  9453 个包

#zypper pa | wc -l

9453

 

Fedora release 13 (Goddard):18217

#yum list | wc -l

18217

 

ArchLinux : 4855

pacman -Sl | wc -l

4855

 

Slackware 13.1.0 : 1011

curl -s http://mirrors.sohu.com/slackware/slackware/slackware/PACKAGES.TXT | grep -c ‘PACKAGE NAME’

Slackware 的包管理 slackpkg 没有提供统计功能……

这个数量跟CentOS一样,应该是发行版光盘上包含的包的数量。

 

Mandriva 2010 : 3421

#urpmq –list | wc -l

Mandriva 2010 桌面免费版的DVD中,包含了 4584个包,外加 1196 个额外的包。


6
八 09

CentOS自动升级问题

CentOS的yum-updatesd服务是可以自动更新系统的,只用稍微调整一个配置文件/etc/yum/yum-updatesd.conf:
[main]
# how often to check for new updates (in seconds)
run_interval = 3600# how often to allow checking on request (in seconds)
updaterefresh = 600

# how to send notifications (valid: dbus, email, syslog)
#emit_via = dbus
emit_via = email
email_from = yum-updatesd@MO01H36
email_to = caoyuwei@xxxx.com

# should we listen via dbus to give out update information/check for
# new updates
dbus_listener = yes

# automatically install updates
do_update = yes

# automatically download updates
do_download = yes

# automatically download deps of updates
do_download_deps = yes

但是最近发生一件怪事儿,由到了许多邮件,内容大致如下:
Hi,
This is the automatic update system on MO01H36.There was a problem updating the system. The following error message was reported:Failed to build transaction: Missing Dependency: /usr/lib/python2.4 is needed by package libxml2-python-2.6.26-2.1.2.7.i386 (installed)
Missing Dependency: /usr/lib/python2.4 is needed by package gamin-python-0.1.7-8.el5.i386 (installed)
If the problem persists, manual intervention may be required.
Thank You,
Your Computer

最终解决方法是:yum clean all
然后便可以 yum update了,yum-updated也会自动更新系统。

感慨一下团队的力量。这个解决办法是神仙发现的,哈,我们总是能遇到这样的惊喜!

PS: 2010-5-14

阅读CentOS 5.4发行说明的时候发现:

CentOS 5.4 包含了 glibc 及内核的更新。通过 yum 来更新的推荐程序是:
yum clean all
yum update glibc\*
yum update yum\* rpm\* python\*
yum clean all
yum update
shutdown -r now
升级是讲求顺序的。

7
十二 08

Cacti的安装(for CentOS 5.2)

系统环境:CentOS 5.2 (Linux)最小化安装+ Development Tools (可以使用yum -y groupinstall Development\ Tools来安装)。

#Cacti Readme 中描述所需要的软件包
PHP 4.3.6+
MySQL 4.1.x or 5.x
RRDTool 1.0.49+ or 1.2.x
NET-SNMP 5.1.2+

#更详细的依赖关系
* httpd
* php
* php-mysql
* php-snmp
* mysql
* mysql-server
* net-snmp

1. Disable SELinux 关闭SELinux
vi /etc/sysconfig/selinux
#SELINUX=enforcing
SELINUX=disabled
设置完需要重新启动

之所以要关闭SELinux是因为国内对SELinux的应用还不普及,假如了解SELinux的使用,那么可以不关闭。正确设置相应的权限即可。

2. 下载 Cacti http://www.cacti.net
wget http://www.cacti.net/downloads/cacti-0.8.7b.tar.gz

3. 安装所需的包

yum -y install httpd
yum -y install php
yum -y install php-mysql
yum -y install php-snmp
yum -y install mysql-server
yum -y install perl
yum -y install net-snmp-utils

有可能需要安装(没有安装Development Tools的情况下):

yum -y install libpng
yum -y install freetype
yum -y install libart_lgpl 

4. 将httpd和mysqld设置成自动启动

chkconfig httpd on
chkconfig mysqld on
5. 下载 rrdtool http://oss.oetiker.ch/rrdtool/download.var
wget http://dag.wieers.com/rpm/packages/rrdtool/perl-rrdtool-1.2.23-1.el5.rf.i386.rpm
wget http://dag.wieers.com/rpm/packages/rrdtool/rrdtool-1.2.23-1.el5.rf.i386.rpm
6. 安装 rrdtool
rpm -ivh perl-rrdtool-1.2.23-1.el5.rf.i386.rpm rrdtool-1.2.23-1.el5.rf.i386.rpm

7. 修改mysqld配置,将默认字符集设置成utf-8,这样可以方便cacti中显示中文菜单
vi /etc/my.cnf
[mysqld]
collation-server = utf8_general_ci
default-collation = utf8_general_ci
character-set-server = utf8
default-character-set = utf8
[mysql]
default-character-set = utf8

8. 建立cacti所需数据库,并设置相关权限,下面其实建了两个用户,适应不同mysql环境。
mysqladmin create cacti
mysql cacti < cacti.sql ( cacti.sql cacti目录下)
mysql> create user cacti@’localhost’;
mysql> create user cacti@’127.0.0.1′;
mysql> grant all privileges on cacti.* to cacti@’localhost’;
mysql> grant all privileges on cacti.* to cacti@’127.0.01′;
mysql> set password for cacti@’localhost’= password(‘cactipasswd’);
mysql> set password for cacti@’127.0.0.1′ = password(‘cactipasswd’);

9. 修改cacti配置文件
vi include/config.php ( cacti目录下)
$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cacti”;
$database_password = “cacitpasswd”;
$database_port = “3306″;

10. 为cacti配置apache访问
vi /etc/httpd/conf.d/cacti.conf
Alias /cacti /srv/_webapp/cacti

<Directory /srv/_webapp/cacti>

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

</Directory>

11. 设置cacti数据保存目标权限
chown -R apache rra log ( cacti目录下)

12.设置cacti采集
vi /etc/cron.d/cacti
*/5 * * * * apache /usr/bin/php -q /srv/_webapp/cacti/poller.php > /srv/_webapp/cacti/log/poller.log 2>&1

13. 未提到过的配置文件,均使用系统默认。


28
九 08

禁止对数据分区的locate数据库更新

我们的/srv/分区相当的大,图片服务器的就更大了。

所以是不能允许对这个分区的文件进行(locate)索引的,即使系统使用的renice +19的方式运行,也是仍然是对系统资源的浪费。一来浪费CPU资源,二来浪费硬盘I/O,三,会使updatedb的数据库巨大,规划不当的话会使/var分区满掉(或者/分区满掉,假如var不是单独分区的话)。

使用cfengine更新了所有系统的配置文件,排除了对/srv分区的索引。

#/etc/updatedb.conf
PRUNEFS = “auto afs iso9660 sfs udf”
PRUNEPATHS = “/afs /media /net /sfs /tmp /udev /var/spool/cups /var/spool/squid /var/tmp /srv /mnt”