加载中...

Ubuntu20.04.5上使用命令安装RocketChat


安装相关依赖


安装相关依赖

sudo apt-get update
sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler
sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget curl swig rsync
sudo apt install -y ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils \
rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev

更新Ubuntu


我们的第一步,更新我们的 Ubuntu:

sudo apt-get update

添加 MongoDB GPG 密钥


接下来是添加 MongoDB GPG 密钥:

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -

添加 MongoDB 存储库


我们将添加 MongoDB 存储库

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

更新 repos 列表,配置 Node 并安装 curl


接下来是更新 repos 列表,配置 Node 并安装 curl:

sudo apt update && sudo apt-get install -y curl && curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -

安装 MongoDB 和其他要求


我们将安装 MongoDB 和其他要求:

sudo apt install -y build-essential mongodb-org nodejs graphicsmagick

检查安装的Node版本


检查安装的Node版本:

node --version

安装继承 yn


让我们安装继承 yn:

sudo npm install -g inherits n

创建符号链接


为节点创建符号链接:

sudo ln -s /usr/bin/node /usr/local/bin/node

下载RocketChat


下面是下载RocketChat,大约160Mb:

sudo su
curl -L https://cdn-download.rocket.chat/build/rocket.chat-4.6.3.tgz -o /tmp/rocket.chat.tgz

解压RocketChat


我们将RocketChat解压到tmp目录下:

tar -xzf /tmp/rocket.chat.tgz -C /tmp

安装RocketChat


是时候安装RocketChat了:

cd /tmp/bundle/programs/server && sudo npm install

移动目录:

cd
sudo mv /tmp/bundle /opt/Rocket.Chat
exit

添加RocketChat用户到系统并分配权限


添加RocketChat用户到系统并分配权限:

sudo useradd -M rocketchat && sudo usermod -L rocketchat
sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat

创建RocketChat启动服务


我们要创建RocketChat启动服务,在终端中完整或逐行粘贴以下代码:

cat << EOF |sudo tee -a /etc/systemd/system/rocketchat.service
[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service
[Service]
ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 ROOT_URL=http://localhost:3000/ PORT=3000
[Install]
WantedBy=multi-user.target
EOF

配置MongoDB并启动


配置MongoDB并启动它:

sudo sed -i "s/^replication:/replication:\n  replSetName: rs01/" /etc/mongod.conf
sudo systemctl daemon-reload
sudo systemctl enable mongod && sudo systemctl restart mongod

检查MongoDB状态


检查MongoDB状态:

systemctl status mongod

让我们检查:

mongo --eval "printjson(rs.initiate())"

设置开机自启RocketChat


开机启动RocketChat并马上运行它:

sudo systemctl enable rocketchat && sudo systemctl start rocketchat

检查RocketChat的运行状态


检查RocketChat的运行状态:

systemctl status rocketchat

安装完成


至此我们已经安装完成RocketChat了,如果你不打算使用Nginx作为反向代理,那么你可以通过ip和端口来访问 http://127.0.0.1:3000


文章作者: Vinjess
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Vinjess !
评论
  目录