Compiling and installing Yate from SVN
(→Prepare the init script) |
|||
(27 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | |||
+ | 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 == | == Prerequisites == | ||
Line 5: | Line 7: | ||
* 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/ | + | ** The [http://www.gnu.org/software/make/ GNU make] program (it won't build with the BSD make) |
− | ** The C++ compiler of the | + | ** 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. | ||
+ | |||
+ | '''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 == | == Environment == | ||
Line 17: | Line 24: | ||
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== | ||
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: | ||
− | + | :*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== | ||
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 | + | 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 == | ||
Line 115: | Line 134: | ||
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. | ||
+ | |||
+ | 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 == | == Set up your system == | ||
Line 144: | Line 170: | ||
==Service installation== | ==Service installation== | ||
− | If you will run Yate as server you will need some extra steps so | + | 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=== | ||
Line 152: | Line 178: | ||
Go to the '''/usr/local/etc/yate''' [[Configuration Files|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 | + | 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 | + | |
=== Prepare the init script=== | === Prepare the init script=== | ||
Line 170: | 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 Yate|command line options]] to get more debugging | + | 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=== | ||
Line 221: | Line 255: | ||
* [[Installation]] | * [[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:
- 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:
- MySQL library - used by MySQL Module.
- PostgreSQL - used by PostgreSQL Module.
- OpenH323 Library - used by H323 channel module.
- spandsp used by Fax Transfer Module - to transmit or receive a fax
- 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