Skip to content

Instantly share code, notes, and snippets.

@parsibox
Last active May 12, 2024 20:29
Show Gist options
  • Save parsibox/e5cf0ee4bffe2bf5f215668e52294952 to your computer and use it in GitHub Desktop.
Save parsibox/e5cf0ee4bffe2bf5f215668e52294952 to your computer and use it in GitHub Desktop.
install kannel on centos 7
yum install -y openssl-devel libxml2-devel texlive-* m4 gcc-c++ make
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
yum install -y mysql-devel
https://blog.onesconsultants.com/2018/08/how-to-install-kannel-in-centos-7.html
need bison ==2.7
mkdir /var/www/
mkdir /var/www/kannel
cd /var/www/kannel
wget https://ftp.gnu.org/gnu/bison/bison-2.7.tar.gz
tar zxvf bison-2.7.tar.gz && cd bison-2.7 && ./configure && make && make install && cd src
rm -rf /usr/local/bin/bison
rm -rf /usr/bin/bison
cp bison /usr/local/bin/bison && cp bison /usr/bin/bison
cd .. && cd .. && rm -rf bison-2.7.tar.gz bison-2.7
cd /var/www/kannel
wget --no-check-certificate https://www.kannel.org/download/1.4.5/gateway-1.4.5.zip
unzip gateway-1.4.5.zip
rm -rf gateway-1.4.5.zip
mv gateway-1.4.5 gateway
cd gateway/
./configure --enable-localtime --prefix=/var/www/kannel --with-mysql --with-mysql-dir=/usr/lib/mysql/ --enable-debug --enable-assertions --with-defaults=speed --disable-localtime --enable-start-stop-daemon --enable-pam
sudo make
sudo make install
sudo mkdir /var/www/kannel/logs
mysql -uroot -p kannel < /var/www/kannel/kannel.sql
@innovativevijay
Copy link

mysql -uroot -p kannel < /var/www/kannel/kannel.sql

Giving this error bash: /var/www/kannel/kannel.sql: No such file or directory

@parsibox
Copy link
Author

parsibox commented Nov 7, 2023

mysql -uroot -p kannel < /var/www/kannel/kannel.sql

Giving this error bash: /var/www/kannel/kannel.sql: No such file or directory

DROP TABLE IF EXISTS dlr;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/
!40101 SET character_set_client = utf8 /;
CREATE TABLE dlr (
id bigint(20) NOT NULL AUTO_INCREMENT,
datetime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
smsc varchar(40) DEFAULT NULL,
ts varchar(40) DEFAULT NULL,
destination varchar(40) DEFAULT NULL,
source varchar(40) DEFAULT NULL,
service varchar(40) DEFAULT NULL,
url varchar(255) DEFAULT NULL,
mask int(10) DEFAULT NULL,
status int(10) DEFAULT NULL,
boxc varchar(40) DEFAULT NULL,
time bigint(20) NOT NULL,
smsc_id varchar(40) NOT NULL,
sms_id bigint(20) NOT NULL,
msgdata text NOT NULL,
number text NOT NULL,
message text NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=443 DEFAULT CHARSET=latin1;
/
!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table dlr

LOCK TABLES dlr WRITE;
/*!40000 ALTER TABLE dlr DISABLE KEYS /;
/
!40000 ALTER TABLE dlr ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table dlr2

DROP TABLE IF EXISTS dlr2;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/
!40101 SET character_set_client = utf8 /;
CREATE TABLE dlr2 (
id_sms bigint(20) NOT NULL AUTO_INCREMENT,
smsc varchar(40) DEFAULT NULL,
msgid text NOT NULL,
destination varchar(40) DEFAULT NULL,
sendertype text,
url varchar(255) DEFAULT NULL,
mask int(10) DEFAULT NULL,
status text,
boxc varchar(40) DEFAULT NULL,
sms_insert_date timestamp NULL DEFAULT CURRENT_TIMESTAMP,
sms_delivery_date timestamp NULL DEFAULT NULL,
sms_message text NOT NULL,
status2 text NOT NULL,
PRIMARY KEY (id_sms)
) ENGINE=InnoDB AUTO_INCREMENT=293 DEFAULT CHARSET=latin1;
/
!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table dlr2

LOCK TABLES dlr2 WRITE;
/*!40000 ALTER TABLE dlr2 DISABLE KEYS /;
/
!40000 ALTER TABLE dlr2 ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table send_sms

DROP TABLE IF EXISTS send_sms;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/
!40101 SET character_set_client = utf8 /;
CREATE TABLE send_sms (
sql_id bigint(20) NOT NULL AUTO_INCREMENT,
momt enum('MO','MT') DEFAULT NULL,
sender varchar(20) DEFAULT NULL,
receiver varchar(20) DEFAULT NULL,
udhdata blob,
msgdata text CHARACTER SET utf8,
time bigint(20) DEFAULT NULL,
smsc_id varchar(255) DEFAULT NULL,
service varchar(255) DEFAULT NULL,
account varchar(255) DEFAULT NULL,
id bigint(20) DEFAULT NULL,
sms_type bigint(20) DEFAULT NULL,
mclass bigint(20) DEFAULT NULL,
mwi bigint(20) DEFAULT NULL,
coding bigint(20) DEFAULT NULL,
compress bigint(20) DEFAULT NULL,
validity bigint(20) DEFAULT NULL,
deferred bigint(20) DEFAULT NULL,
dlr_mask bigint(20) DEFAULT NULL,
dlr_url varchar(255) DEFAULT NULL,
pid bigint(20) DEFAULT NULL,
alt_dcs bigint(20) DEFAULT NULL,
rpi bigint(20) DEFAULT NULL,
charset varchar(255) CHARACTER SET utf8 DEFAULT NULL,
boxc_id varchar(255) DEFAULT NULL,
binfo varchar(255) DEFAULT NULL,
meta_data text,
status varchar(10) DEFAULT NULL,
PRIMARY KEY (sql_id)
) ENGINE=MyISAM AUTO_INCREMENT=782 DEFAULT CHARSET=latin1;
/
!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table send_sms

LOCK TABLES send_sms WRITE;
/*!40000 ALTER TABLE send_sms DISABLE KEYS /;
/
!40000 ALTER TABLE send_sms ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table sent_sms

DROP TABLE IF EXISTS sent_sms;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/
!40101 SET character_set_client = utf8 /;
CREATE TABLE sent_sms (
sql_id bigint(20) NOT NULL AUTO_INCREMENT,
datetime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
momt enum('MO','MT','DLR') DEFAULT NULL,
sender varchar(20) DEFAULT NULL,
receiver varchar(20) DEFAULT NULL,
udhdata blob,
msgdata text,
smsc_id varchar(255) DEFAULT NULL,
service varchar(255) DEFAULT NULL,
account varchar(255) DEFAULT NULL,
id bigint(20) DEFAULT NULL,
sms_type bigint(20) DEFAULT NULL,
mclass bigint(20) DEFAULT NULL,
mwi bigint(20) DEFAULT NULL,
coding bigint(20) DEFAULT NULL,
compress bigint(20) DEFAULT NULL,
validity bigint(20) DEFAULT NULL,
deferred bigint(20) DEFAULT NULL,
dlr_mask bigint(20) DEFAULT NULL,
dlr_url varchar(255) DEFAULT NULL,
pid bigint(20) DEFAULT NULL,
alt_dcs bigint(20) DEFAULT NULL,
rpi bigint(20) DEFAULT NULL,
charset varchar(255) DEFAULT NULL,
boxc_id varchar(255) DEFAULT NULL,
binfo varchar(255) DEFAULT NULL,
status text,
time bigint(20) DEFAULT NULL,
PRIMARY KEY (sql_id),
KEY ix_sent_sms_dlr_url (dlr_url)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/
!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table sent_sms

LOCK TABLES sent_sms WRITE;
/*!40000 ALTER TABLE sent_sms DISABLE KEYS /;
/
!40000 ALTER TABLE sent_sms ENABLE KEYS */;
UNLOCK TABLES;

DELIMITER ;;
/!50003 CREATE/ /*!50017 / /!50003 TRIGGER after_sent_sms_insert AFTER INSERT ON sent_sms
FOR EACH ROW BEGIN
UPDATE snd SET zaibstatus = 'Submitted to sqlbox' WHERE snd_id = NEW.dlr_url;

IF NEW.momt = 'DLR' THEN
CASE NEW.dlr_mask
WHEN 1 THEN UPDATE snd SET snd_success = FROM_UNIXTIME(NEW.time) , zaibstatus = 'SUCCESS' WHERE snd_id = NEW.dlr_url;
WHEN 2 THEN UPDATE snd SET snd_failure = FROM_UNIXTIME(NEW.time) , zaibstatus = 'FAILED wrong no' WHERE snd_id = NEW.dlr_url;
WHEN 4 THEN UPDATE snd SET snd_buffered = FROM_UNIXTIME(NEW.time) WHERE snd_id = NEW.dlr_url;
WHEN 8 THEN UPDATE snd SET snd_submitted = FROM_UNIXTIME(NEW.time) , zaibstatus = 'Pending' WHERE snd_id = NEW.dlr_url;
WHEN 16 THEN UPDATE snd SET snd_rejected = FROM_UNIXTIME(NEW.time) WHERE snd_id = NEW.dlr_url;
WHEN 32 THEN UPDATE snd SET snd_intermediate = FROM_UNIXTIME(NEW.time) WHERE snd_id = NEW.dlr_url;
ELSE UPDATE snd SET snd_last = NEW.dlr_mask WHERE snd_id = NEW.dlr_url;
END CASE;
END IF;
END */;;
DELIMITER ;

--
-- Table structure for table snd

DROP TABLE IF EXISTS snd;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/
!40101 SET character_set_client = utf8 /;
CREATE TABLE snd (
snd_id bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Every message has a unique id',
snd_sender varchar(255) DEFAULT NULL COMMENT 'The number that the message is sent from',
snd_to varchar(255) DEFAULT NULL COMMENT 'The number that the message is sent to',
snd_txt longtext COMMENT 'The body text of the message',
snd_smsc varchar(255) DEFAULT NULL COMMENT 'The number that the message is route to',
snd_sentat timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'The time that the message is inserted',
snd_success datetime DEFAULT NULL COMMENT 'The time that the message was delivered to the hand set',
snd_failure datetime DEFAULT NULL COMMENT 'The time that the message failed',
snd_submitted datetime DEFAULT NULL COMMENT 'The time that the message is submitted to the smsc',
snd_buffered datetime DEFAULT NULL COMMENT 'The time that the message is buffered at the smsc',
snd_rejected datetime DEFAULT NULL COMMENT 'The time that the message was rejected',
snd_intermediate datetime DEFAULT NULL COMMENT 'Time of intermediate status',
snd_last int(11) NOT NULL DEFAULT '0',
zaibstatus text,
PRIMARY KEY (snd_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table holds the messages that are sent, including DLR values.';
/
!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table snd

LOCK TABLES snd WRITE;
/*!40000 ALTER TABLE snd DISABLE KEYS /;
/
!40000 ALTER TABLE snd ENABLE KEYS */;
UNLOCK TABLES;

DELIMITER ;;
/!50003 CREATE/ /*!50017 / /!50003 TRIGGER after_snd_insert AFTER INSERT ON snd
FOR EACH ROW BEGIN
INSERT INTO send_sms (momt, sender, receiver, msgdata, smsc_id, sms_type, dlr_mask, dlr_url, boxc_id, coding)
VALUES ('MT', NEW.snd_sender, NEW.snd_to, NEW.snd_txt, NEW.snd_smsc, 2, 31, NEW.snd_id, 'sqlbox', '2');
END */;;
DELIMITER ;

@innovativevijay
Copy link

./configure --enable-localtime --prefix=/usr/local/gateway-1.4.5 --with-mysql --with-mysql-dir=/usr/lib/mysql/ --enable-debug --enable-assertions --with-defaults=speed --disable-localtime --enable-start-stop-daemon --enable-pam

Getting This error :
Configuring DB support ...
checking whether to compile with MySQL support... searching
checking for mysql_config... no
checking for MySQL client support in... /usr
checking for "/usr/include/mysql/mysql.h"... no
checking for "/usr/include/mysql.h"... no
checking for MySQL client support in... /usr/local
checking for "/usr/local/include/mysql/mysql.h"... no
checking for "/usr/local/include/mysql.h"... no
configure: error: Unable to find mysql.h, please provide a --with-mysql-dir=

location

@parsibox
Copy link
Author

you did not install mysql-devel

./configure --enable-localtime --prefix=/usr/local/gateway-1.4.5 --with-mysql --with-mysql-dir=/usr/lib/mysql/ --enable-debug --enable-assertions --with-defaults=speed --disable-localtime --enable-start-stop-daemon --enable-pam

Getting This error : Configuring DB support ... checking whether to compile with MySQL support... searching checking for mysql_config... no checking for MySQL client support in... /usr checking for "/usr/include/mysql/mysql.h"... no checking for "/usr/include/mysql.h"... no checking for MySQL client support in... /usr/local checking for "/usr/local/include/mysql/mysql.h"... no checking for "/usr/local/include/mysql.h"... no configure: error: Unable to find mysql.h, please provide a --with-mysql-dir=

location

you did not install mysql-devel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment