apt install coturn
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libintl-perl libintl-xs-perl libmodule-find-perl libmodule-scandeps-perl libproc-processtable-perl libsort-naturally-perl
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
libhiredis0.14
Suggested packages:
sip-router xmpp-server
The following NEW packages will be installed:
coturn libhiredis0.14
0 upgraded, 2 newly installed, 0 to remove and 56 not upgraded.
Need to get 402 kB of archives.
After this operation, 1644 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ap-east-1.ec2.archive.ubuntu.com/ubuntu jammy/universe amd64 libhiredis0.14 amd64 0.14.1-2 [32.8 kB]
Get:2 http://ap-east-1.ec2.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 coturn amd64 4.5.2-3.1~ubuntu22.04.1 [369 kB]
Fetched 402 kB in 1s (549 kB/s)
Selecting previously unselected package libhiredis0.14:amd64.
(Reading database ... 84187 files and directories currently installed.)
Preparing to unpack .../libhiredis0.14_0.14.1-2_amd64.deb ...
Unpacking libhiredis0.14:amd64 (0.14.1-2) ...
Selecting previously unselected package coturn.
Preparing to unpack .../coturn_4.5.2-3.1~ubuntu22.04.1_amd64.deb ...
Unpacking coturn (4.5.2-3.1~ubuntu22.04.1) ...
Setting up libhiredis0.14:amd64 (0.14.1-2) ...
Setting up coturn (4.5.2-3.1~ubuntu22.04.1) ...
Adding group `turnserver' (GID 122) ...
Done.
Adding system user `turnserver' (UID 115) ...
Adding new user `turnserver' (UID 115) with group `turnserver' ...
Not creating home directory `/'.
I: Creating /var/lib/turn/turndb from /usr/share/coturn/schema.sql
Created symlink /etc/systemd/system/multi-user.target.wants/coturn.service → /lib/systemd/system/coturn.service.
Processing triggers for ufw (0.36.1-4ubuntu0.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.8) ...
安装完成后会自动设置为开机启动和系统服务,系统服务命令如下:
systemctl start coturn
systemctl stop coturn
systemctl status coturn
systemctl status coturn
# 这是“systemctl status coturn”输出的状态,我们可以看到已经启动了,用的配置文件是:/etc/turnserver.conf
● coturn.service - coTURN STUN/TURN Server
Loaded: loaded (/lib/systemd/system/coturn.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2024-10-02 08:03:02 UTC; 4min 7s ago
Docs: man:coturn(1)
man:turnadmin(1)
man:turnserver(1)
Main PID: 51798 (turnserver)
Tasks: 7 (limit: 9355)
Memory: 7.3M
CPU: 153ms
CGroup: /system.slice/coturn.service
└─51798 /usr/bin/turnserver -c /etc/turnserver.conf --pidfile=
Oct 02 08:03:02 ip-172-31-9-121 turnserver [51798]: 0: : IO method (general relay thread): epoll (with changelist)
Oct 02 08:03:02 ip-172-31-9-121 turnserver [51798]: 0: : turn server id=0 created
Oct 02 08:03:02 ip-172-31-9-121 turnserver [51798]: 0: : IO method (general relay thread): epoll (with changelist)
Oct 02 08:03:02 ip-172-31-9-121 turnserver [51798]: 0: : turn server id=1 created
Oct 02 08:03:02 ip-172-31-9-121 turnserver [51798]: 0: : Total General servers: 2
Oct 02 08:03:02 ip-172-31-9-121 turnserver [51798]: 0: : IO method (auth thread): epoll (with changelist)
Oct 02 08:03:02 ip-172-31-9-121 turnserver [51798]: 0: : IO method (auth thread): epoll (with changelist)
Oct 02 08:03:02 ip-172-31-9-121 turnserver [51798]: 0: : IO method (admin thread): epoll (with changelist)
Oct 02 08:03:02 ip-172-31-9-121 turnserver [51798]: 0: : SQLite DB connection success: /var/lib/turn/turndb
Oct 02 08:03:02 ip-172-31-9-121 systemd [1]: Started coTURN STUN/TURN Server.