Tag Archives: MySQL

Deploying Joomla 1.5

This howto is based in Debian 5.0.

The first step to install joomla without issues, is install dependencies.

apt-get update && apt-get upgrade

Installing MySQL

apt-get install mysql-server mysql client

Installing Apache & PHP

apt-get install apache2 apache2-doc php5 php5-mysql libapache2-mod-php5

Testing php

vim /var/www/test.php

write this code inside:

<?php phpinfo(); ?>

http://iphost/test.php

Managing database

For maintain our mysql database we’ll use chive.

wget -O – http://launchpad.net/chive/0.4/0.4.0/+download/chive_0.4.0.tar.gz|tar -xzp

http://www.chive-project.com/Wiki/Installation

http://ipaddress/chive and enjoy!!

add mysql extension to php
vim /etc/php5/apache2/php.ini
extension=mysql.so

Add include module in apache
$ a2enmod include

/etc/init.d/apache2 restart

Install bzip2

apt-get install unzip zip

Database

We are going to create database for Joomla

mysql -u root -p

mysql> create database joomla;

Create user CREATE USER 'joomla'@'localhost' IDENTIFIED BY 'opensource';

Adding privileges…

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES  ON joomla.* TO 'joomla'@'localhost' IDENTIFIED BY 'opensource';

Enable Settings…

FLUSH PRIVILEGES;

Download and install Joomla:

cd /var/www
mkdir joomla
cd joomla

wget http://joomlacode.org/gf/download/frsrelease/13105/57240/Joomla_1.5.22-Stable-Full_Package.zip

unzip Joomla_1.5.22-Stable-Full_Package.zip

Permissions

chown -R www-data:www-data /var/www/joomla
find /var/www/joomla -type f -exec chmod 0644 {} \;
find /var/www/joomla -type d -exec chmod 0755 {} \;

Configure
Point your browser http://ipaddress/joomla and follow the steps

Don’t forget to remove the installation folder
rm -rf /var/www/joomla/installation/

See You!!


IAX2 Realtime

In this post I´m going to configure Asterisk iax2 extensions in realtime mode. In this way we don’t have to reload our Asterisk when We have to do any change in our extensions configuration.

1. Configuring extconfig.conf

[settings]

iaxusers => mysql,asterisk,iax_users

iaxpeers => mysql,asterisk,iax_users

2. Creating table

We are going to create the iax table in our asterisk database https://sysbrain.wordpress.com/2009/11/23/asterisk-cdr-in-mysql/

CREATE TABLE iax_users (name varchar(30) primary key NOT NULL, username varchar(30), type varchar(6) NOT NULL, secret varchar(50), md5secret varchar(32), dbsecret varchar(100), notransfer varchar(10), inkeys varchar(100), outkey varchar(100), auth varchar(100), accountcode varchar(100), amaflags varchar(100), callerid varchar(100), context varchar(100), defaultip varchar(15), host varchar(31) NOT NULL default 'dynamic', language char(5), mailbox varchar(50), deny varchar(95), permit varchar(95), qualify varchar(4), disallow varchar(100), allow varchar(100), ipaddr varchar(15), port integer default 0, regseconds integer default 0  );

After this, we have to reload Asterisk to apply the changes.

3. Creating users

We can create users trough MySQL CLI (tricky) or doing it with MySQL graphical tools (the best option).

Example in CLI mode:

INSERT INTO `iax_users` (`id`, `name`, `username`, `type`, `secret`, `md5secret`, `dbsecret`, `notransfer`, `inkeys`, `outkey`, `auth`, `accountcode`, `amaflags`, `callerid`, `context`, `defaultip`, `host`, `language`, `mailbox`, `deny`, `permit`, `qualify`, `disallow`, `allow`, `ipaddr`, `port`, `regseconds`) VALUES (1, ‘1000’, ‘1000’, ‘friend’, ‘1000’, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ‘Javi’, ‘u-moviles’, NULL, ‘dynamic’, NULL, mail@mail.com, NULL, NULL, ‘yes’, ‘all’, ‘gsm’, NULL, 0, 0);

Graphical Mode:

This is the link to download Mysql Gui tools:

http://dev.mysql.com/downloads/gui-tools/5.0.html

It’s not necessary to post a example about create user with MySQL GUI because is very easy to manage tables and add new users.

You’ve to connect to asterisk database trough MySQL Query Browser app, edit iax_users table and insert the same data as in the previous example:

name (1000), username (1000), type (friend), secret(1000), callerid(javi), context(u-moviles), host(dynamic), disallow(all), allow(gsm)

The other fields are optional although I also use the ‘mailbox’ field:

`md5secret`, `dbsecret`, `notransfer`, `inkeys`, `outkey`, `auth`,`accountcode`, `amaflags`, `defaultip`,`language`, `mailbox`, `deny`, `permit` `ipaddr`, `port`, `regseconds`.

In the next Asterisk articles, I´ll post about SIP realtime, voicemail realtime and Microsoft Exchange calendar integration.

That’ s all!



Asterisk CDR in MySQL

Install Mysql Server and MysqlClient

apt-get install php5-mysql mysql-client-5.0 mysql-client libmysqlclient15-dev mysql-server mysql-common

Install Asterisk-Addons

cd /usr/src

wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-1.4.9.tar.gz

tar xvzf asterisk-addons-1.4.9.tar.gz

cd asterisk-addons*

./configure

make menuselect

select:

–> 1. Applications
[*] 1. app_addon_sql_mysql
–> 2. Call Detail Recording
[*] 1. cdr_addon_mysql

make && make install

Create Database

mysql -u root -p

CREATE DATABASE asterisk;

GRANT INSERT
ON asterisk.*
TO asterisk@localhost
IDENTIFIED BY ‘yourpassword’;

USE asterisk;

CREATE TABLE `cdr` (
`calldate` datetime NOT NULL default ‘0000-00-00 00:00:00’,
`clid` varchar(80) NOT NULL default ”,
`src` varchar(80) NOT NULL default ”,
`dst` varchar(80) NOT NULL default ”,
`dcontext` varchar(80) NOT NULL default ”,
`channel` varchar(80) NOT NULL default ”,
`dstchannel` varchar(80) NOT NULL default ”,
`lastapp` varchar(80) NOT NULL default ”,
`lastdata` varchar(80) NOT NULL default ”,
`duration` int(11) NOT NULL default ‘0’,
`billsec` int(11) NOT NULL default ‘0’,
`disposition` varchar(45) NOT NULL default ”,
`amaflags` int(11) NOT NULL default ‘0’,
`accountcode` varchar(20) NOT NULL default ”,
`userfield` varchar(255) NOT NULL default ”
);

ALTER TABLE `cdr` ADD `uniqueid` VARCHAR(32) NOT NULL default ”;
ALTER TABLE `cdr` ADD INDEX ( `calldate` );
ALTER TABLE `cdr` ADD INDEX ( `dst` );
ALTER TABLE `cdr` ADD INDEX ( `accountcode` );

Configure Asterisk CDR Mysql

vim /etc/asterisk/cdr.conf

[general]

enabled=yes

vim /etc/asterisk/cdr_mysql.conf

[global]
hostname=localhost
dbname=asterisk
table=cdr
password=”yourpassword”
user=asterisk
port=3306
;sock=/tmp/mysql.sock
;userfield=1

vim /etc/asterisk/modules.conf

load => cdr_addon_mysql.so

Restarting Asterisk

asterisk -r

CLI> restart when convenient

CLI > asterisk -r

CLI > cdr mysql status
Connected to asterisk@localhost, port 3306 using table cdr for 1 minutes, 28 seconds.
Wrote 0 records since last restart.

This it all..


%d bloggers like this: