FreeSWITCH 1.10 installation guide from source on debian 11 - Omid-Mohajerani/freeswitch GitHub Wiki

Get a token from SignalWire website

In order to be able to download the FreeSWITCH package, you need to register at https://signalwire.com/ and go to profile

and select personal access tokens and create a new token or use the current one.

Download and compile FreeSWITCH source code

TOKEN=pat_7ktLy6Yymytokenhere23232


apt-get update && apt-get install -yq gnupg2 wget lsb-release
wget --http-user=signalwire --http-password=$TOKEN -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg https://freeswitch.signalwire.com/repo/deb/debian-release/signalwire-freeswitch-repo.gpg
echo "machine freeswitch.signalwire.com login signalwire password $TOKEN" > /etc/apt/auth.conf
echo "deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" > /etc/apt/sources.list.d/freeswitch.list
echo "deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" >> /etc/apt/sources.list.d/freeswitch.list
apt-get -y update
apt-get -y build-dep freeswitch
cd /usr/src
git clone https://github.com/signalwire/freeswitch.git -bv1.10 freeswitch
cd freeswitch
git config pull.rebase true
./bootstrap.sh -j
./configure
make
make install
make cd-sounds-install cd-moh-install

Post-installation

Set Owner and Permissions

cd /usr/local
groupadd freeswitch
adduser --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH open source softswitch" --ingroup freeswitch freeswitch --disabled-password
chown -R freeswitch:freeswitch /usr/local/freeswitch/
chmod -R ug=rwX,o= /usr/local/freeswitch/
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*

configure systemd

systemd is the service management system that replaces System V init. It is quite thorough and requires much simpler configuration scripts called Unit Files. systemd can start FreeSWITCH™ at boot time, monitor the application, restart it if it fails, and take other useful actions.

vim /etc/systemd/system/freeswitch.service

[Service]
; service
Type=forking
PIDFile=/usr/local/freeswitch/run/freeswitch.pid
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /usr/local/freeswitch/run
ExecStartPre=/bin/chown freeswitch:daemon /usr/local/freeswitch/run
ExecStart=/usr/local/freeswitch/bin/freeswitch -ncwait -nonat
TimeoutSec=45s
Restart=always
; exec
WorkingDirectory=/usr/local/freeswitch/run
User=freeswitch
Group=daemon
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
;LimitSTACK=240
LimitRTPRIO=infinity
LimitRTTIME=7000000
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007

[Install]
WantedBy=multi-user.target

enable and start freeswitch service

systemctl daemon-reload
systemctl start freeswitch
systemctl enable freeswitch

check if it is running

ps aux | grep freeswitch

Set fs_cli bash profile

vim ~/.bash_profile

PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/local/freeswitch/bin
export PATH
unset USername

DNS cashing

By default, Debian has no DNS caching and every lookup goes to the server from /etc/resolv.conf. Unbound is a light, secure, and easy to use DNS caching server.

apt -y install unbound
systemctl start unbound
systemctl enable unbound

Proper entropy source

Most Debian systems may not have sufficient entropy for proper cryptography operations. Haveged is a userspace entropy daemon that is not dependent upon the standard mechanisms for harvesting randomness for the system entropy pool.

apt -y install haveged
systemctl start haveged
systemctl enable haveged

Automatic time synchronization

Chrony is a fast, secure, and easy-to-use time synchronization daemon.

apt -y install chrony   # installation
systemctl start chrony  # start
systemctl enable chrony # auto start

References:

FreeSWITCH installation Video Training - Part 1

FreeSWITCH Installation - Part 1