暗能星系

    • 登录
    • 搜索

    Nodebb论坛安装过程记录

    其它
    2
    4
    27
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • A
      anneng 最后由 anneng 编辑

      https://docs.nodebb.org/installing/os/ubuntu/
      1.环境:Ubuntu 18.04 内存需要512MB以上。
      2.安装Node
      当前只能使用12版本 不能使用14版本

      $ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
      $ sudo apt-get install -y nodejs
      

      3.安装MongoDB

      $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
      $ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
      $ sudo apt-get update
      $ sudo apt-get install -y mongodb-org
      $ sudo systemctl start mongod
      $ sudo systemctl status mongod
      

      配置数据库:

      $ mongo
      > use admin
      > db.createUser( { user: "admin", pwd: "<Enter a secure password>", roles: [ { role: "root", db: "admin" } ] } )
      > use nodebb
      > db.createUser( { user: "nodebb", pwd: "<Enter a secure password>", roles: [ { role: "readWrite", db: "nodebb" }, { role: "clusterMonitor", db: "admin" } ] } )
      > quit()
      $ sudo systemctl restart mongod
      $ mongo -u admin -p your_password --authenticationDatabase=admin
      

      4.安装Nodebb

      $ git clone -b v1.13.x https://github.com/NodeBB/NodeBB.git nodebb
      $ cd nodebb
      

      Git安装现在不知道什么原因,比较慢,可以用浏览器下载代码。
      $ ./nodebb setup (如果卡死 可以使用npm install访问淘宝安装)
      这个步骤会用npm安装node modules 经常卡死,建议使用淘宝镜像:
      npm config set registry http://registry.npm.taobao.org
      配置后如果下载卡死,稍等一下。
      将config.json中的url改为服务器的IP,否则websocket会报错。
      最后启动服务
      $ ./nodebb start
      5.使用nginx代理
      $ cd /etc/nginx/sites-available
      $ sudo nano nodebb
      $ cd ../sites-enabled
      $ sudo ln -s ../sites-available/nodebb

      server {
          listen 80;
      
          server_name forum.example.com;
      
          location / {
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $scheme;
              proxy_set_header Host $http_host;
              proxy_set_header X-NginX-Proxy true;
      
              proxy_pass http://127.0.0.1:4567;
              proxy_redirect off;
      
              # Socket.IO Support
              proxy_http_version 1.1;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection "upgrade";
          }
      }
      

      $ sudo systemctl reload nginx

      ===================================================
      修复无法上传图片的问题:
      下载 libvips-8.9.2 (ubuntu 18.04默认的版本太低 需要源码安装)
      sudo apt-get install gtk-doc-tools
      sudo apt-get install gobject-introspection
      ./autogen.sh
      make && sudo make install
      创建usrlocal.conf 内容为 /usr/local/lib 将该文件放到 /etc/ld.so.conf.d
      npm install sharp@0.24.0

      1 条回复 最后回复 回复 引用 0
      • I
        ice-melt 最后由 编辑

        @anneng 在 Nodebb论坛安装过程记录 中说:

        sudo apt-get update

        使用此命令报错,报错信息如下:

        问题1

        E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
        E: Unable to lock directory /var/lib/apt/lists/
        

        解决方法:

        sudo fuser -vki /var/lib/apt/lists/lock
        

        最好多次使用此命令,把占用的进程全部kill,再进行sudo apt-get update等操作

        问题2

        W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
        W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
        W: Target Translations (stable/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
        W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
        W: Target CNF (stable/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
        W: Target CNF (stable/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
        
        

        解决方法:
        应该是源配置重复了,按提示进入文件查看并修改

        最好多次使用此命令,把占用的进程全部kill,再进行sudo apt-get update等操作

        I 1 条回复 最后回复 回复 引用 0
        • A
          anneng 最后由 编辑

          升级过程
          千万要记得先备份数据 特别是public里面的上传的数据!!
          https://docs.nodebb.org/configuring/upgrade/
          Upgrading NodeBB
          NodeBB's periodic releases are located in the Releases. These releases contain what is usually considered the most bug-free code, and is designed to be used on production-level instances of NodeBB.

          You can utilise git to install a specific version of NodeBB, and upgrade periodically as new releases are made.

          To obtain the latest fixes and features, you can also git clone the latest version directly from the repository (master branch), although its stability cannot be guaranteed. Core developers will attempt to ensure that every commit results in a working client, even if individual features may not be 100% complete.

          As always, the NodeBB team is not responsible for any misadventures, loss of data, data corruption, or any other bad things that may arise due to a botched upgrade - so please don't forget to back up before beginning!

          Upgrade Path
          NodeBB's upgrade path is designed so that upgrading between versions is straightforward.

          Upgrade Steps

          1. Shut down your forum
            While it is possible to upgrade NodeBB while it is running, it is definitely not recommended, particularly if it is an active forum:

          $ cd /path/to/nodebb
          $ ./nodebb stop
          2. Back up your data
          Backing up Redis
          As with all upgrades, the first step is to back up your data! Nobody likes database corruption/misplacement.

          All of the textual data stored in NodeBB is found in a .rdb file. On typical installs of Redis, the main database is found at /var/lib/redis/dump.rdb.

          Store this file somewhere safe.

          Backing up MongoDB
          To run a backup of your complete MongoDB you can simply run

          mongodump

          which will create a directory structure that can be restored with the mongorestore command.

          It is recommended that you first shut down your database. On Debian / Ubuntu it's likely to be: sudo service mongodb stop

          Store this file somewhere safe.

          Uploads
          Uploaded images and files are stored in /public/uploads. Feel free to back up this folder too:

          cd /path/to/nodebb/public
          tar -czf ~/nodebb_assets.tar.gz ./uploads
          3. Grab the latest and greatest code
          Navigate to your NodeBB: $ cd /path/to/nodebb.

          If you are upgrading from a lower branch to a higher branch, switch branches as necessary. Make sure you are completely up-to-date on your current branch!.

          For example, if upgrading from v1.11.1 to v1.12.0:

          $ git fetch # Grab the latest code from the NodeBB Repository
          $ git checkout v1.12.x # Type this as-is! Not v1.12.0 but "v1.12.x"!
          $ git merge origin/v1.12.x
          If not upgrading between branches (e.g. v1.12.0 to v1.12.1, just run the following commands:

          $ git fetch
          $ git reset --hard origin/v1.12.x # Replace v1.12.x with the branch name!
          This should retrieve the latest (and greatest) version of NodeBB from the repository.

          Don't know what branch you are on? Execute git rev-parse --abbrev-ref HEAD to find out.

          Alternatively, download and extract the latest versioned copy of the code from the Releases Page. Overwrite any files as necessary. This method is not supported.

          1. Run the NodeBB upgrade script
            This script will install any missing dependencies, upgrade any plugins or themes (if an upgrade is available), and migrate the database if necessary.

          $ ./nodebb upgrade
          Note: ./nodebb upgrade is only available after v0.3.0. If you are running an earlier version, run these instead:

          npm install
          ls -d node_modules/nodebb* | xargs -n1 basename | xargs npm update
          node app --upgrade
          5. Start up NodeBB & Test!
          You should now be running the latest version of NodeBB.

          1 条回复 最后回复 回复 引用 0
          • I
            ice-melt @ice-melt 最后由 编辑

            @ice-melt

            另外还有论坛网页经常显示连接已断开的问题,
            解决方法:
            将 nodebb论坛的config.json中的 url 修改的和 nginx 的一致
            example:

            cat /etc/nginx/sites-enabled/nodebb
            ...
            server_name an.forum.genostack.com;
            ...
            
            cat /path/to/nodebb/config.json
            ...
            "url": "http://an.forum.genostack.com",
            ...
            
            1 条回复 最后回复 回复 引用 0
            • First post
              Last post
            Powered by 暗能星系