Bii o ṣe le Fi Jẹ ki Iwiregbe wa lori CentOS ati Awọn Ẹrọ Ibẹrẹ Debian


Jẹ ki Iwiregbe jẹ orisun ọfẹ ati ṣiṣi, ohun elo iwiregbe ti ara ẹni ti a ṣe apẹrẹ fun awọn ẹgbẹ kekere to jo. O jẹ ọlọrọ ẹya-ara; ti a kọ nipa lilo Node.js ati pe o lo MongoDB lati tọju data ohun elo naa.

  • Ṣe atilẹyin awọn ifiranṣẹ itẹramọṣẹ
  • Ṣe atilẹyin awọn yara lọpọlọpọ
  • Ṣe atilẹyin agbegbe/Kerberos/Ijẹrisi LDAP
  • Wa pẹlu API isinmi-bii
  • Ṣe atilẹyin awọn ikọkọ ati awọn yara idaabobo ọrọigbaniwọle
  • Nfun atilẹyin fun awọn titaniji/awọn iwifunni ifiranṣẹ tuntun
  • Tun ṣe atilẹyin awọn ifọkasi (hey @ tecmint/@ gbogbo)
  • Pese atilẹyin fun awọn ifibọ aworan/Wiwa Giphy
  • Faye gba fun sisẹ koodu
  • Awọn atilẹyin fun awọn ikojọpọ faili (ni agbegbe tabi lati Amazon S3 tabi Azure)
  • Tun ṣe atilẹyin iwiregbe iwiregbe pupọ-olumulo XMPP (MUC) ati iwiregbe 1-si-1 laarin awọn olumulo XMPP ati ọpọlọpọ diẹ sii.

Ni pataki, o ti pinnu lati jẹ irọrun irọrun lori eyikeyi eto ti o ba gbogbo awọn ibeere wọnyi tẹle.

  • Node.js (0.11+)
  • MongoDB (2.6+)
  • Python (2.7.x)

Ninu àpilẹkọ yii, a yoo ṣalaye bi o ṣe le fi sori ẹrọ ati lilo ohun elo fifiranṣẹ Jẹ ki a Wiregbe fun awọn ẹgbẹ kekere lori awọn ọna orisun CentOS ati Debian.

Igbesẹ 1: Ṣe imudojuiwọn Eto naa

1. Akọkọ rii daju lati ṣe imudojuiwọn eto-jakejado nipa fifi awọn idii to wulo bi atẹle.

-------------- On CentOS/RHEL/Fedora -------------- 
$ sudo yum update && sudo yum upgrade

-------------- On Debian/Ubuntu -------------- 
$ sudo apt-get update && sudo apt-get -y upgrade
$ sudo apt-get install software-properties-common git build-essential

2. Lẹhin ti pari imudojuiwọn eto, atunbere olupin (Iyan).

$ sudo reboot

Igbesẹ 2: Fifi Node.js sii

3. Fi ẹya ti o ṣẹṣẹ julọ ti NodeJS sii (ie ẹya 7.x ni akoko kikọ) nipa lilo ibi ipamọ nodesource bi o ti han.

-------------- On CentOS/RHEL/Fedora --------------
$ curl -sL https://rpm.nodesource.com/setup_7.x | sudo -E bash - 
$ sudo yum install nodejs

-------------- On Debian/Ubuntu -------------- 
$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
$ sudo apt install nodejs 

Igbesẹ 3: Fifi Server MongoDB sii

4. Nigbamii ti o nilo lati fi sori ẹrọ ẹya agbegbe MongoDB, sibẹsibẹ, ko si ni ibi ipamọ YUM. Nitorinaa o ni lati mu ibi ipamọ MongoDB ṣiṣẹ bi a ti salaye ni isalẹ.

$ cat <<EOF | sudo tee -a /etc/yum.repos.d/mongodb-org-3.4.repo
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
EOF

Bayi fi sori ẹrọ ati bẹrẹ ẹya tuntun ti MongoDB Server (ie 3.4).

$ sudo yum install mongodb-org
$ sudo systemctl start mongod.service
$ sudo systemctl enable mongod.service
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
$ echo 'deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
$ sudo apt-get update
$ sudo apt-get install -y mongodb-org
$ sudo systemctl start mongod.service
$ sudo systemctl enable mongod.service

Igbese 4: Fi sori ẹrọ Jẹ ki a Wiregbe Server

5. Ni akọkọ fi git sori ẹrọ lati ẹda oniye ibi ipamọ Jẹ ki a Wiregbe ati fi awọn igbẹkẹle sii bi o ti han.

$ sudo yum install git		##RHEL/CentOS
$ sudo apt install git		##Debian/Ubuntu

$ cd /srv
$ sudo git clone https://github.com/sdelements/lets-chat.git 
$ cd lets-chat
$ sudo npm install

Akiyesi: Awọn ifihan agbara Ikilọ npm lati iṣẹjade ti o wa loke jẹ deede lakoko fifi sori ẹrọ. O kan foju wọn.

6. Lẹhin ipari fifi sori ẹrọ, ṣẹda faili iṣeto ohun elo (/srv/lets-chat/settings.yml) lati faili apẹẹrẹ ki o ṣalaye awọn eto aṣa rẹ ninu rẹ:

$ sudo cp settings.yml.sample settings.yml

A yoo lo awọn eto aiyipada ti a pese lati faili awọn eto apẹẹrẹ.

7. Lakotan bẹrẹ olupin Jẹ ki a iwiregbe.

$ npm start 

Lati tọju Jẹ ki Awo daemon ṣiṣẹ, jẹ ki a tẹ Ctrl-C lati jade ati lẹhinna ṣẹda faili ẹyọkan Systemd lati jẹ ki o ṣiṣẹ ni bata eto.

Igbesẹ 5: Ṣẹda Jẹ ki Faili Ibẹrẹ iwiregbe

8. Ṣẹda faili eto eto fun Jẹ ki a iwiregbe.

$ sudo vi /etc/systemd/system/letschat.service

Daakọ ki o lẹẹmọ iṣeto kuro ni isalẹ faili naa.

[Unit]
Description=Let's Chat Server
Wants=mongodb.service
After=network.target mongodb.service

[Service]
Type=simple
WorkingDirectory=/srv/lets-chat
ExecStart=/usr/bin/npm start
User=root
Group=root
Restart=always
RestartSec=9

[Install]
WantedBy=multi-user.target

9. Bayi bẹrẹ iṣẹ fun akoko tumosi ati mu ki o bẹrẹ laifọwọyi lori bata eto.

$ sudo systemctl start letschat
$ sudo systemctl enable letschat
$ sudo systemctl status letschat

Igbesẹ 6: Wiwọle Jẹ ki a Wiregbe Intanẹẹti Wẹẹbu

10. Ni kete ti ohun gbogbo wa ni aye, o le wọle si Jẹ ki a Wiregbe oju-iwe wẹẹbu ni URL atẹle.

https://SERVER_IP:5000
OR
https://localhost:5000

11. Tẹ lori\"Mo nilo akọọlẹ kan" lati ṣẹda ọkan ati fọwọsi alaye ti o nilo ki o tẹ\"Forukọsilẹ".

O le tun fẹran atẹle awọn nkan ti o jọmọ:

  1. Awọn Aṣẹ Wulo lati Ṣẹda Server Wiregbe Server ni Linux
  2. Ṣẹda Fifiranṣẹ Ẹsẹ Ti ara Rẹ/Server Iwiregbe Lilo\"Openfire" ni Lainos

Jẹ ki a gbe ibi ipamọ Github Chat: https://github.com/sdelements/lets-chat

Gbadun! O ni bayi Jẹ ki A fi ohun elo iwiregbe sori ẹrọ rẹ. Lati pin eyikeyi awọn ero pẹlu wa, lo fọọmu esi ni isalẹ.