NodeBB Forum building in Linux-Installation

Source: Internet
Author: User
Tags install redis

NodeBB Forum building in Linux-Installation

Nodebb is a cool and concise forum system. Based on nodejs, socket. io is used for real-time communication. Socket. the advantage of io is that multiple transmission implementations are provided as message transmission methods (supported transmission methods include WebSocket, Flash, Ajax Long Polling, and so on). The supported browsers include IE5.5 +, Chrome 4 +, firefox 3 +, Android Webkit, and IPhone safari), and encapsulated as simple and consistent APIs for calling. Nodebb provides highly customizable themes and plug-ins. Anyone who wants to create a forum or learn about nodejs can get started immediately.

Example environment:

CentOS v6.5, node. js v0.10.28, Redis v2.8.9, nginx v1.6.0

1. Install basic Dependencies

Install the dependent software first. Here, you can download and install Linux, and use the package manager of each version for faster installation. Nodebb depends on node. js, and the database uses Mongo or redis. Redis is used as an example.

Install nodejs

Select the desired nodejs version on the nodejs download page. Decompress the package and use it. Take the 64-bit Linux version as an example:

wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-x64.tar.gztar -xzf node-v0.10.28-linux-x64.tar.gz

For ease of use, add the bin directory under the node package to/etc/profile, and execute source:

cat << EOF >> /etc/profilePATH=\$PATH:/path/to/node/binexport PATHEOFsource /etc/profile

Note that in order not to replace the PATH variable, "" is used to escape $. If you use vi for editing, you do not need to add.

Install Redis
wget http://download.redis.io/releases/redis-2.8.9.tar.gz    tar -xvf redis-2.8.9.tar.gz    cd redis-2.8.9make

You can also add redis commands to PATH:

cat << EOF >> /etc/profilePATH=\$PATH:/path/to/redis/srcexport PATHEOFsource /etc/profile

Note that source only modifies the environment variables corresponding to the script. If you want to use the new variables after the script is executed, you can`source /etc/profileOr start another terminal.

For security, use redis with a password. Add in redis. conf`requirepass password`

Start redis:

redis-server ./redis.conf

Test redis:

redis-cli auth password
Ii. Install NodeBB

To install NodeBB, you need to use git to clone the code, so install git first:

Install git
yum install git

For other Linux versions except Fedora and CentOS, refer to here for Git installation.

How to Build and use Git servers in Ubuntu

Clone nodebb:

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

Start setup for Configuration:

cd nodebb./nodebb setup 

After the configuration is complete, start nodebb:

./nodebb start
3. Use Nginx proxy

After completing the previous step, the installation is complete. If multiple applications on the server need port 80, you can use nginx to listen to port 80 and proxy the application.

Install nginx
wget http://nginx.org/download/nginx-1.6.0.tar.gztar -xvf nginx-1.6.0.tar.gzcd nginx-1.6.0
Configure nginx

Modify conf/nginx. conf in the nginx directory and add upstream to http. Here, we use my domain name haofan.info and port 4567 as an example:

upstream nodebb {    server haofan.info:4567;}

Create the configuration file conf/site-enabled/nodebb. conf. The content is as follows:

server {    listen       80 ;    server_name haofan.info www.haofan.info;    error_log    logs/nodebb.error.log;    access_log  logs/nodebb.access.log  main;    location / {        root /root/nodebb/public;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_set_header Host $http_host;        proxy_set_header X-NginX-Proxy true;        proxy_pass http://nodebb;        proxy_redirect off;        proxy_buffers 8 32k;        proxy_buffer_size 64k;        # Socket.IO Support        proxy_http_version 1.1;        proxy_set_header Upgrade $http_upgrade;        proxy_set_header Connection "upgrade";    }    error_page   500 502 503 504  /50x.html;    location = /50x.html {    root   html;  }}

Modify the conf/nginx. conf file and use the include method to introduce the configuration file:

include site-enabled/nodebb.conf;
Start nginx
sbin/nginx
Iv. Appendix: nodebb and dependent installation script (excluding nginx ):
#!/bin/shexport SOFT_DIR=/usr/local/export NodeBB_PARENT=/rootfunction exist_cmd(){  if hash "$1" 2>/dev/null; then    echo $1 ok;    return 1;  else    echo $1 not ok;    return 0;  fi}function install_nodebb(){  cd $NodeBB_PARENT  git clone git://github.com/designcreateplay/NodeBB.git nodebb  cd nodebb  npm install  ./nodebb setup}exist_cmd node;if [ $? -eq 0 ] ; then  cd $SOFT_DIR  wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-x64.tar.gz  tar -xzf node-v0.10.28-linux-x64.tar.gz  cd node-v0.10.28-linux-x64  echo "PATH=\$PATH:`pwd`/bin" >> /etc/profile  echo "export PATH" >> /etc/profile  source /etc/profile;fiexist_cmd redis-server;if [ $? -eq 0 ] ; then  cd $SOFT_DIR  wget http://download.redis.io/releases/redis-2.8.9.tar.gz  tar -xvf redis-2.8.9.tar.gz      cd redis-2.8.9  make  echo "PATH=\$PATH:`pwd`/src" >> /etc/profile  echo "export PATH" >> /etc/profile  source /etc/profile  redis-server ./redis.conffiexist_cmd git;if [ $? -eq 0 ] ; then  yum install gitfiif [ -d "$NodeBB_PARENT/nodebb" ] ; then  echo "Exists NodeBB,Delete it ? [yes/no]"  read deleteIt  if [[ $deleteIt == y* ]] ; then    rm -rf $NodeBB_PARENT/nodebb    install_nodebb  fielse  echo "Installing nodebb..."  install_nodebbfi

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.