【记录】CentOS7安装NODEBB

NodeBB介绍:

  NodeBB 是一个更好的论坛平台,专门为现代网络打造。它是免费的,易于使用。 NodeBB 论坛软件是基于 Node.js 开发,支持 Redis 或 MongoDB 的数据库。它利用 Web Socket 实现即时交互和实时通知。NodeBB 向下兼容到 IE8 ,有许多现代化的开箱即用功能:如社交网络集成和流媒体的讨论。

  

NodeBB安装流程:

  1、首先安装NodeJs环境:

  [root@localhost ~]# yum install nodejs npm

  然后验证下安装:

[root@localhost ~]# npm

Usage: npm <command>

where <command> is one of:
    add-user, adduser, apihelp, author, bin, bugs, c, cache,
    completion, config, ddp, dedupe, deprecate, docs, edit,
    explore, faq, find, find-dupes, get, help, help-search,
    home, i, info, init, install, isntall, issues, la, link,
    list, ll, ln, login, ls, outdated, owner, pack, prefix,
    prune, publish, r, rb, rebuild, remove, restart, rm, root,
    run-script, s, se, search, set, show, shrinkwrap, star,
    stars, start, stop, submodule, tag, test, tst, un,
    uninstall, unlink, unpublish, unstar, up, update, version,
    view, whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    /root/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@1.3.6 /usr/lib/node_modules/npm

  看到以上信息代表安装完了。

  此处需要特别注意,如果NodeJs版本太老可能会出现各种问题,而无法使用,建议使用LTS版本4.5以及以上版本的NODEJS,具体区别请看官网。

  LTS代表社区维护版本,可以用于生产或测试环境的稳定版本,其中分4、6,2个版本,目前推荐使用为4.5版本,奇数前缀如5.X版本为测试版本或实验性版本,不建议用于生产环境,但可以用于测试环境。

  例如本文安装的是0.10.46 yum版本,存在一个无法启动的问题,NPM版本也有点老。

  报错:

[outdated] mongodb installed v2.1.22-alpha4, package.json requires ~2.1.3
29/8 16:48 [2382] - warn: One or more of NodeBB's dependent packages are out-of-date. Please run the following command to update them:
29/8 16:48 [2382] - warn: ./nodebb upgrade
[cluster] Child Process (2382) has exited (code: 0, signal: null)

  NODEBB无法启动,原因是依赖的MongoDB驱动为2.1.22实际上需求为2.1.3所以无法启动导致。

  附上一个4.5的安装方法(源码安装):

[root@localhost ~]# wget https://nodejs.org/dist/v4.5.0/node-v4.5.0.tar.gz
[root@localhost ~]# tar -xvf node-v4.5.0.tar.gz 
[root@localhost ~]# cd node-v4.5.0/
[root@localhost ~]# ./configure
[root@localhost ~]# make
[root@localhost ~]# make install

  2、安装数据库:

[root@localhost ~]# yum install redis

  安装完毕以后,试着启动一下,其余按照REDIS方式走就行了,这里默认是2.8版本

  不开心可以用源码安装噢

  NODEBB可以采用MongoDB,由于我是本地虚拟机,我内存不足,而且我之前工作与MongoDB有关,所以我这里就改为使用MongoDB了。

  Yum源安装MongoDB:

  首先创建文件 /etc/yum.repos.d/mongodb-org-3.2.repo ,然后 打开文件,将以下内容粘贴进入该文件并保存。

  此处可以使用WINSCP搞定。

[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc

  然后执行:

 [root@localhost ~]# yum install -y mongodb-org
 [root@localhost ~]# sudo service mongod start
   Starting mongod (via systemctl): [ 确定 ]

  安装数据库内容:

[root@localhost ~]# mongo
MongoDB shell version: 3.2.9
connecting to: test
Server has startup warnings: 
2016-08-29T15:52:00.580+0800 I CONTROL  [initandlisten] 
2016-08-29T15:52:00.580+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-08-29T15:52:00.580+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-08-29T15:52:00.580+0800 I CONTROL  [initandlisten] 
2016-08-29T15:52:00.580+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-08-29T15:52:00.580+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-08-29T15:52:00.580+0800 I CONTROL  [initandlisten] 
2016-08-29T15:52:00.580+0800 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 4096 processes, 65536 files. Number of processes should be at least 32768 : 0.5 times number of files.
2016-08-29T15:52:00.580+0800 I CONTROL  [initandlisten] 
> use nodebb;
switched to db nodebb
> 

  数据安装完成,如果这个时候你想用密码或账户登陆,那么执行:

db.createUser( { user: "nodebbroot", pwd: "1234567890", roles: [ "readWrite" ] } )

  打开 /etc/mongodb.conf 文件:

  修改内容

security:
  authorization: enabled

  然后重启MongoDB,如果权限错了,只要把这个删掉,再重启就好了。

  其他MongoDB内容请参考MongoDB的博文。

  3、安装依赖库:

[root@localhost ~]# yum install ImageMagick ImageMagick-devel

  测试安装成功否:

[root@localhost ~]# convert -version
Version: ImageMagick 6.7.8-9 2016-06-16 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

  4、安装NodeBB:

   Git克隆NodeBB到指定目录,你随意:

git clone git://github.com/designcreateplay/NodeBB.git nodebb

  然后用NodeJs安装它:

[root@localhost nodebb]# ./nodebb setup
[root@localhost nodebb]# ./nodebb start

  当大致安装完毕后,可以采用Ngix做反向代理,从而隐藏掉4567这样的端口。

posted @ 2016-08-29 16:50  koangel  阅读(2190)  评论(0编辑  收藏  举报