Installing Rocket.Chat on CentOS 7
-
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.
#!/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.
-
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.
-
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
-
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.
-
GitHub Script Link?
-
@anonymous said:
GitHub Script Link?
https://github.com/scottalanmiller/rocketchatbuilder/blob/master/install_rocketchat
-
Should be able to curl that directly into BASH as root and automagically you have a one line installer
-
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.
-
Or maybe you create one "master" script that lets us select a app to install
-
@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.
-
@scottalanmiller One script to rule them all! evil laugh
-
One script to BIND them.
-
@scottalanmiller Why not add one question at the very beginning, and ask for the URL? That's the only input needed.
-
woohoo
-
-
-
This is awesome! You'd you like to collaborate with our documentations effort?
-
@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.
-
I tried to installed Rocket.Chat few days ago. Gotta check it today
-
@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/inheritsnpm 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 datanpm install forevernpm WARN optional dep failed, continuing [email protected]
[email protected] node_modules/forever