10月 25

阿里云主机 yum 工具报错处理

试用了阿里云主机系统版本:Centos6.2 x64

安装gcc报错:

# yum install gcc

Error: Package: glibc-headers-2.12-1.80.el6_3.5.x86_64 (updates)
Requires: kernel-headers
Error: Package: glibc-headers-2.12-1.80.el6_3.5.x86_64 (updates)
Requires: kernel-headers >= 2.2.1
You could try using –skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), ‘yum check’ output follows:
kernel-2.6.32-220.13.1.el6.x86_64 has missing requires of kernel-firmware >= (‘0’, ‘2.6.32’, ‘220.13.1.el6’)

解决方法:

# vim /etc/yum.conf 注释
“#exclude=kernel*”

去除检查安装软的依赖

开始安装

# yum clean all

# yum install gcc -y

9月 26

centos安装node.js简单测试

操作系统

Centos 5.4 Linux 2.6.18-164.el5 4G内存、Xeon(TM) CPU 3.20GHz

node-v0.5.7

node的官方网站http://nodejs.org/ 使用官方网站示例。

再安装前请将开发工具(tcl-developenssl-develglibc-devel bzip2*等)安装,可以使用yum工具。

安装

# tar zxvf node-v0.5.7.tar.gz

# cd node-v0.5.7

# ./configure

# make

有报make: [all] Error 1 (ignored) 但是没有找到问题,忽略了直接做下一步。

# make install

收到安装成功讯息。

建立一个node.js档案。

vim node.js

var http = require(‘http’);

http.createServer(function (req, res) {

res.writeHead(200, {‘Content-Type’: ‘text/plain’});

res.end(‘Hello Node.jsn‘);

}).listen(8124, “192.168.1.200”);

console.log(‘Server running at http://192.168.1.200:8124/’);

执行node.js

# node node.js

打开浏览器使用连接http:// 192.168.1.200:8124看到Hello Node.js,就表示node.js已经正在运作中。

进行个简单测试,使用apacheab工具

命令# ./ab -c10000 -n 40000 http:// 192.168.1.200:8124/

Complete requests: 40000

并发数: 3498.75 [#/sec]

平均返回相应时间: 0.286 [ms]

传输量: 266.51 [Kbytes/sec]

无请求失败。

在同一台机器上使用django写个,测试一下。

环境Python 2.6.6 django 1.3.0 关闭debug状态

代码为:

#!/bin/evn python

from django.http import HttpResponse

def index(request):

html = “Hello Djangon”

return HttpResponse(html)

直接使用python自带的调试服务器

# python manage.py runserver 192.168.1.200:9000

因为4000030000时将服务器跑死了(报错apr_socket_recv: Connection timed out (110)),所以修改为25000进行测试,结果也死了,改20000也死了,直接改15000也死了。算了我不测了。

总结:初步看node js效率确实很高,python+django自带的服务器的效