Last active
April 12, 2024 19:34
-
-
Save linuxoracledev/c685bb47a7cf713a983c391fe4cde1bf to your computer and use it in GitHub Desktop.
How to install and configure rocket chat on ubuntu 18.04 LTS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Step 1: Install MongoDB | |
#import the MongoDB public GPG key | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 | |
#Create the list file - /etc/apt/sources.list.d/mongodb-org-4.0.list | |
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 | |
#Update the local package repository | |
sudo apt update | |
#Install the latest stable version of MongoDB | |
sudo apt install -y mongodb-org | |
# Stop,Start and Enable the service with systemcl. | |
sudo systemctl stop mongod.service | |
sudo systemctl start mongod.service | |
sudo systemctl enable mongod.service | |
#Check if the service has started properly | |
sudo systemctl status mongod | |
#Modify mongod.conf file | |
sudo nano /etc/mongod.conf | |
#Then copy and paste the lines at the end of the file and save.. | |
replication: | |
replSetName: "rs01" | |
# or | |
echo -e "replication:\n replSetName: \"rs01\"" | sudo tee -a /etc/mongod.conf | |
# Restart the service with systemcl | |
sudo systemctl restart mongod | |
#Check if the service has started properly | |
sudo systemctl status mongod | |
#Open MongoDB shell | |
mongo | |
#Initiates a replica set | |
rs.initiate() | |
##Step 2: Install Node.js | |
#Rocket.Chat only support Node.js from the 8.x repository… | |
sudo apt install nodejs npm build-essential curl software-properties-common graphicsmagick | |
sudo npm install -g inherits n && sudo n 8.11.4 | |
##Step 3: Install Rocket.Chat Server | |
sudo useradd -m -U -r -d /opt/rocketchat rocketchat | |
sudo su - rocketchat | |
curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz | |
#Extract the file | |
tar zxvf rocket.chat.tgz | |
#Change bundlw to Rocket.Chat | |
mv bundle Rocket.Chat | |
#Install npm | |
cd /opt/rocketchat/Rocket.Chat/programs/server | |
npm install | |
export ROOT_URL=http://localhost:3000 | |
export MONGO_URL=mongodb://localhost:27017/rocketchat | |
export MONGO_OPLOG_URL=mongodb://localhost:27017/local?replSet=rs01 | |
export PORT=3000 | |
cd /opt/rocketchat/Rocket.Chat/ | |
node main.js | |
exit | |
exit | |
#Create a rocketchat service | |
sudo nano /etc/systemd/system/rocketchat.service | |
#Then copy and paste the lines below into the file and save… | |
[Unit] | |
Description=Rocket.Chat server | |
After=network.target nss-lookup.target mongod.target | |
[Service] | |
StandardOutput=syslog | |
StandardError=syslog | |
SyslogIdentifier=rocketchat | |
User=rocketchat | |
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat MONGO_OPLOG_URL=mongodb://localhost:27017/local?replSet=rs01 ROOT_URL=http://example.com PORT=3000 | |
ExecStart=/usr/local/bin/node /opt/rocketchat/Rocket.Chat/main.js | |
[Install] | |
WantedBy=multi-user.target | |
sudo systemctl daemon-reload | |
sudo systemctl enable rocketchat | |
sudo systemctl start rocketchat | |
sudo systemctl status rocketchat | |
http://localhost:3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment