Skip to content

Gammu-SMSD: Command Not Found [Solved]

This article details the steps to Build a Centos 7 SMS Gateway from Source. This exists because the steps described in the previous article “Build a CentOS 7 SMS Gateway with Gammu” is fraught with issues. Lest it be misconstrued rather unfairly, what I mean by the term “fraught with issues” is that it works but not totally.  In the case at bar, the gammu-smsd utility is missing from the rpms or more succintly, the terminal prompts – gammu-smsd: command not found.

Although the gammu manual provides rather generically that “Gammu SMS Daemon is a program that periodically scans GSM modem for received messages, stores them in defined storage and also sends messages enqueued in this storage,” it is a very important component of gammu. It is the key to connect MySQL/MariaDB to gammu, vice versa. It bridges the TCP/IP and GSM tiers. In short, it allows a web programming language, such as PHP, to manipulate gammu. (More on this in a latter article.)

According to the Gammu website, gammu-smsd “is distributed as part of Gammu so to download it just get Gammu. If you want to use binary package, the daemon might be included in separate binary package in your distribution, try looking for something like gammu-smsd.” However, when you install gammu via the RPMs provided in the Gammu Downloads Section (which redirects to a page in the OpenSuse website) still, the terminal prompts, gammu-smsd: command not found.

I racked my mind over this for hours. I installed different versions of Gammu. I installed the missing dependencies one by one. I even installed a highly dubious gammu-smsd rpm out of desperation,  only to find myself where I left off — gammu-smsd: command not found.

Gammu-SMSD Command Not Found [Solved]

After mulling over the problem for a while, I decided to compile gammu from source as provided in the gammu website. This solves the problem but not without a few hiccups. This, article describes the actual steps to make to compile gammu with all of its components, with special focus on gammu-smsd, smoothly.

Requisites:

The requisites below must be accomplished in order. Because some of the methods have already been described in the Build a CentOS 7 SMS Gateway with Gammu article, I will no longer detail them here.

  1. CentOS 7 frugal install;
  2. USB tools (lsusb);
  3. Wget utility (wget);
  4. GNU GCC Development Environment;
  5. GCC GCC-C++ NCURSES-DEVEL;
  6. Update the system date and time (Necessary);
  7. Install Optional Packages and Dependencies;
  8. Compile the Gammu source code;
  9. Register the libGammu.7 library;

2 USB tools (lsusb)

[root@lappy ~]# yum install usbutils

3 Wget utility (wget)

[root@lappy ~]# yum install wget

4 GNU GCC Development Environment

[root@lappy ~]# yum groupinstall "Development Tools"

5 GCC GCC-C++ NCURSES-DEVEL

[root@lappy ~]# yum install gcc gcc-c++ ncurses-devel

6 Update the system date and time

This step is extensively detailed in “Synchronize CentOS System Clock with Network Time Protocol (NTP).”

[root@lappy ~]# yum install ntp

Modify the configuration files as described in the aforementioned article.

7 Install Optional Packages and Dependencies

Although gammu can be compiled from source without the optional packages and dependencies, it would lack the connectors to database engines.  This is a critical step.

Specific libraries:

  1. libusb-1_0-devel
  2. libdbi-devel
  3. bluez-devel
  4. postgresql-devel
    mysql-devel
  5. python-devel
  6. libcurl-devel
  7. cmake
  8. pkgconfig
  9. unixODBC-devel
    glib2-devel
  10. libgudev-1_0-devel

[root@lappy ~]# yum install libusb-1_0-devel libdbi-devel bluez-devel postgresql-devel \ mysql-devel python-devel libcurl-devel cmake pkgconfig unixODBC-devel \ glib2-devel libgudev-1_0-devel

The libraries mentioned above are described in detail here.

8 Compile the Gammu source code

The source tarball contains Gammu command line utility, libGammu library and Gammu SMSD.

Gammu stable release 1.37.4
Gammu stable release 1.37.4

Sources:

  1. Gammu website:
    1. gammu-1.37.4.tar.bz2 (2086 KiB)
    2. gammu-1.37.4.tar.gz (2938 KiB)
    3. gammu-1.37.4.tar.xz (1626 KiB)
    4. gammu-1.37.4.zip (3546 KiB)
  2. SamGalope Mirror:
    1. gammu-1.37.4.tar.bz2 (2086 KiB)
    2. gammu-1.37.4.tar.gz (2938 KiB)
    3. gammu-1.37.4.tar.xz (1626 KiB)
    4. gammu-1.37.4.zip (3546 KiB)

#Go into /tmp directory
[root@lappy ~] cd /tmp
.
#Download the Tarball
[root@lappy ~]#wget http://samgalope.com/tarballs/gammu-1.37.4.tar.bz2
.
#Decompress / Extract the Tarball
[root@lappy ~]# bzip2 -dc gammu-1.37.4.tar.bz2 | tar xvf -
.
#Go inside the gammu-1.37.4 directory
[root@lappy ~]# cd gammu-1.37.4
.
#Check all the files
[root@lappy gammu-1.37.4]# ls -al
total 448
drwxr-xr-x. 17 1000 1000 4096 Sep 3 2016 .
drwxrwxrwt. 8 root root 4096 Jan 1 00:01 ..
-rw-r--r--. 1 1000 1000 1237 Aug 16 2016 .travis.yml
-rw-r--r--. 1 1000 1000 74 Aug 16 2016 .weblate
-rw-r--r--. 1 1000 1000 102 Aug 16 2016 AUTHORS
-rw-r--r--. 1 1000 1000 36111 Aug 16 2016 CMakeLists.txt
-rw-r--r--. 1 1000 1000 18092 Aug 16 2016 COPYING
-rw-r--r--. 1 1000 1000 228420 Aug 16 2016 ChangeLog
-rw-r--r--. 1 1000 1000 220 Aug 16 2016 INSTALL
-rw-r--r--. 1 1000 1000 241 Aug 16 2016 INSTALL.cs
-rw-r--r--. 1 1000 1000 226 Aug 16 2016 INSTALL.da
-rw-r--r--. 1 1000 1000 220 Aug 16 2016 INSTALL.en_GB
-rw-r--r--. 1 1000 1000 228 Aug 16 2016 INSTALL.es
-rw-r--r--. 1 1000 1000 207 Aug 16 2016 INSTALL.id
-rw-r--r--. 1 1000 1000 243 Aug 16 2016 INSTALL.it
-rw-r--r--. 1 1000 1000 230 Aug 16 2016 INSTALL.pl
-rw-r--r--. 1 1000 1000 246 Aug 16 2016 INSTALL.pt_BR
-rw-r--r--. 1 1000 1000 2010 Aug 16 2016 Makefile
-rw-r--r--. 1 1000 1000 1592 Aug 16 2016 README.cs
-rw-r--r--. 1 1000 1000 1544 Aug 16 2016 README.da
-rw-r--r--. 1 1000 1000 1717 Aug 16 2016 README.de
-rw-r--r--. 1 1000 1000 1474 Aug 16 2016 README.en_GB
-rw-r--r--. 1 1000 1000 1636 Aug 16 2016 README.es
-rw-r--r--. 1 1000 1000 1577 Aug 16 2016 README.id
-rw-r--r--. 1 1000 1000 1557 Aug 16 2016 README.pl
-rw-r--r--. 1 1000 1000 1619 Aug 16 2016 README.pt_BR
-rw-r--r--. 1 1000 1000 1929 Aug 16 2016 README.rst
drwxr-xr-x. 2 1000 1000 4096 Aug 16 2016 admin
drwxr-xr-x. 18 root root 4096 Sep 3 2016 build-configure
drwxr-xr-x. 3 1000 1000 4096 Aug 16 2016 cmake
-rwxr-xr-x. 1 1000 1000 3639 Aug 16 2016 configure
drwxr-xr-x. 22 1000 1000 4096 Aug 16 2016 contrib
-rw-r--r--. 1 1000 1000 414 Aug 16 2016 description-pak
drwxr-xr-x. 7 1000 1000 67 Aug 16 2016 docs
drwxr-xr-x. 3 1000 1000 4096 Aug 16 2016 gammu
drwxr-xr-x. 2 1000 1000 4096 Aug 16 2016 gammu-detect
-rw-r--r--. 1 1000 1000 11944 Aug 16 2016 gammu.spec
-rw-r--r--. 1 root root 0 Sep 3 2016 gammulog
drwxr-xr-x. 2 1000 1000 4096 Aug 16 2016 helper
drwxr-xr-x. 2 1000 1000 4096 Aug 16 2016 include
drwxr-xr-x. 2 1000 1000 87 Aug 16 2016 installer
drwxr-xr-x. 7 1000 1000 4096 Aug 16 2016 libgammu
drwxr-xr-x. 34 1000 1000 4096 Aug 16 2016 locale
drwxr-xr-x. 4 1000 1000 4096 Aug 16 2016 smsd
drwxr-xr-x. 28 1000 1000 4096 Aug 16 2016 tests
drwxr-xr-x. 2 1000 1000 61 Aug 16 2016 utils
.
#Compile Gammu
[root@lappy gammu-1.37.4] ./configure
[root@lappy gammu-1.37.4] make
[root@lappy gammu-1.37.4] make install

If all steps were followed, this should result to no errors.

9 Register the libGammu.7 library

Ldconfig config file and ldconfig command create the necessary links and cache to the most recent shared libraries found in the directories specified on the command line. The /etc/ld.so.conf file contains lib settings which can be used to add or delete paths. There are two ways to go about this. For one, you can save your config file in /etc/ld.so.conf.d/ directory.  Another, the path can be appended to the main /etc/ld.so.conf file.

This is the last step in the compilation process. Without this step, gammu would be rendered useless — it will not run.
#Append the location of the gammu libraries to /etc/ld.so.conf
[root@lappy gammu-1.37.4] echo "/usr/local/lib64" >> /etc/ld.so.conf
.
#Activate the paths
[root@lappy gammu-1.37.4] ldconfig

That’s it

Gammu is a very nifty tool for interfacing cellular phones or GSM modems to a linux box, in this case CentOS 7. There are a million ways to install it. In this case, the Redhat Package Manager (rpm) is the easiest route. However, the resulting implementation is not fully functional. Thus, the source code is seen as the only and final solution but it also has its hiccups.

I sincerely hope that this article helps those who are trying out Gammu with CentOS 7. I know that when delving into the realm of Linux, things can get pretty discouraging. I have been there. I still am. But we must keep on exploring and learning.

This is for all of us.

Gammu-SMSD: Command Not Found [Solved]

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *