{"id":5250,"date":"2020-04-26T09:26:00","date_gmt":"2020-04-26T01:26:00","guid":{"rendered":"https:\/\/www.ldhost.cn\/jc\/?p=5250"},"modified":"2020-03-18T08:45:27","modified_gmt":"2020-03-18T00:45:27","slug":"%e5%9c%a8centos-7%e4%b8%8a%e5%ae%89%e8%a3%85rocket-chat","status":"publish","type":"post","link":"https:\/\/www.ldhost.cn\/jc\/ot\/5250.html","title":{"rendered":"\u5728CentOS 7\u4e0a\u5b89\u88c5Rocket.Chat"},"content":{"rendered":"\n<p>\u9884\u5b89\u88c5\u6240\u9700\u7684\u8f6f\u4ef6\u5305<br> \u5b89\u88c5EPEL\u50a8\u5b58\u5e93<br> yum -y install epel-release<br> yum clean all<br> yum -y update<br> \u5b89\u88c5MongoDB<br> cat &lt; \/etc\/yum.repos.d\/mongodb.repo<br> [mongodb]<\/p>\n\n\n\n<p> name=MongoDB Repository<br> baseurl=http:\/\/downloads-distro.mongodb.org\/repo\/redhat\/os\/x86_64\/<br> gpgcheck=0<br> enabled=1<br> EOF<br> yum -y install mongodb-org-server mongodb-org <\/p>\n\n\n\n<p>systemctl enable mongod<br> systemctl start mongod<br> \u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305<br> yum install -y nodejs curl GraphicsMagick npm gcc-c++ nginx<br> Nginx\u8bbe\u7f6e<br> \u804a\u5929\u672c\u8eab\u5728\u56de\u9001\u63a5\u53e3127.0.0.1\u7684\u7aef\u53e33000\u4e0a\u8fd0\u884c\u3002\u6211\u4eec\u5efa\u8bae\u4f7f\u7528nginx\u8bbe\u7f6e\u6346\u7ed1\u8f6f\u4ef6\u3002<\/p>\n\n\n\n<p>\u521b\u5efa\u81ea\u7b7e\u540d\u8bc1\u4e66<br> mkdir \/etc\/nginx\/cert<br> openssl req -x509 -nodes -days 3650 -newkey rsa:4096 \\<br>     -keyout \/etc\/nginx\/cert\/rocket.key -out \/etc\/nginx\/cert\/rocket.crt \\<br>     -subj &#8216;\/C=RU\/ST=Moscow\/L=Moscow\/CN=server.local&#8217;<br> \u4e3b\u8981\u7684Nginx\u914d\u7f6e\u6587\u4ef6<br> cat &lt;&lt; EOF > \/etc\/nginx\/nginx.conf<br> user  nginx;<br> worker_processes  auto;<\/p>\n\n\n\n<p>error_log  \/var\/log\/nginx\/error.log warn;<br>\npid        \/var\/run\/nginx.pid;<\/p>\n\n\n\n<p>events {<br>\n    worker_connections  1024;<br>\n}<\/p>\n\n\n\n<p>http {<br>     include       \/etc\/nginx\/mime.types;<br>     default_type  application\/octet-stream;<\/p>\n\n\n\n<p>log_format  main  &#8216;\\$remote_addr &#8211; \\$remote_user [\\$time_local] &#8220;\\$request&#8221; &#8216;<br>\n                  &#8216;\\$status $body_bytes_sent &#8220;\\$http_referer&#8221; &#8216;<br>\n                  &#8216;&#8221;\\$http_user_agent&#8221; &#8220;\\$http_x_forwarded_for&#8221;&#8216;;<\/p>\n\n\n\n<p>access_log  \/var\/log\/nginx\/access.log  main;<\/p>\n\n\n\n<p>sendfile        on;<\/p>\n\n\n\n<p>tcp_nopush     on;<\/p>\n\n\n\n<p>keepalive_timeout  65;<\/p>\n\n\n\n<p>gzip  on;<\/p>\n\n\n\n<p>include \/etc\/nginx\/conf.d\/rocket.conf;<\/p>\n\n\n\n<p>}<br> EOF<br><a href=\"https:\/\/www.ldhost.cn\/hkserver.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\">\u670d\u52a1\u5668<\/a>\u6587\u4ef6<br><br> cat &lt;&lt; EOF > \/etc\/nginx\/conf.d\/rocket.conf<br> upstream rocketbackend {<br>     server 127.0.0.1:3000;<br> }<\/p>\n\n\n\n<p>server {<br>     listen 80 default;<br>     server_name server.local ;<\/p>\n\n\n\n<p>return 301 https:\/\/$server_name$request_uri;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>server {<br>     listen 443 ssl http2 default;<br>     server_name server.local ;<\/p>\n\n\n\n<p>ssl on;<br>\nssl_certificate \/etc\/nginx\/cert\/rocket.crt;<br>\nssl_certificate_key \/etc\/nginx\/cert\/rocket.key;<br>\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;<\/p>\n\n\n\n<p>location \/ {<br>     proxy_pass http:\/\/rocketbackend\/;<br>     proxy_http_version 1.1;<br>     proxy_set_header Connection &#8220;upgrade&#8221;;<br>     proxy_set_header Upgrade $http_upgrade;<br>     proxy_set_header Host $http_host;<\/p>\n\n\n\n<p>proxy_set_header X-Real-IP $remote_addr;<br>\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>\nproxy_set_header X-Forwarded-Proto http;<br>\nproxy_set_header X-Nginx-Proxy true;<\/p>\n\n\n\n<p>proxy_redirect off;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}<br> EOF<br> \u914d\u7f6eNginx\u5b88\u62a4\u7a0b\u5e8f<br> systemctl enable nginx<br> systemctl start nginx<br> \u5b89\u88c5Rocket.Chat<br> cd \/opt<\/p>\n\n\n\n<p>curl -L https:\/\/releases.rocket.chat\/latest\/download -o rocket.chat.tgz<br>\ntar zxvf rocket.chat.tgz<\/p>\n\n\n\n<p>mv bundle Rocket.Chat<br>\ncd Rocket.Chat\/programs\/server<\/p>\n\n\n\n<p>npm install<\/p>\n\n\n\n<p>cd ..\/..<br> \u9996\u6b21\u63a8\u51faRocket.Chat<br> export ROOT_URL=http:\/\/server.local\/<br> export MONGO_URL=mongodb:\/\/127.0.0.1:27017\/rocketchat<br> export PORT=3000<br> export ADMIN_USERNAME=admin<br> export ADMIN_PASS=PASSWORD<br> export ADMIN_EMAIL=EMAIL<br> \u5176\u4e2d\uff1a<\/p>\n\n\n\n<p>\u5bc6\u7801-\u7ba1\u7406\u5458\u5bc6\u7801<br> EMAIL-\u6709\u6548\u7684\u90ae\u5bc4\u5730\u5740<br> 1\u4e2a<br> node main.js<br> \u5b88\u62a4\u7a0b\u5e8f\u8bbe\u7f6e<br> cat &lt;&lt; EOF > \/usr\/lib\/systemd\/system\/rocketchat.service<br> [Unit]<br> Description=The Rocket.Chat server<br> After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target<\/p>\n\n\n\n<p>[Service]<br>\nExecStart=\/usr\/local\/bin\/node \/opt\/Rocket.Chat\/main.js<br>\nStandardOutput=syslog<br>\nStandardError=syslog<br>\nSyslogIdentifier=rocketchat<br>\nUser=root<br>\nEnvironment=MONGO_URL=mongodb:\/\/127.0.0.1:27017\/rocketchat ROOT_URL=https:\/\/server.local\/ PORT=3000<\/p>\n\n\n\n<p>[Install]<br> WantedBy=multi-user.target<br> EOF<br> \u542f\u52a8Rocket.Chat<br> systemctl enable rocketchat<br> systemctl start rocketchat<br> \u9632\u706b\u5899\u8bbe\u5b9a<br> firewall-offline-cmd &#8211;zone=public &#8211;add-service=http<br> firewall-offline-cmd &#8211;zone=public &#8211;add-service=https<br> firewall-offline-cmd &#8211;zone=public &#8211;add-service=ssh<br> firewall-offline-cmd &#8211;zone=public &#8211;add-port=3000\/tcp<\/p>\n<div><img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/images\/ad-845-3.png\" alt=\"\u56fe\u7247\u63cf\u8ff0\" \/><\/div>","protected":false},"excerpt":{"rendered":"<p>\u9884\u5b89\u88c5\u6240\u9700\u7684\u8f6f\u4ef6\u5305 \u5b89\u88c5EPEL\u50a8\u5b58\u5e93 yum -y install epel-release yum clean all yum -y update \u5b89\u88c5MongoDB cat &lt; \/etc\/yum.repos.d\/mongodb.repo [mongodb] name=MongoDB Repository baseurl=http:\/\/downloads-distro.mongodb.org\/repo\/redhat\/os\/x86_64\/ gpgcheck=0 enabled=1 EOF yum -y install mongodb-org-server mongodb-org sys&#8230; <a href=\"https:\/\/www.ldhost.cn\/jc\/ot\/5250.html\" class=\"readmore\">\u9605\u8bfb\u5168\u6587<span class=\"screen-reader-text\">\u5728CentOS 7\u4e0a\u5b89\u88c5Rocket.Chat<\/span><span class=\"fa fa-angle-double-right\" aria-hidden=\"true\"><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-5250","post","type-post","status-publish","format-standard","hentry","category-ot","content-layout-excerpt-thumb"],"_links":{"self":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/5250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/comments?post=5250"}],"version-history":[{"count":1,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/5250\/revisions"}],"predecessor-version":[{"id":5251,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/5250\/revisions\/5251"}],"wp:attachment":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/media?parent=5250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/categories?post=5250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/tags?post=5250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}