Skip to content

Commit 672bf89

Browse files
committed
further improve turnserver install script
1 parent 098740f commit 672bf89

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

turnserver_install.sh.sample

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,14 @@ install_coturn() {
9797
apt-get update
9898
apt-get install coturn curl dnsutils -y
9999

100-
# Configure system limits
101-
echo "fs.file-max = 65535" >> /etc/sysctl.conf
102-
sysctl -p
103-
ulimit -n 65535
100+
# Configure system limits
101+
echo "fs.file-max = 65535" >> /etc/sysctl.conf
102+
sudo sysctl -p
103+
# Add permanent ulimit settings
104+
echo "* soft nofile 65535" >> /etc/security/limits.conf
105+
echo "* hard nofile 65535" >> /etc/security/limits.conf
106+
echo "root soft nofile 65535" >> /etc/security/limits.conf
107+
echo "root hard nofile 65535" >> /etc/security/limits.conf
104108

105109
# Enable TURN server
106110
echo "TURNSERVER_ENABLED=1" > /etc/default/coturn
@@ -141,6 +145,17 @@ EOL
141145
systemctl start coturn
142146
}
143147

148+
# Swap setup
149+
if [ -f /swapfile ]; then
150+
sudo swapoff -a
151+
sudo rm /swapfile
152+
fi
153+
sudo fallocate -l 16G /swapfile
154+
sudo chmod 600 /swapfile
155+
sudo mkswap /swapfile
156+
sudo swapon /swapfile
157+
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
158+
144159
# Main script execution
145160
echo "TURN Server Installation and Configuration"
146161
echo "----------------------------------------"

0 commit comments

Comments
 (0)