Compiling and installing Yate from SVN

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Common compile errors)
(Prepare the init script)
 
(31 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  
=== Prerequisites ===
+
Follow the steps below to install and compile the latest version of Yate from SVN source on any server with linux system on it.
 +
 
 +
== Prerequisites ==
  
 
Since you are going the full process of fetching and building Yate you will need the following:
 
Since you are going the full process of fetching and building Yate you will need the following:
 
* Basic system tools: [http://en.wikipedia.org/wiki/Sed sed], [http://en.wikipedia.org/wiki/Grep grep], [http://en.wikipedia.org/wiki/Awk awk]
 
* Basic system tools: [http://en.wikipedia.org/wiki/Sed sed], [http://en.wikipedia.org/wiki/Grep grep], [http://en.wikipedia.org/wiki/Awk awk]
 
* Basic software development tools:
 
* Basic software development tools:
** The [http://www.gnu.org/software/make/ Gnu make] program (it won't build with the BSD make)
+
** The [http://www.gnu.org/software/make/ GNU make] program (it won't build with the BSD make)
** The C++ compiler of the Gnu suite ([http://gcc.gnu.org/ gcc/g++]) and its libraries
+
** The C++ compiler of the GNU suite ([http://gcc.gnu.org/ gcc/g++]) and its libraries
 
** The [http://www.gnu.org/software/autoconf/ autoconf] configuration script builder
 
** The [http://www.gnu.org/software/autoconf/ autoconf] configuration script builder
 
* A [http://subversion.tigris.org/ subversion](svn) client
 
* A [http://subversion.tigris.org/ subversion](svn) client
 
* Development libraries for all optional modules in Yate you want to compile
 
* Development libraries for all optional modules in Yate you want to compile
 +
* pkg-config
  
 
It is likely your operating system offers some packaging system for installing what's missing from the above list. As much as possible use it, don't compile software yourself if you can avoid it.
 
It is likely your operating system offers some packaging system for installing what's missing from the above list. As much as possible use it, don't compile software yourself if you can avoid it.
  
=== Environment ===
+
'''Note:''' To provide dynamic loading system for modules Yate uses pragmatic dlopen()/dlsym() system calls.
 +
These system calls are not available under all operating systems therefore you cannot use and, or run Yate
 +
on all such platforms which don't provide the said system calls.
 +
 
 +
== Environment ==
  
 
You will need to perform all operations described here from a text console - either a virtual console, a virtual terminal in a graphic environment or a remote shell like that provided by [http://en.wikipedia.org/wiki/Secure_Shell ssh].
 
You will need to perform all operations described here from a text console - either a virtual console, a virtual terminal in a graphic environment or a remote shell like that provided by [http://en.wikipedia.org/wiki/Secure_Shell ssh].
  
At occasions you will need to become superuser (root) for some operations. The exact command depends on your system but here are some guesses:
+
At occasions you will need to become superuser (root) for some operations. <!-- The exact command depends on your system but here are some guesses:
  
 
  [user@localhost ~]$ su
 
  [user@localhost ~]$ su
Line 34: Line 41:
 
  [user@localhost yate-SVN]$ sudo make install
 
  [user@localhost yate-SVN]$ sudo make install
  
Fortunately ''sudo'' will remember your password for a while and will not ask it very often.
+
Fortunately ''sudo'' will remember your password for a while and will not ask it very often.-->
  
=== Get the sources===
+
== Get the sources==
  
 
Once you have the svn client installed getting the sources is a simple command:
 
Once you have the svn client installed getting the sources is a simple command:
Line 46: Line 53:
 
The first command will change the directory while the second will fetch a copy of the SVN TRUNK (where the code is committed) in a new directory called ''yate-SVN''. The third command will change your current directory to the Yate sources directory.
 
The first command will change the directory while the second will fetch a copy of the SVN TRUNK (where the code is committed) in a new directory called ''yate-SVN''. The third command will change your current directory to the Yate sources directory.
  
===Prepare and configure the sources===
+
==Prepare and configure the sources==
  
 
The clean SVN set of sources needs one extra step: you will bootstrap the configuration scripts.
 
The clean SVN set of sources needs one extra step: you will bootstrap the configuration scripts.
Line 53: Line 60:
 
  Finished! Now run configure. If in doubt run ./configure --help
 
  Finished! Now run configure. If in doubt run ./configure --help
  
This script will warn autoconf is missing and will prepare a configure script for you if everything is OK.
+
This script will warn if autoconf is missing and will prepare a configure script for you if everything is OK.
 
You can now run the configure script:
 
You can now run the configure script:
  
Line 67: Line 74:
 
  config.status: creating run
 
  config.status: creating run
  
You should look at the configure output and check that all features you need are detected. If they are not you should first check if you are not missing the corresponding development packages.
+
'''Note:''' You should look at the configure output and check that all features you need are detected. If they are not you should first check if you are not missing  
 +
the corresponding development packages.
 +
 +
Once all components you need are detected your source tree is configured and you can go to the next step.
 +
 
 +
===Prerequisites libraries===
 +
 
 +
* Development libraries for all optional [[modules]] in Yate you want to compile like:
  
Once all components you need are detected your source tree is configured and you can go to the next step.
+
:*If you want to register users in a database you need libraries like:
 +
::* [http://www.mysql.com/ MySQL] library - used by [[MySQL| MySQL Module]].
 +
::* [http://www.postgresql.org/ PostgreSQL] - used by [[PostgreSQL| PostgreSQL Module]].
 +
:* [http://docs.yate.ro/wiki/OpenH323 OpenH323] Library - used by [[H323 channel module]].
 +
:* [http://soft-switch.org/ spandsp] used by [[Fax Transfer Module]] - to transmit or receive a fax
 +
: Read more about them and others in [[modules]] page.
  
=== Compile the sources===
+
== Compile the sources==
  
 
This step is very simple but is the most important and time consuming.
 
This step is very simple but is the most important and time consuming.
Line 88: Line 107:
 
  make -s debug
 
  make -s debug
  
Note that the normal level of debugging added by ''make debug'' does not hinder runtime performance but will greatly help in [[Bug Reporting|reporting bugs]].
+
Note that the normal level of debugging added by ''make debug'' does not hinder runtime performance but will greatly help in [[Bug reporting|reporting bugs]].
  
=== Common compile errors ===
+
== Common compile errors ==
 
   
 
   
 
  /tmp/ccxxXXX.o:(.data.rel.ro+0xXX): undefined reference to `non-virtual  
 
  /tmp/ccxxXXX.o:(.data.rel.ro+0xXX): undefined reference to `non-virtual  
Line 102: Line 121:
 
  rm -f /usr/local/lib64/libyate*.so
 
  rm -f /usr/local/lib64/libyate*.so
  
 +
== Install the binaries==
  
=== Install the binaries===
 
 
Once the sources are compiled into binaries you may run them in place but this way is not recommended. Instead you should ''install'' them in your system.
 
Once the sources are compiled into binaries you may run them in place but this way is not recommended. Instead you should ''install'' them in your system.
  
Line 116: Line 135:
 
At the end of this stage all yate binaries and support files are installed in various subdirectories under the '''/usr/local''' subdirectory. You may change that from the configure options but it's not recommended - you should keep the programs you compiled yourself separate from the system provided ones.
 
At the end of this stage all yate binaries and support files are installed in various subdirectories under the '''/usr/local''' subdirectory. You may change that from the configure options but it's not recommended - you should keep the programs you compiled yourself separate from the system provided ones.
  
=== Set up your system ===
+
If you used '''make install''' and got an error then you probably don't have kdoc or doxygen package.
 +
 +
''make: *** [install-api] Error 1''
 +
 +
You can install package or use '''make install-noapi''' instead.
 +
Kdoc or doxygen is necessary just for documentation so you may skip that.
 +
 
 +
== Set up your system ==
 +
 
 
Not all systems can run out-of-the-box software that si self compiled and installed under '''/usr/local''' so you may need to instruct your system to do so.
 
Not all systems can run out-of-the-box software that si self compiled and installed under '''/usr/local''' so you may need to instruct your system to do so.
  
Line 141: Line 168:
 
and then retest if you can run yate.
 
and then retest if you can run yate.
  
===Service installation===
+
==Service installation==
If you will run Yate as server you will need some extra steps so yate will start automatically when your server starts.
+
 
 +
If you will run Yate as server you will need some extra steps so Yate will start automatically when your server starts.
 +
 
 +
=== Edit the configuration files===
  
==== Edit the configuration files====
 
 
Prior to running Yate you will need to configure its options according to your needs.
 
Prior to running Yate you will need to configure its options according to your needs.
  
Go to the '''/usr/local/etc/yate''' [[configuration files]] directory and edit those files (as root).
+
Go to the '''/usr/local/etc/yate''' [[Configuration Files|configuration files]] directory and edit those files (as root).
  
You may run yate manually in the console to check you didn't miss something. Provide some vebosity and colors of the output:
+
You may run Yate manually in the console to check you didn't miss something. Provide some verbosity and colors of the output:
 
   
 
   
 
  yate -vvv -CDoa
 
  yate -vvv -CDoa
  
 +
After the test press '''^C''' (Control-C) to stop Yate.
  
After the test press '''^C''' (Control-C) to stop yate.
+
=== Prepare the init script===
 
+
==== Prepare the init script====
+
  
 
You need to copy and rename the proper '''yate.init''' from a subdirectory of packing/ to '''/etc/init.d''' where all service start scripts are installed. Note that the script and additional tools depend on the Linux distribution used so take the correct one.
 
You need to copy and rename the proper '''yate.init''' from a subdirectory of packing/ to '''/etc/init.d''' where all service start scripts are installed. Note that the script and additional tools depend on the Linux distribution used so take the correct one.
Line 167: Line 195:
 
Replace ''rpm'' with what matches best your distribution's package manager.
 
Replace ''rpm'' with what matches best your distribution's package manager.
  
You will then need to edit the init file and change the path to the executable from '''/usr/bin''' to '''/usr/local/bin'''
+
You will then need to edit the init file and change the path to the executable from '''/usr/bin''' to '''/usr/local/bin'''. Exactly how depends on the style of the init script:
  
You may also alter the [[Starting|command line options]] to get more debugging. Is is recommended to enable timestamping the log messages.
+
Debian/Ubuntu:
 +
DAEMON=/usr'''/local'''/bin/$NAME
 +
 
 +
Gentoo:
 +
BINARY=${BINARY:-/usr'''/local'''/bin/yate}
 +
 
 +
RPM based:
 +
daemon '''/usr/local/bin/'''yate -d -p /var/run/yate.pid $OPTS
 +
 
 +
You may also alter the [[Starting Yate|command line options]] to get more debugging.
 +
 
 +
=== Prepare logs rotation===
  
==== Prepare logs rotation====
 
 
Copy '''packing/yate.logrotate''' as '''/etc/logrotate.d/yate''' and optionally edit it to adjust the limits. Note that logrotate normally runs daily so make sure you collect signifficantly less than 2GB of logs in 24 hours.
 
Copy '''packing/yate.logrotate''' as '''/etc/logrotate.d/yate''' and optionally edit it to adjust the limits. Note that logrotate normally runs daily so make sure you collect signifficantly less than 2GB of logs in 24 hours.
  
Line 181: Line 219:
 
If your logs grow too fast you have to either reduce the logging level - eventually per module - or set up logrotate to run more often. For example you can move the logrotate script from '''/etc/cron.daily''' to '''/etc/cron.hourly'''
 
If your logs grow too fast you have to either reduce the logging level - eventually per module - or set up logrotate to run more often. For example you can move the logrotate script from '''/etc/cron.daily''' to '''/etc/cron.hourly'''
  
==== Set the service script to start automatically====
+
=== Set the service script to start automatically===
 +
 
 
The way of doing it depends on the distribution.
 
The way of doing it depends on the distribution.
  
Line 191: Line 230:
  
 
  update-rc.d yate-local defaults
 
  update-rc.d yate-local defaults
 
  
 
Your distribution may provide a graphical service control panel - you can use that as well.
 
Your distribution may provide a graphical service control panel - you can use that as well.
  
==== Start the service manually====
+
=== Start the service manually===
  
 
Unless you are going to reboot the server you need to do the following once as root:
 
Unless you are going to reboot the server you need to do the following once as root:
Line 204: Line 242:
 
As a general note, use '''restart''' instead of '''start''' to avoid accidentally running multiple instances.
 
As a general note, use '''restart''' instead of '''start''' to avoid accidentally running multiple instances.
  
==== Disabling the service====
+
===Disabling the service===
  
 
If you want to temporarily disable the service you need to disable autostart and also stop it manually:
 
If you want to temporarily disable the service you need to disable autostart and also stop it manually:
Line 212: Line 250:
  
 
The procedure above may differ depending on the Linux distribution used but you will need to execute it as root.
 
The procedure above may differ depending on the Linux distribution used but you will need to execute it as root.
 +
 +
 +
'''See also'''
 +
 +
* [[Installation]]
 +
 +
[[Category:Install]] [[Category:Log rotation]] [[Category:SVN]]

Latest revision as of 14:55, 25 February 2014

Follow the steps below to install and compile the latest version of Yate from SVN source on any server with linux system on it.

Contents

[edit] Prerequisites

Since you are going the full process of fetching and building Yate you will need the following:

  • Basic system tools: sed, grep, awk
  • Basic software development tools:
    • The GNU make program (it won't build with the BSD make)
    • The C++ compiler of the GNU suite (gcc/g++) and its libraries
    • The autoconf configuration script builder
  • A subversion(svn) client
  • Development libraries for all optional modules in Yate you want to compile
  • pkg-config

It is likely your operating system offers some packaging system for installing what's missing from the above list. As much as possible use it, don't compile software yourself if you can avoid it.

Note: To provide dynamic loading system for modules Yate uses pragmatic dlopen()/dlsym() system calls. 
These system calls are not available under all operating systems therefore you cannot use and, or run Yate 
on all such platforms which don't provide the said system calls.

[edit] Environment

You will need to perform all operations described here from a text console - either a virtual console, a virtual terminal in a graphic environment or a remote shell like that provided by ssh.

At occasions you will need to become superuser (root) for some operations.

[edit] Get the sources

Once you have the svn client installed getting the sources is a simple command:

cd /usr/src
svn checkout http://voip.null.ro/svn/yate/trunk yate-SVN
cd yate-SVN

The first command will change the directory while the second will fetch a copy of the SVN TRUNK (where the code is committed) in a new directory called yate-SVN. The third command will change your current directory to the Yate sources directory.

[edit] Prepare and configure the sources

The clean SVN set of sources needs one extra step: you will bootstrap the configuration scripts.

./autogen.sh
Finished! Now run configure. If in doubt run ./configure --help

This script will warn if autoconf is missing and will prepare a configure script for you if everything is OK. You can now run the configure script:

./configure
checking for local operating system type... Linux
checking for libraries directory name... lib
checking for g++... g++
...
configure: creating ./config.status
config.status: creating packing/rpm/yate.spec
...
config.status: creating yate-config
config.status: creating run
Note: You should look at the configure output and check that all features you need are detected. If they are not you should first check if you are not missing 
the corresponding development packages.

Once all components you need are detected your source tree is configured and you can go to the next step.

[edit] Prerequisites libraries

  • Development libraries for all optional modules in Yate you want to compile like:
  • If you want to register users in a database you need libraries like:
Read more about them and others in modules page.

[edit] Compile the sources

This step is very simple but is the most important and time consuming.

The absolute minimum is issuing the make command:

make

For BSD users remember you need to run gmake instead.

There are some options you may give to the make command to control how the code is compiled:

  • -s will perform a silent build - only warnings and errors are displayed
  • debug will compile the binaries with debugging information

These options may be combined:

make -s debug

Note that the normal level of debugging added by make debug does not hinder runtime performance but will greatly help in reporting bugs.

[edit] Common compile errors

/tmp/ccxxXXX.o:(.data.rel.ro+0xXX): undefined reference to `non-virtual 
thunk to TelEngine::Driver::getObject(TelEngine::String const&) const'

You have another libyate.so in the linker's path. If you have another Yate installed from package please uninstall the yate-devel or yate-dev package.

If you have leftovers from a previous source install:

rm -f /usr/local/lib/libyate*.so
rm -f /usr/local/lib64/libyate*.so

[edit] Install the binaries

Once the sources are compiled into binaries you may run them in place but this way is not recommended. Instead you should install them in your system.

Installing will need that you become root and execute this command:

make install-noapi

If you cannot become root execute this command instead:

sudo make install-noapi

At the end of this stage all yate binaries and support files are installed in various subdirectories under the /usr/local subdirectory. You may change that from the configure options but it's not recommended - you should keep the programs you compiled yourself separate from the system provided ones.

If you used make install and got an error then you probably don't have kdoc or doxygen package. 

make: *** [install-api] Error 1

You can install package or use make install-noapi instead. 
Kdoc or doxygen is necessary just for documentation so you may skip that.

[edit] Set up your system

Not all systems can run out-of-the-box software that si self compiled and installed under /usr/local so you may need to instruct your system to do so.

First a short test to check that you need to do something. Run this test as root, just like Yate will need to run in most scenarios:

yate -V

with the possible results:

Yate x.y.z alpha1
  or
yate: error while loading shared libraries: libyate.so.x.y.z: cannot open shared object file

First case is a success - you don't need to do anything!

In second case you will need to add /usr/local/lib or /usr/local/lib64 to your dynamic loader's path.

Edit the /etc/ld.so.conf file and add a new line with the desired path. On most systems you will need to add lib but on RPM based systems with an x86_64 architecture you will need to add lib64 or better both.

After you do the editing run (also as root) the following command:

ldconfig

and then retest if you can run yate.

[edit] Service installation

If you will run Yate as server you will need some extra steps so Yate will start automatically when your server starts.

[edit] Edit the configuration files

Prior to running Yate you will need to configure its options according to your needs.

Go to the /usr/local/etc/yate configuration files directory and edit those files (as root).

You may run Yate manually in the console to check you didn't miss something. Provide some verbosity and colors of the output:

yate -vvv -CDoa

After the test press ^C (Control-C) to stop Yate.

[edit] Prepare the init script

You need to copy and rename the proper yate.init from a subdirectory of packing/ to /etc/init.d where all service start scripts are installed. Note that the script and additional tools depend on the Linux distribution used so take the correct one.

This operation needs that you run as root:

cp packing/rpm/yate.init /etc/init.d/yate-local
chown root.root /etc/init.d/yate-local

Replace rpm with what matches best your distribution's package manager.

You will then need to edit the init file and change the path to the executable from /usr/bin to /usr/local/bin. Exactly how depends on the style of the init script:

Debian/Ubuntu:

DAEMON=/usr/local/bin/$NAME

Gentoo:

BINARY=${BINARY:-/usr/local/bin/yate}

RPM based:

daemon /usr/local/bin/yate -d -p /var/run/yate.pid $OPTS

You may also alter the command line options to get more debugging.

[edit] Prepare logs rotation

Copy packing/yate.logrotate as /etc/logrotate.d/yate and optionally edit it to adjust the limits. Note that logrotate normally runs daily so make sure you collect signifficantly less than 2GB of logs in 24 hours.

You will also need to make the file owned by root:

cp packing/yate.logrotate /etc/logrotate.d/yate
chown root.root /etc/logrotate.d/yate

If your logs grow too fast you have to either reduce the logging level - eventually per module - or set up logrotate to run more often. For example you can move the logrotate script from /etc/cron.daily to /etc/cron.hourly

[edit] Set the service script to start automatically

The way of doing it depends on the distribution.

For most RPM based systems (as root):

chkconfig yate-local on

For Debian based systems:

update-rc.d yate-local defaults

Your distribution may provide a graphical service control panel - you can use that as well.

[edit] Start the service manually

Unless you are going to reboot the server you need to do the following once as root:

service yate-local restart


As a general note, use restart instead of start to avoid accidentally running multiple instances.

[edit] Disabling the service

If you want to temporarily disable the service you need to disable autostart and also stop it manually:

chkconfig yate-local off
service yate-local stop

The procedure above may differ depending on the Linux distribution used but you will need to execute it as root.


See also

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers