Kurento local loopback deployment test

Reference document : Kurento

Installing Kurento Server
Local Installation
Using this method, you will install Kurento Media Server from the local Ubuntu package repository provided by the Kurento project. KMS has explicit support for two long-term support (LTS) versions of Ubuntu: Ubuntu 16.04 (Xenial) and Ubuntu 18.04 (Bionic) (64-bit only).
To uninstall the old version of Kurento, you can issue the following command:

sudo aptitude remove kurento-media-server

It is recommended to use aptitude to uninstall the package because it has a better removal algorithm and actually does remove all dependencies installed by Kurento. apt-get does not.
Open a terminal and follow these steps:

Make sure GnuPG is installed

sudo apt-get update && sudo apt-get install --no-install-recommends --yes \
    gnupg

Define which version of Ubuntu is installed in the system.

Run only one of the following lines:

DISTRO="xenial"  # KMS for Ubuntu 16.04 (Xenial)
DISTRO="bionic"  # KMS for Ubuntu 18.04 (Bionic)

Add the Kurento repository to your system configuration.

Run the following three commands in the same terminal used in the previous step :

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5AFA7A83
source /etc/upstream-release/lsb-release 2>/dev/null || source /etc/lsb-release
sudo tee "/etc/apt/sources.list.d/kurento.list" >/dev/null <<EOF
# Kurento Media Server - Release packages
deb [arch=amd64] http://ubuntu.openvidu.io/6.13.0 $DISTRO kms6
EOF

Install KMS:

sudo apt-get update && sudo apt-get install --no-install-recommends --yes kurento-media-server

The server contains service files integrated with the Ubuntu initialization system, so you can use the following commands to start and stop it:

sudo service kurento-media-server start
sudo service kurento-media-server stop

View kurento-media-server service status

sudo service kurento-media-server status

Just run like this

 kurento-media-server.service - LSB: Kurento Media Server daemon
   Loaded: loaded (/etc/init.d/kurento-media-server; generated)
   Active: active (running) since Wed 2020-04-29 12:25:08 CST; 5h 16min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 27688 ExecStart=/etc/init.d/kurento-media-server start (code=exited, 
    Tasks: 39 (limit: 4419)
   CGroup: /system.slice/kurento-media-server.service
           └─27698 /usr/bin/kurento-media-server

4月 29 12:25:07 hrb systemd[1]: Starting LSB: Kurento Media Server daemon...
4月 29 12:25:07 hrb kurento-media-server[27688]:  * Start Kurento Media Server
4月 29 12:25:07 hrb kurento-media-server[27688]:  * Configure Kernel resource li
4月 29 12:25:08 hrb kurento-media-server[27688]:    ...done.
4月 29 12:25:08 hrb systemd[1]: Started LSB: Kurento Media Server daemon.

Check the installation
To verify that the Kurento process is up and running, use the following command and look for the kurento-media-server process:

ps -fC kurento-media-server

Output:

UID        PID  PPID  C STIME TTY          TIME CMD
kurento   7688     1  0 13:36 ?        00:00:00 /usr/bin/kurento-media-server

Use this command to verify that this port is open and listening for incoming packets :

sudo netstat -tupln | grep -e kurento -e 8888

Output:

tcp6  0  0  :::8888  :::*  LISTEN  7688/kurento-media-

Finally, check whether Kurento's RPC WebSocket is normal, and can receive and process messages. To do this, send a dummy request and check if the response is as expected :

curl -i -N \
    -H "Connection: Upgrade" \
    -H "Upgrade: websocket" \
    -H "Host: 127.0.0.1:8888" \
    -H "Origin: 127.0.0.1" \
    http://127.0.0.1:8888/kurento

You should get a response similar to the following:

HTTP/1.1 500 Internal Server Error
Server: WebSocket++/0.7.0

Ignore the error line: This is an expected error because curl does not use the Kurento protocol. We just checked whether the WebSocket++ server is actually started and is listening for connections.

I use the JavaScript-side implementation (install what is missing)
to install Node.js, Bower and Web server in the system:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g bower
sudo npm install -g http-server

The source code for this demo is required. Clone it from GitHub, then start the web server :

The official documentation states that I switched to the 6.13.0 branch, and I cloned it and did not have this branch, so I directly operated on the master branch,
which means that git checkout 6.13.0this sentence is not needed .

git clone https://github.com/Kurento/kurento-tutorial-js.git
cd kurento-tutorial-js/kurento-hello-world
git checkout 6.13.0
bower install
http-server -p 8443 --ssl --cert keys/server.crt --key keys/server.key

At this time, when you use a browser to access https://localhost:8443, you will find that the console reports an error, and wss cannot connect. This is because of problems related to the local certificate.

ctrl+c close the current webserver

Open index.js under js under kurento-hello-world to
modify this place:

{
    
    
  default:
  {
    
    
    // Non-secure WebSocket (only for localhost tests)
    //ws_uri: 'ws://' + location.hostname + ':8888/kurento',

    // Secure WebSocket (for localhost and remote tests)
    // To use this, you have to enable the "mediaServer.net.websocket.secure"
    // KMS setting in "kurento.conf.json".
    //
    // Also, note that most browsers will reject self-signed certificates for
    // Secure WebSockets connections. You have to either use a proper
    // certificate, or install your self-signed Root CA in the browser. For this
    // last option, we recommend using the tool "mkcert".
     ws_uri: 'wss://' + location.hostname + ':8433/kurento',

    ice_servers: undefined
  }
});

The //ws_uri: 'ws://' + location.hostname + ':8888/kurento',comments untied, will ws_uri: 'wss://' + location.hostname + ':8433/kurento',comment out.
Restart webserver

http-server -p 8443 --ssl --cert keys/server.crt --key keys/server.key

It should be fine at this time
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44784018/article/details/105844874