본문 바로가기

Operating Systems/Linux

[ Linux ] Rocket.Chat 설치

1. CentOS8

# 도커에서 설치할 경우
# docker run --privileged --cap-add=SYS_TIME -d -it -p 3000:3000 --name Rocket.Chat centos:8 init
# docker exec -it Rocket.Chat /bin/bash

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*

yum -y install epel-release

yum -y install python2 make gcc-c++

yum install -y GraphicsMagick

cat <<'MONGO_REPO' > /etc/yum.repos.d/mongodb-org-6.0.repo
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
MONGO_REPO

yum install -y mongodb-org

systemctl daemon-reload

systemctl start mongod

systemctl enable mongod

mkdir -p /app/install /app/tmp/Rocket.Chat /app/server

curl -L https://releases.rocket.chat/6.8.0/download -o /app/install/rocket.chat.tgz

tar xvfz /app/install/rocket.chat.tgz -C /app/tmp/rocket.chat --strip-components=1

chmod -R o+w /app/tmp/Rocket.Chat

adduser rocket

su - rocket

# nvm 설치
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

cat <<'ROCKET_SETTING' > /home/rocket/.bash_profile
# nvm 환경변수 설정 1
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"

# nvm 환경변수 설정 2
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
ROCKET_SETTING

# nvm --version
source /home/rocket/.bash_profile

# node --version
nvm install 14.21.3

# 실패하면 재시도
cd /app/tmp/Rocket.Chat/programs/server && npm install

exit

mv /app/tmp/Rocket.Chat /app/server

chown -R rocket:rocket /app/server/Rocket.Chat

cat <<ROCKET_SERVICE_SETTING > /lib/systemd/system/Rocket.Chat.service
[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service
[Service]
ExecStart=/home/rocket/.nvm/versions/node/v14.21.3/bin/node /app/server/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocket
User=rocket
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat MONGO_OPLOG_URL=mongodb://localhost:27017 ROOT_URL=http://localhost:3000 PORT=3000
[Install]
WantedBy=multi-user.target
ROCKET_SERVICE_SETTING

systemctl daemon-reload

systemctl start Rocket.Chat

systemctl enable Rocket.Chat

journalctl -u Rocket.Chat.service

 

# 참조사이트

https://docs.rocket.chat/deploy/deploy-rocket.chat/additional-deployment-methods/deploy-with-centos

'Operating Systems > Linux' 카테고리의 다른 글

[ Linux ] 자주 사용하는 리눅스 명령어  (1) 2024.10.16
[ Linux ] Nexus NPM 저장소 관리  (0) 2024.05.31
[ Linux ] OpenSSL 설치  (0) 2024.05.22
[ Linux ] MongoDB 설치  (0) 2024.05.22
[ Linux ] PIP 설치  (0) 2024.04.05