From Source

Again, on a new, bare, clean Debian 8 64-bit machine, connect via ssh and execute as root, from the command line:

    apt-get update
    apt-get -y upgrade
    apt-get install -y wget ca-certificates git
    wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
    echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
    apt-get update
    apt-get install -y --force-yes freeswitch-video-deps-most
  

At this point, we'll see that an enormous amount of software is installed on our machine. Those are all dependencies needed to build FreeSWITCH from source. You'll end up with a complete developer suite, tools, libraries, and languages; all that's needed for FS development is there, already installed.

After a while, the mega-dependencies-galore has finished, and we can go forward to the next steps: downloading, compiling, and installing FreeSWITCH source code, demo configuration, and related accessory files:

    git config --global pull.rebase true
    cd /usr/src/
    git clone https://freeswitch.org/stash/scm/fs/freeswitch.git -bv1.6 freeswitch
    cd freeswitch
    ./bootstrap.sh -j
    ./configure
    make
    make install
    make cd-sounds-install cd-moh-install

All those steps will take a while to finish, and you'll end up with a complete FreeSWITCH system, stable, always up to date with the latest security, bug fixes, and features, and completely compatible with official documentation, community knowledge, and broscience. (YES, you end up with the same stuff as if you had installed from packages. But maybe you want to be able to modify the sources and recompile).

We need one more step for running FreeSWITCH in the recommended way, avoiding to have it all, files, executables, processes owned by root. Let's create a specific freeswitch user, which will own the files that belong to the FreeSWITCH server. That same freeswitch user will also run the FS processes (see the systemd paragraph):

    cd /usr/local
    groupadd freeswitch
    adduser --disabled-password--quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH open source softswitch" --ingroup freeswitch freeswitch
    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/*
  

Now we are ready to blend FreeSWITCH into the Debian automation and management framework, by letting systemd manage the start, stop, and restart of its processes. First, we install from source the systemd unit for FreeSWITCH, edit it, and then we enable it to be run at each boot:

    cp /usr/src/freeswitch/debian/freeswitch-systemd.freeswitch.service /etc/systemd/system/freeswitch.service
  

Now edit that new file to reflect the locations under the /usr/local/freeswitch/ directory. Specifically, edit the following lines:

PIDFile=/usr/local/freeswitch/run/freeswitch.pid 
ExecStart=/usr/local/freeswitch/bin/freeswitch -u freeswitch -g freeswitch -ncwait -nonat -rp 

Then tell systemd to reload its configs, start FreeSWITCH, and enable it to start automatically at boot:

    systemctl daemon-reload
    systemctl start freeswitch
    systemctl enable freeswitch
  

Now, reboot the machine and you'll find FreeSWITCH is automatically run as freeswitch user (and freeswitch group).

We can update the whole platform periodically via the command line (as root):

    apt-get update
    apt-get dist-upgrade
    cd /usr/src/freeswitch
    make current
  

Whatever the method we choose for installation, from ready-made packages or source, after FreeSWITCH has been started, we can connect to and manage it via the fs_cli executable, found in /usr/local/freeswitch/bin:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.119.114