Skip to content
tenzap edited this page Mar 6, 2022 · 12 revisions

Be sure to meet all requirements

Especially, be sure you have already setup the Gammu SMSD database. If you haven't yet, this howto will guide you.

Kalkun uses the database that is created by gammu with all the tables created by gammy. Kalkun then adds supplementary tables and some columns to the gammu tables. So there is no such case where one has a gammu database separate from the kalkun database. Both software share the same database.

Get the source code of Kalkun

Download and extract the latest release or tag to your web root folder.

If you run Debian or Ubuntu or any related distribution, there is a kalkun debian package: installation procedure for Debian package. Then jump to Configure the connection to the database

Get the third party php libraries

For this we use Composer which must be installed on your system. From the root dir of kalkun, run:

composer install

Configure Daemon & outbox_queue scripts

The "daemon" task is to manage inbox and autoreply. It is called by php-cli whenever new messages arrive.

  • This is done by setting the value of the runonreceive directive in the gammu-smsd configuration file (smsdrc). On Debian/Ubuntu systems you will find it at /etc/gammu-smsdrc

    ⚠️ Important: You must configure the "daemon" otherwise you will not see the messages in your inbox.

    • For example on Unix (using shell script):
    [smsd]
    runonreceive = /var/www/html/kalkun/scripts/daemon.sh
    
    • Or if you use Windows (using batch file):
    [smsd]
    runonreceive = C:\xampp\htdocs\kalkun\scripts\daemon.bat
    

    ⚠️ Warning: It always a good idea to move the scripts directory outside the www, so it’s not accessible from browser.

  • Set correct path (to php-cli and daemon.php) on daemon.sh or daemon.bat:

    # Configure this (use absolute path)
    PHP=/usr/bin/php # php cli path
    DAEMON=/path/to/kalkun/scripts/daemon.php # daemon.php path
  • Set correct path (to php-cli and outbox_queue.php) on outbox_queue.sh or outbox_queue.bat:

    # Configure this (use absolute path)
    PHP=/usr/bin/php # php cli path
    DAEMON=/path/to/kalkun/scripts/outbox_queue.php # outbox_queue.php path
  • Make sure that the daemon & outbox_queue scripts are executable.

    sudo chmod +x daemon.php daemon.sh daemon.bat
  • Change URI path in daemon.php and outbox_queue.sh. Default is:

    // Please configure this
    $url = "http://localhost/kalkun";

Troubleshooting:

If somehow gammu-smsd fails to run the daemon script, it will throw an error like this:

gammu-smsd[3665]: Process failed with exit status 126

Check permission and try to run the script manually.

Increase the security of your installation

Although not mandatory, this is highly recommended. See Increase setup security.

Configure the connection to the database

Edit database.php located at application/config/database.php, you should see this line:

Set the correct value for the database you wish to use (here the example is with MySQL)

$active_group = 'kalkun_mysql';

Set the correction value at least for the database name, username & password fields:

$db['kalkun_mysql'] = array(
//...
	'username' => 'root',
	'password' => 'password',
	'database' => 'kalkun',
//...

Launch the installer

If you are upgrading:

  • proceed with a backup of your database.
  • be sure that you have a file called install next to the install.php file. Its presence will permit to enter the installer.

Now, you can launch the installer by opening your browser and going to http://localhost/kalkun. You will be redirected to http://localhost/kalkun/index.php/install (if not, place a file named install next to index.php) and you will see the installation wizard there. The wizard will guide you to complete the installation, it should be easy.

This is the recommended way as it will automatically set-up and update the database whether this is a fresh install or an upgrade from a previous version of Kalkun.

ℹ️ Note: You may proceed with a manual DB install by injecting the SQL script application/sql/DBENGINE/kalkun.sql into your DB, but only in the case of a fresh kalkun install. Don't do this if you upgrade, you will mess things up in your database.

Delete install file

At the end of installation wizard, if it tells to do so, you must delete the install file yourself. It is likely the webserver hasn't the right to write to the directory. If you don't do so, you will be redirected to the begining of the installation wizard again. (Note: the installation wizard tries to do this automatically, but may fail due to lack of permission. Then you must delete it manually).

Change the default encryption key

  • To improve security, it's higly recommended to change the default encryption_key in application/config/config.php. See setting your encryption key.
  • On unix/linux you may run
php -r 'echo bin2hex(random_bytes(16)), "\n";'

Write the value in application/config/config.php and enclose it in a call to hex2bin() function. For example:

$config['encryption_key'] = hex2bin('32_CHAR_LONG_ENC_KEY');

Setup timezone

Before you run kalkun, you should check the timezone of your PHP server is setup correctly. To do so, run

php -r 'echo date_default_timezone_get()."\n";'

If the timezone is not correct the time will be shown incorrectly in Kalkun and it is likely your SMS will never be delivered.

Launch Kalkun

Open up your browser and go to http://localhost/kalkun

Default account for the Web Interface (you can change it after you login):

  • username = kalkun
  • password = kalkun

You should change the password after login for security issue.


Debian and related

You are lucky, the Debian package maintainer did part of the configuration & setup job for you.

Maybe there is a deb package in the latest release or tag. Otherwise they are build on every commit.

  1. You can download the latest binaries & source packages in deb format on the github actions page:
    1. go to https://github.com/kalkun-sms/Kalkun/actions?query=workflow%3APackaging++
    2. filter the branch you wish to have the packages for
    3. click on the header of the 1st workflow to get the most recent
    4. download the "Debian packages" artifact
    5. The archive also contains some dependencies that you may need if your distribution doesn't ship them.
    6. Command to install kalkun core only and the dependencies would be:
    apt install \
      ./php-*.deb \
      ./kalkun_*.deb
    1. Optionally, you may install plugins.
    apt install ./kalkun-plugins*.deb
  2. Continue the installation instructions from Configure the connection to the database
  3. You may also read the README.Debian at /usr/share/doc/kalkun/
Clone this wiki locally