ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Installing Rocket.Chat on CentOS 7

    IT Discussion
    rocketchat instant messaging centos 7 centos rhel 7 linux linux server ntg lab scale scale hc3
    11
    30
    12.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by scottalanmiller

      Rocket.Chat can be a little tricky to install and it took some work to find a solid procedure. This installation is for CentOS 7 or RHEL 7 Linux and uses a locally installed MongoDB 3.2 database server but can easily be modified for a remote one, I tested with both. Rather than make a series of steps as this installation is a little weird, I just opted for a full install script. Copy the entire text to a file on your CentOS 7 box and run. It will set up the necessary repos, grab the latest stable MongoDB and Rocket.Chat installs, handle Node and NPM versioning, SELinux gets configured (and left on!!), get things installed, set necessary environmental variables for the future and fire up your new server. Even the firewall gets installed and configured. Run it and when you are done you should be able to log in from another machine's web browser right away and start using it!

      Install Time: 1 minute

      First we need a CentOS 7 Minimum install. I'm on a Scale HC3 cluster and so have a template that I set up that has just the basics for me. I replicate what is needed in the script, however, so a full basic install is all that you need.

      clone VM for rocket chat install

      #!/bin/bash
      
      cat > /etc/yum.repos.d/mongodb-org-3.2.repo <<EOF
      [mongodb-org-3.2]
      name=MongoDB Repository
      baseurl=https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/stable/x86_64/
      gpgcheck=0
      enabled=1
      EOF
      
      yum install -y epel-release firewalld
      yum install -y mongodb-org policycoreutils-python-2.2.5-20.el7.x86_64 nodejs
      semanage port -a -t mongod_port_t -p tcp 27017
      systemctl start mongod
      systemctl enable mongod
      firewall-cmd --zone=public --add-port=80/tcp --permanent
      firewall-cmd --reload
      yum -y install GraphicsMagick
      curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
      source ~/.bash_profile
      nvm install v0.10.40
      cd /opt
      curl -L https://rocket.chat/releases/latest/download -o rocket.chat.tgz
      tar zxvf rocket.chat.tgz
      mv bundle Rocket.Chat
      cd Rocket.Chat/programs/server
      npm install inherits
      npm install
      cd ../..
      npm install forever
      echo "export ROOT_URL=http://rocket.lab.ntg.co/" >> ~/.bashrc
      echo "export MONGO_URL=mongodb://localhost:27017/rocketchat" >> ~/.bashrc
      echo "export PORT=80" >> ~/.bashrc
      source ~/.bashrc
      /opt/Rocket.Chat/node_modules/forever/bin/forever start /opt/Rocket.Chat/main.js
      

      That's it. Builds itself and starts itself. One script, so far it is working each time.

      rocket chat working, yay

      1 Reply Last reply Reply Quote 7
      • scottalanmillerS
        scottalanmiller
        last edited by

        In case that wasn't obvious, that's not a line by line install. Just copy/paste that into a text fie and run it as root. That's it.

        1 Reply Last reply Reply Quote 1
        • scottalanmillerS
          scottalanmiller
          last edited by

          You can add this line to cron or run manually to start up the process whenever you need it...

          /opt/Rocket.Chat/node_modules/forever/bin/forever start /opt/Rocket.Chat/main.js
          
          1 Reply Last reply Reply Quote 1
          • scottalanmillerS
            scottalanmiller
            last edited by

            If you want to use an external MongoDB instance, which would not be very common, you can use my MongoDB installer guide from earlier today. That will get you enough to get started. Then just modify these lines as needed:

            echo "export ROOT_URL=http://rocket.lab.ntg.co/" >> ~/.bashrc
            echo "export MONGO_URL=mongodb://localhost:27017/rocketchat" >> ~/.bashrc
            echo "export PORT=80" >> ~/.bashrc
            

            The top line, obviously, is the URL of your install. Make that whatever you are going to use.

            The second line is the database connection information. If using an external MongoDB instance, replace localhost with the hostname or IP address of your database server. /rocketchat is the name of the database instance, no need to create this manually.

            The last line is the port that the web server is on. By default Rocket.Chat is on 3000 and does not need to be run as root, but that assumes that you will be putting a proxy in front of it right away. You can do that just as easily with port 80. We did this to get a working instance up in a single shot. Changing to non-root use is simple enough.

            1 Reply Last reply Reply Quote 1
            • A
              Alex Sage
              last edited by Alex Sage

              GitHub Script Link?

              scottalanmillerS 1 Reply Last reply Reply Quote 0
              • scottalanmillerS
                scottalanmiller @Alex Sage
                last edited by

                @anonymous said:

                GitHub Script Link?

                https://github.com/scottalanmiller/rocketchatbuilder/blob/master/install_rocketchat

                1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller
                  last edited by

                  Should be able to curl that directly into BASH as root and automagically you have a one line installer 🙂

                  1 Reply Last reply Reply Quote 0
                  • A
                    Alex Sage
                    last edited by Alex Sage

                    Is there anyway to make the URL more conformed?

                    For example: https://github.com/scottalanmiller/rocketchat

                    I would like a easy to remember URL

                    So https://github.com/scottalanmiller/<appname>

                    I know nothing about GitHub, so maybe it is not possible.

                    1 Reply Last reply Reply Quote 0
                    • A
                      Alex Sage
                      last edited by

                      Or maybe you create one "master" script that lets us select a app to install 🙂

                      scottalanmillerS 1 Reply Last reply Reply Quote 1
                      • scottalanmillerS
                        scottalanmiller @Alex Sage
                        last edited by

                        @anonymous said:

                        Or maybe you create one "master" script that lets us select a app to install 🙂

                        LOL, actually that would not be all that hard. Then just that one script would need to detect your OS (CentOS, Ubuntu, etc.) and then pull the right script to install from that. That would actually work.

                        A 1 Reply Last reply Reply Quote 0
                        • A
                          Alex Sage @scottalanmiller
                          last edited by Alex Sage

                          @scottalanmiller One script to rule them all! evil laugh

                          1 Reply Last reply Reply Quote 1
                          • Reid CooperR
                            Reid Cooper
                            last edited by

                            One script to BIND them.

                            bbigfordB 1 Reply Last reply Reply Quote 2
                            • A
                              Alex Sage
                              last edited by

                              @scottalanmiller Why not add one question at the very beginning, and ask for the URL? That's the only input needed.

                              1 Reply Last reply Reply Quote 0
                              • IRJI
                                IRJ
                                last edited by

                                woohoo

                                scottalanmillerS 1 Reply Last reply Reply Quote 0
                                • scottalanmillerS
                                  scottalanmiller @IRJ
                                  last edited by

                                  @IRJ said:

                                  woohoo

                                  Yeah, this was a nice victory.

                                  1 Reply Last reply Reply Quote 0
                                  • bbigfordB
                                    bbigford @Reid Cooper
                                    last edited by

                                    @Reid-Cooper said:

                                    One script to BIND them.

                                    I see what you did there. It's very clever.

                                    1 Reply Last reply Reply Quote 0
                                    • gabriel.engelG
                                      gabriel.engel
                                      last edited by

                                      This is awesome! You'd you like to collaborate with our documentations effort? 🙂

                                      scottalanmillerS 1 Reply Last reply Reply Quote 2
                                      • scottalanmillerS
                                        scottalanmiller @gabriel.engel
                                        last edited by

                                        @gabriel.engel said:

                                        This is awesome! You'd you like to collaborate with our documentations effort? 🙂

                                        You bet, glad to help. Let me know what is needed.

                                        1 Reply Last reply Reply Quote 1
                                        • JoyJ
                                          Joy
                                          last edited by

                                          I tried to installed Rocket.Chat few days ago. Gotta check it today

                                          1 Reply Last reply Reply Quote 0
                                          • JoyJ
                                            Joy
                                            last edited by

                                            @scottalanmiller i got this error :

                                            npm install inherits
                                            npm WARN package.json [email protected] No description
                                            npm WARN package.json [email protected] No repository field.
                                            npm WARN package.json [email protected] No README data
                                            [email protected] node_modules/inherits

                                            npm install
                                            npm WARN package.json [email protected] No description
                                            npm WARN package.json [email protected] No repository field.
                                            npm WARN package.json [email protected] No README data

                                            npm install forevernpm WARN optional dep failed, continuing [email protected]
                                            [email protected] node_modules/forever

                                            T 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post