Installing OpenSER
From InstallationWiki
| Official Page |
| Project Documentation |
| Download |
|
The installation is the beginning of the work. It is very important to install OpenSER correctly from the source code. You can install much faster from the Debian packages or using the apt-get utility. However, the installation from the source code is much more flexible allowing you to select which modules will be compiled. You cannot install RADIUS accounting support from the Debian Packages. That's why we won't use any shortcut to the installation. I strongly advise you to install using Debian.
If you choose to install on another platform, you will have to deal with init scripts and fixing the installation of the other packages.
Contents |
[edit] Hardware Requirements
There are no minimum hardware requirements for OpenSER. It will run in an ordinary PC. The best bets we have are from performance tests realized on the 1.2 version. A PC with the following specifications was capable of 28 million complete calls per hour. The testing server was an ordinary desktop, Intel Core2 CPU 6300 @ 1.86GHz, 1GB of memory, 100Mbs Ethernet card. Unfortunately, there are currently no formulas for OpenSER dimensioning. The correct hardware (CPU and memory) must be obtained empirically.
[edit] Software Requirements
The OpenSER software runs in a variety of Linux, BSD, and Solaris platforms. Some generic packages are available for some varieties of Linux and Solaris. These packages can be downloaded from http://www.openser.org. The following packages are required to compile OpenSER.
- gcc
- Bison or yacc (Berkley yacc)
- flex
- GNU make
- GNU tar
- GNU install
Some modules such as MYSQL, POSTGRES, RADIUS, and others will require additional packages to compile.
[edit] Lab Installing Linux for OpenSER
All of these labs were prepared using a VMware virtual machine with Debian Etch 4.0 installed. We have used as the Linux distro the Debian Etch, which can be downloaded from:
http://cdimage.debian.org/debian-cd/4.0_r0/i386/
Warning- The instruction for this lab formats the computer. Back up all the data before proceeding or run in some virtual machine such as VMware or XEN.
Step 1: Insert the CD and boot the computer using the Debian Etch 4.0 CD. Press ENTER to start the installation.
In this screen, you can also select boot and installation options. Sometimes you will need to choose some hardware-specific parameters for your installation. Press F1 for help if needed.
Step 2: Choose a language.
Choose the language of your preference for the use in the installation process.
Step 3: Choose the keyboard layout.
It is very common to have to choose a keyboard layout, mainly in European and Asian countries.
Step 4: Choose the Hostname.
Choose the name of the server. It is important because later you will use this name to access the server.
Step 5: Choose your Domain name.
The domain name is obvious, but important, because OpenSER use domains to distinguish users, so be sure to anwer correctly this screen.
Step 6: Choose a Partitioning method.
We could write a whole tutorial about partitioning. Linux geeks, certainly, will use the manual option. For the purposes of learning, you can simply use entire disk. Consult a Linux specialist for the best partioning scheme for your server.
Step 7: Select disk to partition.
Now, just select the disk being used to install Linux.
Step 8: Select all files in one partition.
Again, you can choose how to partition the system. Let's stick with the default installation again. Some advanced users may want to change it a bit.
Step 9: Finish the partition changes to disk.
Now, just finish the partitioning step and write changes to the disk. Never do it if you want to preserve your disk. After the partitioning, all the pre-existing content of the disk will be erased. So do it wisely. I used VMWare to test OpenSER; it is free and creates a virtual machine, where I can work safely.
Step 10: Write changes to the disk.
Now, it comes to the scary part. Confirm that you want to erase all the content of the disk. Well, think twice, or even three times before saying "Yes".
Warning - All data on the disk will be destroyed!
Step 11: Configure the time zone.
Select the time zone. It is important to have the correct time zone, mainly for reports. If you don't do it correctly, you will end up with voicemail messages with the wrong time.
Step 12: Set the Root password to "openser".
Choose a password for your root user. This is the most important password on the system.
Step 13: Re-enter password to verify.
Please, re-enter the password for confirmation purposes. Try to use a password hard to crack (8 characters minimum, letters, numbers, and some kind of special character such as "*"or "#").
Step 14: Enter the full name for the user account as "openser".
Some systems require you to create at least one user. Let's do it, starting with the full user name.
Step 15: Enter the user name for user account as "openser".
Now the name used to log on the user on the system.
Step 16: Enter the password for the user account "openser" and re-enter to confirm.
Enter the password and confirm it. Again, try to use a password hard to crack.
Step 17: Configure the package manager. Select Yes to use a mirror.
During the process of installation, we will use several packages distributed by Debian.
Step 18: Select a mirror country.
This screen will allow you to select from where you will download the packages.
Step 19: Select ftp.debian.org or your preferred mirror.
Select the nearest one to speed up the download of the packages.
Step 20: Leave the HTTP proxy blank or fill with the appropriate parameters if you use an HTTP proxy.
If you use an HTTP proxy such as Squid or Microsoft ISA Server, please fill in the appropriate parameters to allow internet access for the downloads.
Step 21: Select Yes if you want to to participate in the package popularity survey, or No if you don't.
The popularity package survey generates statistics about the most downloaded packages.
Step 22: Select Standard system.
Debian comes in several pre-defined installations such as Desktop. The desktop installation, as an example installs a GUI for Linux such as GNOME or KDE. We don't need this for our installation. So please choose just Standard system. Later we will install manually components such as the Web Server, Mail Server, and SQL Database.
Step 23: Select Yes to install the GRUB boot loader.
GRUB is a boot load manager for your server. It allows you to dual boot systems and to do some tricks during the boot process.
Step 24: Finish the installation.
Finish the installation and boot the system.
The system will reboot automatically.
Step 25: Just after the reboot install SSH.
apt-get install ssh
[edit] Downloading and Installing OpenSER v1.2
Even though it is easier to install the OpenSER using the Debian packages we will go through the compilation process. It is more flexible and we may need to recompile OpenSER a few times in this material to include other modules. The installation process step by step follows:
Step 1: Install the dependencies.
apt-get install gcc bison flex make openssl libmysqlclient15-dev libradiusclient-ng2 libradiusclient-ng-dev mysql-server
The MySQL server is not really a dependency, but we will install it at this moment to make things easier.
Step 2: Download the source package and decompress it.
cd /usr/src wget [http://www.openser.org/pub/openser/1.2.2/src/openser-1.2.2-tls_src.tar.gz http://www.openser.org/pub/openser/1.2.2 /src/openser-1.2.2-tls_src.tar.gz] tar -xzvf openser-1.2.2-tls_src.tar.gz
Step 3: Use your favorite Linux editor to edit the Makefile
Remove from the "exclude_modules?=" line the mysql and any radius-related modules. This will make the compilation process include MySQL and RADIUS.
cd /usr/src/openser-1.2.2-tls/ vi Makefile
File before making changes:
exclude_modules?= jabber cpl-c mysql pa postgres osp unixodbc \
avp_radius auth_radius\
group_radius uri_radius xmpp \
presence pua pua_mi pua_usrloc \
mi_xmlrpc perl snmpstats
File after making changes:
exclude_modules?= jabber cpl-c pa postgres osp unixodbc \
xmpp \
presence pua pua_mi pua_usrloc \
mi_xmlrpc perl snmpstats
Step 4: Compile and install the core and modules.
cd openser-1.2.2-tls make prefix=/ all make prefix=/ install
Step 5: Make the required adjustments:
mkdir /var/run/openser
[edit] Lab Running OpenSER at the Linux Boot
Step 1: Include openSER in the linux boot.
cd /usr/src/openser-1.2.2-tls/packaging/debian cp openser.default /etc/default/openser cp openser.init /etc/init.d/openser update-rc.d openser defaults 99
Step 2: Edit the /etc/openser/openser.cfg file and remove the line fork=no (even if it has C-style remarks). The init script looks for the instruction fork=no, even if commented.
Step 3: Make sure that the script openser.init has the necessary permissions
cd /etc/init.d chmod 755 openser
Step 4: Edit /etc/default/openser.cfg, change the memory parameter to 128MB and the RUN_OPENSER to yes.
Step 5: Edit the init script to make sure that the daemon is pointing to the right directory:
vi /etc/init.d/openser
File before making changes:
DAEMON=/usr/sbin/openser
File after making changes:
DAEMON=/sbin/openser
Step 6: Restart the computer to see if OpenSER starts. Confirm using:
ps-ef |grep openser.
It is highly recommended that you change the username and password used to run openser in the /etc/init.d/openser file.
[edit] OpenSER v1.2 Directory Structure
After the installation, OpenSER will create a file structure. It is important to understand the file structure to locate the main folders where the system is stored. You will need this information to update or remove the software.
[edit] Configuration Files (etc/openser)
openser-1:/etc/openser# ls -l
total 12 -rw-r--r-- 1 root root 1804 2007-09-10 14:02 dictionary.radius -rw-r--r-- 1 root root 4077 2007-09-10 14:05 openser.cfg -rw-r--r-- 1 root root 1203 2007-09-10 14:02 openserctlrccd
[edit] Modules (/lib/openser/modules)
openser-1:/lib/openser/modules# ls
acc.so domain.so msilo.so sms.so alias_db.so enum.so mysql.so speeddial.so auth_db.so exec.so nathelper.so sst.so auth_diameter.so flatstore.so options.so statistics.so auth_radius.so gflags.so path.so textops.so auth.so group_radius.so pdt.so tm.so avpops.so group.so permissions.so uac_redirect.so avp_radius.so imc.so pike.so uac.so dbtext.so lcr.so registrar.so uri_db.so dialog.so mangler.so rr.so uri.so dispatcher.so maxfwd.so seas.so usrloc.so diversion.so mediaproxy.so siptrace.so xlog.so domainpolicy.so mi_fifo.so sl.socd /lib/openser/modules
[edit] Binaries (/sbin)
openser-1:/sbin# ls -l op*
-rwxr-xr-x 1 root root 2172235 2007-09-10 14:02 openser -rwxr-xr-x 1 root root 41862 2007-09-10 14:02 openserctl -rwxr-xr-x 1 root root 38107 2007-09-10 14:02 openser_mysql.sh -rwxr-xr-x 1 root root 13562 2007-09-10 14:02 openserunixcd /sbin
[edit] Log Files
The initialization log can be seen at syslog (/var/log/syslog):
Sep 10 14:25:56 openser-1 openser: init_tcp: using epoll_lt as the io watch method (auto detected) Sep 10 14:25:56 openser-1 /sbin/openser[7791]: INFO: statistics manager successfully initialized Sep 10 14:25:56 openser-1 /sbin/openser[7791]: StateLess module - initializing Sep 10 14:25:56 openser-1 /sbin/openser[7791]: TM - initializing... Sep 10 14:25:56 openser-1 /sbin/openser[7791]: Maxfwd module- initializing Sep 10 14:25:56 openser-1 /sbin/openser[7791]: INFO:ul_init_locks: locks array size 512 Sep 10 14:25:56 openser-1 /sbin/openser[7791]: TextOPS - initializing Sep 10 14:25:56 openser-1 /sbin/openser[7791]: INFO: udp_init: SO_RCVBUF is initially 109568 Sep 10 14:25:56 openser-1 /sbin/openser[7791]: INFO: udp_init: SO_RCVBUF is finally 262142 Sep 10 14:25:56 openser-1 /sbin/openser[7791]: INFO: udp_init: SO_RCVBUF is initially 109568 Sep 10 14:25:56 openser-1 /sbin/openser[7791]: INFO: udp_init: SO_RCVBUF is finally 262142 Sep 10 14:25:56 openser-1 /sbin/openser[7792]: INFO:mi_fifo:mi_child_init(1): extra fifo listener processes created
[edit] Startup Options
OpenSER can be started using the init scripts or using the openserctl utility. If you start openser using init scripts, you can only stop using init scripts. The same is valid if you start using openserctl utility.
Starting, stopping, and restarting OpenSER using the init scripts:
/etc/init/d/openser start|stop|restart
Starting, stopping, and restarting OpenSER using
/etc/init/d/openserctl start|stop|restart
The OpenSER executable has several startup options. These options, show, below, allow you to change the configuration of the DAEMON. Some of the most useful are:
- "-c" to check the configuration file
- "-D E dddddd" to check module loading (don't use for production, it binds only the first interface)
There are lots of others to allow you to fine tune your configuration. For each option there is a correspondent core parameter that you can put in the configuration file.
Usage: openser -l address [-p port] [-l address [-p port]...] [options]
Options:
-f file Configuration file (default //etc/openser/openser.cfg)
-c Check configuration file for errors
-C Similar to '-c' but in addition checks the flags of
exported functions from included route blocks
-l address Listen on the specified address/interface (multiple -l
mean listening on more addresses). The address format
is [proto:]addr[:port], where proto=udp|tcp and
addr= host|ip_address|interface_name. E.g: -l locahost,
-l udp:127.0.0.1:5080, -l eth0:5062 The default
behavior is to listen on all the interfaces.
-n processes Number of child processes to fork per interface
(default: 8)
-r Use dns to check if is necessary to add a "received="
field to a via
-R Same as '-r' but use reverse dns;
(to use both use '-rR')
-v Turn on "via:" host checking when forwarding replies
-d Debugging mode (multiple -d increase the level)
-D Do not fork into daemon mode
-E Log to stderr
-T Disable tcp
-N processes Number of tcp child processes (default: equal to '-n')
-W method poll method
-V Version number
-h This help message
-b nr Maximum receive buffer size which will not be exceeded
by auto-probing procedure even if OS allows
-m nr Size of shared memory allocated in Megabytes
-w dir Change the working directory to "dir" (default "/")
-t dir Chroot to "dir"
-u uid Change uid
-g gid Change gid
-P file Create a pid file
-G file Create a pgid file
-x socket Create a unix domain socket
[edit] Summary
In this tutorial you have learned how to install and prepare Linux for the OpenSER installation. We have downloaded and compiled OpenSER and MySQL modules. After the installation we included the OpenSER init file to start OpenSER at boot time.
[edit] Additional References
- For instructions on testing and monitoring OpenSER, click here.
- For instructions on Installing SerMyAdmin, click here
[edit] Source
The source of this content is Chapter 3: OpenSER Installation of Building Telephony Systems with OpenSER by Flavio E. Goncalves (Packt Publishing, 2008).
