Compiling and installing Yate from SVN
(→Service installation) |
(→Edit the configuration files) |
||
Line 155: | Line 155: | ||
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. |
Revision as of 16:50, 29 November 2012
Contents |
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
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
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. The exact command depends on your system but here are some guesses:
[user@localhost ~]$ su Password: [root@localhost ~]#
Notice the prompt change - usually the $ prompt indicates a regular user, # is reserved for root.
On some systems you cannot execute su directly, you will need to use sudo and enter the user password instead of the root password:
[user@localhost ~]$ sudo su Password for user: [root@localhost ~]#
There are also some systems where you cannot become root in a persistent manner. On such systems you will need to execute every command requiring root through sudo:
[user@localhost yate-SVN]$ sudo make install
Fortunately sudo will remember your password for a while and will not ask it very often.
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.
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 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
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.
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.
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
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.
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.
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 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.
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
You may also alter the command line options to get more debugging. Is is recommended to enable timestamping the log messages.
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
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.
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.
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