Installation DEPRECATED
Operating Systems
Linux and Unix
The primary Linux distributions supported include the latest versions of Debian and CentOS. Be sure to use CentOS versions later than 6.3 to avoid a kernel timing bug that affected the proper operation of FreeSWITCH. CentOS 5 is RIGHT OUT!
Successful installations have been reported on FreeBSD and Ubuntu, although the FS team would appreciate devoted *BSD and Ubuntu users to maintain those ports and build systems.
Mac OS X
The comprehensive Installation and Setup on OS X guide has detailed installation steps and instructions for setting up a 24x7 Mac. OS X is based on BSD Unix so there are similarities to the Linux installation.
Windows
Information for source and binary installation is found at Windows Install which also contains Quick Start information. Very little information on this page applies to Windows other than the Source Options.
Preparation
Directory Permissions
FreeSWITCH™ can be placed in any directory. However, for Unix and Linux the source code is typically installed in /usr/local/src/freeswitch and binaries in /usr/local/freeswitch. Some systems drop 'local' and use /usr/src. These directories are usually root protected after initial OS installation. You should change the owner and group so that root is not needed for installation or execution of FreeSWITCH. You should create and set permissions on /usr/local/freeswitch in this fashion:
Set Permissions
sudo mkdir /usr/local/freeswitch
sudo chown -R newid:newgroup /usr/local/freeswitch
Executive summary: deploy the latest official release for production systems, master from git for test and development systems that require the very latest features or patches.
The current release is recommended for production use. The yum and Debian packages provide the easiest path to a working FreeSWITCH installation.
The 1.4 release is available in Git branch v1.4 Patches will be made here and periodically released as the next minor version. Since not every patch will mean a newer version you will get the very latest patches to the current release by using this branch. This branch is a moving target - the checkout date and revision will form part of the version number.
The current release in a tarball of FreeSWITCH is version 1.4.4, released on 23 May 2014. Older releases and other files are in the file archive, along with digital signatures that you can use to verify your download.
If you wish to compile your own build with the very latest features you can use the Master branch from Git. New features will only be added to the Master branch. This will have the newest, latest, and greatest features, but due to upgrading of the bundled libraries it might be less stable than the current release for a short while. If you use this branch you should test the installation before releasing it to production use to confirm that it is stable in your environment. You can then use 'git checkout' to install the same tested revision on all your systems.
NOTE that this is a formal change of development practice; Master used to be the recommended deployment target for all users, but now the tarballs and the Git current release version number serve that purpose. Older documentation and tutorials may still exist recommending using Master, but these will now be out-of-date.
When upgrading please review the Release Notes page to see whether there are any behavior changes since previous versions.
Recommended: Git
Git provides access to the latest features and bug fixes added throughout the day. Most often you will only use the clone and pull commands. There is an excellent Online Git Book available in multiple languages. For help installing Git see Git_Install. The following creates a freeswitch directory and downloads a "clone" of the current source:
cd /usr/local/src
git clone git://git.freeswitch.org/freeswitch.git
OR
git clone -b v1.4 git://git.freeswitch.org/freeswitch.git
(SEE BELOW)
Note: git reset --hard <commit_id> - will revert all local changes and reset the working copy to the specified commit.
Selecting version
There are 2 branches in Git - Master and v1.4
v1.4 is the branch for the 1.4 series. It contains the current release, plus any patches made since that release.
git clone -b v1.4 git://git.freeswitch.org/freeswitch.git
Master is where the development for the future 1.4 release is being done. New features are added to this branch, but it may be less stable than 1.4 at times.
git clone git://git.freeswitch.org/freeswitch.git
You can switch branches on an already cloned Git tree:
git checkout v1.4
git checkout master
If you get an error on GIT PULL on v1.4 saying You asked me to pull without telling me which branch you want to merge with
Then run this to add the definition for that branch to .git/config:
git branch --set-upstream v1.4 origin/v1.4
You can see all remote branches with git branch -r. You can check out 1.4beta for example with
git checkout v1.4.beta
Some more information for people trying git tag: 1.4beta is snapshots of the 1.5 development code base. Version 1.4 has replaced 1.2 as the current release.
Reverting to an Earlier Commit in Git
Sometimes when things go terribly wrong with the latest commits (regression-type bugs), you can always revert to an earlier commit with git. Simply type in:
git checkout <revhash>
where <revhash> is the hash of an earlier commit. You can find the commit hashes here.
After reverting to a previous version, it is strongly recommended that you (in the following order):
- Report the issue to the FreeSWITCH JIRA
- Run 'git clean -d -f -x' on the root directory of the sources of FreeSWITCH to remove non-git files and spare compilation files.
- Run 'rm -rf /usr/local/freeswitch/{lib,mod,bin}/*' to remove the current binary files in those 3 directories.
- Re-bootstrap the code
- Re-run the configure process
... before you re-build the code from an earlier revision.
To go back to the very latest commit from the development branch, simply type in
git checkout master
Revert only certain commit
To reverse only the one commit change on newer build
git log -1 -p <revhash> | patch -p1 -R
freeswitch-contrib
Contributed source may be obtained from the freeswitch-contrib tree as follows (this will compile and install updates):
git clone git://git.freeswitch.org/freeswitch-contrib.git
Sample configs can be downloaded as well:
git clone git://git.freeswitch.org/freeswitch-sample-configs.git
The Latest Build site latest.freeswitch.org is currently empty.
Compiling and Installation
Ensure that the required prerequisites are installed. Also check if there are notes for your distribution in Distribution Information and Installation.
Switch to the src/freeswitch Directory
The remaining commands are executed from the directory containing the FreeSWITCH™ source (use whatever directory the source is located in):
cd /usr/local/src/freeswitch
Installed from Git
If Git was used to download, the configuration files must be built before the first compile. ./bootstrap.sh creates many files including modules.conf. Once this is performed it's not normally required to be performed again. If you're installing from a tarball, this script was run before packaging, and you shouldn't need to run it.
./bootstrap.sh
You can use multiple cores for your bootstrap/config/build, by specifying it at the start, e.g.: (note this may make build errors harder to spot)
./bootstrap.sh -j
However, its not recommended to use the -j flag for either bootstrap.sh or make, on bootstrap.sh on a slow machine (older machines or say a raspberry pi) -j will fail randomly due to how it is handled. on the make this may also randomly fail. (quoted from Ken Rice in FS-4891)
Configure for Compilation
./configure sets compilation options. Invoke the following command to configure for compilation:
./configure
You can have the checks cached for each module, by using:
./configure -C
If you want to install FreeSWITCH to a non-standard location you can simply append the --prefix option to the configure script as shown in this example:
./configure --prefix=<example of non standard location>
Edit modules.conf
The modules.conf file contains the list of modules to be compiled, some are commented as they are not required. As your FreeSWITCH™ configuration becomes more complex additional modules may be required. If you plan to test the sample IVR after installation, FLITE must be added to the compile as follows:
- Use an editor to navigate to and edit /usr/local/src/freeswitch/modules.conf (or whatever directory it was placed into)
- Search for "flite" and remove the # to uncomment.
- Save the file.
If this is your first experience with FreeSWITCH™ don't add more than FLITE. Adding functions may result in additional prerequisites that must be installed.
Building FLITE requires about 450 megabytes of addressable memory, so if you are building on a device with limited RAM, you'll need to create a swap file (a.k.a. Virtual Memory or paging file) of sufficient size to allow the build to proceed, or simply do not include mod_flite in the build. (Please refer to your operating system's documentation for instructions on how to create a swap file.) All other modules in the default configuration will build successfully on devices with less than 100MB of available RAM.
Compile and Install
Invoke the following commands to compile and create the binaries:
make && make install
"make install" does not overwrite existing configuration files in freeswitch/conf if a freeswitch.xml file already exists in conf.
Compile and Install Sounds
There are IVR sound prompts and music on hold files that are optional but must be compiled and installed to run the sample IVR. There are four versions available:
- sounds-install moh-install (8 kHz)
- hd-sounds-install hd-moh-install (16 kHz)
- uhd-sounds-install uhd-moh-install (32 kHz)
- cd-sounds-install cd-moh-install (48 kHz)
The cd sounds are recommended since all the sampling rates are provided resulting in fewer problems. Invoke the following command:
make all cd-sounds-install cd-moh-install
Ready to Test!
Switch to the freeswitch/bin directory and try some stuff! When you're done read the Getting Started Guide to learn how to configure FreeSWITCH™.
cd /usr/local/freeswitch/bin
./freeswitch
Upgrading and Re-installation
Upgrading
When upgrading please review the Release Notes page to see whether there are any behavior changes since previous versions.
See the Download & Installation Guide.
Updating the Source
If FreeSWITCH™ was previously installed using a Git based installation, and only a clean update to the latest tree is required, issue this command:
make current
The make current command will clean your build environment, do a git pull, and then do a make install for you.
Rebuilding
After doing a "git pull" or changing source files, it may be desirable to clean out your build area:
make clean modwipe
Alternatively, you can execute "make current" which will handle the git pull, clean up, and rebuild in one step:
make current completely cleans the build environment and rebuilds FreeSWITCH™ so it runs a long time. However, it will not overwrite files in a pre-existing "conf" directory. Also, the clean targets leave the "modules.conf" file.
make current
To check if there are any new modules execute:
diff build/modules.conf.in modules.conf
If a previously disabled module is now enabled, or there is a requirement to rebuild a single module, execute the following (replace mod_name with the name of the module to build):
Upgrading on-the-fly
It is highly inadvisable to upgrade FreeSWITCH on-the-fly (aka while running) as this can cause unexpected behavior and may potentially hang the entire system.
However it can be done by following these steps below:
After recompilation while FS is still running you can still install:
Note, this will automatically install, and it even first cleans the build dir and the installation dir, which should even work while FS is running, provided no modules are reloaded or loaded:
make mod_name-install
make current
To make the changes of the new build take effect, FS has to be restarted:
/usr/local/freeswitch/bin/fs_cli -x shutdown elegant restart
This will wait for all traffic to end, yet still allow new traffic. <--ERROR***
If you want to restart as soon as possible, you can use:
/usr/local/freeswitch/bin/fs_cli -x shutdown asap restart
This will restart FS as soon as there is no more traffic and it will not allow any new traffic to make this happen as soon as possible.
If you want a faster rebuild, you can make use of make's dependency system. Note that this will not make the version command reflect the actual git revision, as the modules making use of it will not be rebuild if there is no change of them in the git tree.
Be aware some things might not be rebuilt which might be important to be and there might occur compile errors / runtime errors / segfaults. In my experience, this is rare, but if you encounter any problems, a clean rebuild is advisable to see if the problem persists.
make sync all install
To always reflect the actual git version and revision in every module, there should be a function switch_core_get_version() which would be in an object always rebuilt and giving the actual version in return. So far a preprocessor variable is used.
Troubleshooting
Compile Errors
If you encounter compile errors or other bugs be sure to test it again with the latest Git version, then file a bug report at http://jira.freeswitch.org or email freeswitch-dev@lists.freeswitch.org (we prefer that you use Jira so that we can track all issues). Remember FreeSWITCH™ development is always ongoing and requires contributions from everybody.