首页 / 操作系统 / Linux / Linux下安装配置Node及Memcached
这篇主要是记录Linux下安装Node及memcached遇到的问题及安装配置过程,方便日后查阅Node安装及配置[root@hostname ~]tar zxvf node-v0.12.4.tar.gz[root@hostname ~]cd node-v0.12.4[root@hostname ~]./configure --prefix=/usr/local/node[root@hostname ~]make[root@hostname ~]make install[root@hostname ~]cd .. 安装完后需要配置Node的环境变量[root@hostname ~]export PATH=/usr/local/node/bin: //关闭终端后再次打开就失效了[root@hostname ~]vi /etc/profile 在文件末尾添加以下内容 export NODE_HOME=/usr/local/node export PATH =$PATH:$NODE_HOME/bin export NODE_PATH =$NODE_HOME/lib/node_modules[root@hostname ~]source /etc/profile 使修改立即生效 检查是否安装成功[root@hostname ~]node -v[root@hostname ~]v0.12.4[root@hostname ~]node>console.log("installing success")installing successundefined> 一切正常,完成安装memcached安装配置 由于memcached的执行需要依赖于libevent,先安装libevent(有的Linux系统自带libevent安装软件,考虑到版本问题,建议自行安装libevent)[root@hostname ~]tar zxvf libevent-2.0.22-stable.tar.gz[root@hostname ~]cd libevent-2.0.22-stable[root@hostname ~]./configure --prefix=/usr[root@hostname ~]make[root@hostname ~]make install 安装memcached[root@hostname ~]tar xzvf memcached-1.4.24.tar.gz[root@hostname ~]cd memcached-1.4.24[root@hostname ~]./configure --with-libevent=/usr[root@hostname ~]make[root@hostname ~]make install 安装完成后启动memcached[root@hostname ~]memcached -d -m 2048 -uroot -l 127.0.0.1 -p 11211 -c 256 -P /usr/local/bin/memcached.pid 参数说明:
-d 选项是启动一个守护进程,
-m 是分配给Memcache使用的内存数量,单位是MB,这里是2G,
-u 是运行Memcache的用户,这里是root,
-l 是监听的服务器IP地址,如果有多个地址的话,以逗号隔开。这里指定了localhost,
-p 是设置Memcache监听的端口,默认11211,最好是1024以上的端口,
-c 选项是最大运行的并发连接数,默认是1024,我这里设置了256,按照你服务器的负载量来设定,
-P 是设置保存Memcache的pid文件,我这里是保存在 /usr/local/bin/memcached.pid 检查memcached是否正确运行,这里使用telnet命令检查[root@hostname ~]telnet 127.0.0.1 11211Trying 127.0.0.1...Connected to 127.0.0.1.Escape character is "^]". 到这里memcached也完成安装-------------------------------------------------------------------------------- tips:如果使用telnet命令时提示:command not found ------说明没有安装telnet命令,CentOS直接使用yum安装[root@hostname ~]yum install telnet下面关于Node.js的内容你可能也喜欢:在 Ubuntu 14.04/15.04 上安装配置 Node.js v4.0.0 http://www.linuxidc.com/Linux/2015-10/123951.htm如何在CentOS 7安装Node.js http://www.linuxidc.com/Linux/2015-02/113554.htmUbuntu 14.04下搭建Node.js开发环境 http://www.linuxidc.com/Linux/2014-12/110983.htmUbunru 12.04 下Node.js开发环境的安装配置 http://www.linuxidc.com/Linux/2014-05/101418.htmNode.Js入门[PDF+相关代码] http://www.linuxidc.com/Linux/2013-06/85462.htmNode.js开发指南 高清PDF中文版 +源码 http://www.linuxidc.com/Linux/2014-09/106494.htmNode.js入门开发指南中文版 http://www.linuxidc.com/Linux/2012-11/73363.htmUbuntu 编译安装Node.js http://www.linuxidc.com/Linux/2013-10/91321.htmNode.js 的详细介绍:请点这里
Node.js 的下载地址:请点这里本文永久更新链接地址