Compile and Install FreeSWITCH 1.8.2 onto Ubuntu 18.4.2 LTS

This closely follows the excellent and very concise instructions at another site: "FreeSWITCH 1.8.2 on Ubuntu 18.4 LTS". I found a few unexpected twists and turns before it was working, so I've put this information together to help others who encounter these or similar issues.

Dependencies

Starting on a freshly installed Ubuntu Server 18.4 (32bit), install these packages:

apt-get install --yes build-essential pkg-config uuid-dev \
zlib1g-dev libjpeg-dev libsqlite3-dev libcurl4-openssl-dev \
libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev \
yasm libopus-dev libsndfile1-dev unzip

Compiling FreeSWITCH

Download the FreeSWITCH sources from here: https://files.freeswitch.org/freeswitch-releases/

Find the latest version, then use wget to pull the file into your /usr/src folder, which is where things like this usually happen:

cd /usr/src
wget https://files.freeswitch.org/freeswitch-releases/freeswitch-1.8.6.zip

When the file completes downloading, expand it, then move into the newly created folder:

unzip freeswitch-1.8.6.zip
cd freeswitch-1.8.6

In the file modules.conf I needed to comment two lines, so I opened it up in an editor:

nano modules.conf

and modified these lines by adding the comment character:

#languages/mod_lua

and

#applications/mod_signalwire

because attempting to compile FreeSWITCH with Lua or SignalWire threw errors. Once these were commented in modules.conf, compilation worked. (If you need to use these modules, there are better guides for you than this one):

./configure && make

If you see errors while compiling, you can either install missing packages or comment out any module that is throwing the error. After you make the change, re-start compilation by including a "make clean" like this:

./configure && make clean && make

After a successful compilation, you'll see a screen like the following:

It's time to install FreeSWITCH. The following command does it. The default location this will install into: /usr/local/freeswitch

sudo make install

Set Owner and Permissions

This summarizes the instructions at: https://freeswitch.org/confluence/display/FREESWITCH/Debian+Post-Install+Tasks

Create user 'freeswitch', add it to group 'freeswitch'. Change owner and group of the freeswitch installation:

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 FreeSWITCH as systemd Service

Place the following configuration in a file at: /etc/systemd/system/freeswitch.service

[Unit]
Description=freeswitch
After=syslog.target network.target local-fs.target
[Service]
; service
Type=forking
PIDFile=/usr/local/freeswitch/run/freeswitch.pid
PermissionsStartOnly=true
; blank ExecStart= line flushes the list
ExecStart=
ExecStart=/usr/local/freeswitch/bin/freeswitch -u freeswitch -g freeswitch -ncwait -nonat -rp
TimeoutSec=45s
Restart=on-failure
; exec
WorkingDirectory=/usr/local/freeswitch/bin
User=root
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

Note that this working systemd file came from the URL in the previous section. There are other examples online, but several didn't work for me; this one did. To create the file, you could type

cat >> /etc/systemd/system/freeswitch.service

and paste the preceding text in, then close the file with CTRL-D. Or you could use vi or nano to create the file. Once the file is in place, start the service as described in the next section.

Starting and Confirming Service

Reload the service engine, then start the service:

systemctl daemon-reload
service freeswitch start

Use

service freeswitch status

to confirm it is running. When it is running reliably, you can "enable" it so it will run when the system boots up.

systemctl enable freeswitch.service

Reboot the machine, and then ensure service is running after reboot:

ps -aux|grep free

You should see that is a running process, if all went well.

 

Add a comment

Fields followed by * are mandatory

HTML code is displayed as text and web addresses are automatically converted.

Page top