Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Thursday, 1 September 2011

Installing and configuring Kannel SMS Gateway


Kannel is an open source SMS and WAP gateway. It's freely available software used by operators, carriers, mobile aggregators and other users to send and receive SMS messages and mobile content.
Further details of Kannel can be found at Kannel's Website . There are many different ways to implement Kannel so it depends what your need is.

A lot of users setup Kannel to connect to HTTP and SMPP providers in order to send SMS messages. In this post I will show how to install, configure and send your first SMS using the gateway

For reference, the user guide can be found at http://www.kannel.com/userguide.shtml

1. Firstly ensure all software requirements are installed and then download the source from the Kannel Download site.

wget http://www.kannel.com/download/1.4.3/gateway-1.4.3.tar.gz

2. Extract the archive file to directory.

tar -xzvf gateway-1.4.3.tar.gz

3. Change to the directory to compile

cd gateway-1.4.3

We want to install to /usr/local so we complete the following steps


./configure  ---prefix=/usr/local/kannel
make
make install

4. Change to the new directory that has been created

cd /usr/local/kannel

5. All the files for kannel are now located in this directory. In order to get Kannel up and running quickly we need to create a new config file.

Refer the the user guide for all parameters available, however the following configuration file is useful for setting up a main 'bearerbox' with an 'smsbox' in which we can send messages to an SMPP carrier.
Substitute fields highlighted with you own details. Example files can also be found in the original source files.

vi kannel.conf

group = core
dlr-storage = internal
admin-port = 13000
admin-password = password
status-password = password
admin-allow-ip = ''
smsbox-port = 13001
log-level = 0
log-file = "/usr/local/kannel/logs/kannel.log"
box-allow-ip = "127.0.0.1"

group = smsbox
smsbox-id = BOX1
bearerbox-host = 127.0.0.1
sendsms-port = 13013
log-file = "usr/local/kannel/logs/smsbox.log"
log-level = 0
access-log = "usr/local/kannel/logs/access.log"

group = sendsms-user
username = user1
password = password1

group = smsc
smsc = smpp
smsc-id = SMSC1
host = 111.111.111.111
port = 12345
smsc-username = my smsc details
smsc-password = my smsc password
address-range = ""
system-type = ""
transceiver-mode = true


6. To start the gateway run the following command

/usr/local/kannel/sbin/bearerbox kannel.conf

ensure kannel.conf is replaced with the full path to you configuration file.

Start the sms box also

/usr/local/kannel/sbin/smsbox kannel.conf

8. You can view the status of the gateway by typing the following in a browser

localhost:13000/status?password=password

7. To test the functionality of the gateway, in a browser send a new sms message to the gateway using the following url:

http://localhost:13013/cgi-bin/sendsms?username=user1&password=password1&to=0123456789&from=4444&text=testmessage


 For further reference, the user guide can be found at http://www.kannel.com/userguide.shtml

Sunday, 2 January 2011

Installing GlassFish application Server cluster on Linux

GlassFish is a Java EE open source application server. The following instructions demonstrate how to install GlassFish 2.1.1 on any Linux platform.

http://glassfish.java.net/javaee5/build/GlassFish_LB_Cluster.html contains full information on downloading and installing glassfish clusters and load balancer plugin.

I am going to explain the steps I took to install glassfish clusters as I didn't require load balance support.

Please note all commands will require elevated privileges.

1. Download binary installer from http://glassfish.java.net/downloads/v2.1.1-final.html 
save to /opt directory.

2. Ensure JAVA_HOME variable is set to JDK directory

3. Within the /opt directory run java -Xmx256m -jar glassfish-installer-v2.1.1-b31g-linux.jar

INSTALLATION COMPLETE is displayed
This UN-bundles glassfish and installs under a new directory 'glassfish'

4. Change to glassfish directory cd glassfish/


5. Change permissions on lib/ant/bin sub directory using chmod -R +x lib/ant/bin


6. Run lib/ant/bin/ant -f setup-cluster.xml . If successful you get BUILD SUCCESSFUL displayed

7. From /opt/glassfish/bin run ./asadmin start-domain domain1 to start to default domain.
Domain [domain1] is running is displayed

8. Browse to http://localhost:8080/ to confirm Enterprise server is now running.

9. Browse to http://localhost:4848/ to access admin console. Default user name and password are username: admin, password: adminadmin . You can change this from the Application Server settings on the web admin interface page.

The server is now running and now we are going to look at creating a one machine cluster.

10. Change to directory /opt/glassfish/samples/quickstart/clusterjsp

Run /opt/glassfish/bin/asant setup-one-machine-cluster

This does the following:

Creates a cluster with name cluster1
Creates a node-agent with name cluster1-nodeagent
Starts the above
Creates two instances under the cluster

You can change these default values under /opt/glassfish/samples/quickstart/clusterjsp/cluster.properties before running

BUILD SUCCESSFUL is displayed

12. Start the cluster using glassfish/bin/asant start_cluster 

BUILD SUCCESSFUL is displayed again


13. View and confirm node with two instances is setup from http://localhost:4848/  select node agent then cluster1-nodeagent on the left pane




If you need to test the two instances you can simply deploy an application in glassfish and browse to the instance using http:localhost:PORT/appname 

If you continue reading the link below you can learn how to use the load balancer plugin and set up Sun Java System Web Server for this.


http://glassfish.java.net/javaee5/build/GlassFish_LB_Cluster.html


http://docs.sun.com/app/docs/doc/821-0186/aboaa?a=view - also a useful link for getting started

Thursday, 9 December 2010

Initial setup and install of PostgreSQL Database and connecting using pgadmin

PostgreSQL is the worlds most advanced open source relational database. PgSQL can be used as a standard database in its own right or can be used to store the data from a number of applications.
In this post I will explain how to install and configure PgSQL. Then go onto to explain how to connect to the data using PGAdmin.


Installing PostgreSQL:

 1. Download source code from http://www.postgresql.org/ftp/source/
2. Extract the downloaded contents: tar -xzvf postgresql-12... .tar.gz
3. ./configure , make, make install. (this may have to be sudo..)
4. create a postgres user : adduser postgres
5. log in as postgres user and initialise the database 
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data


This will initilise the database then you can start it any time using:


/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
or
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l start


6. From in the bin, file create Database: ./createdb test


7. Access Database ./psql test

Use sql commands to add tables / data etc.

\q to quit

You now have a working database you can access.


Access the database from PgAdmin

To access the databases you have from a gui where you can see how the tables are structured and the data within them, pgadmin is a great opensource management tool.

1. Install pgadmin on your local machine by your preferred method, either source or packages. Source downloadable at  http://www.pgadmin.org/download/source.php .
app-get is also an easy install.

2. From the server side configure pg_hba.conf : add trusted hosts. The easiest thing to do is trust local host
host    all         all         192.168.0.0/24        md5


3. Then from your local machine port forward to your server


ssh postgres@serverIP -L 5432:localhost:5432

4. Launch pgadmin, add server. Connect to local host, rather than server IP

5. Manage all postgres databases / tables / data when connected.

Saturday, 4 December 2010

Installing Ejabberd Chat Messaging Server on Linux

Ejabberd is instant messaging server software that can be incorporated into any environment. Basic installation instructions for Unix / Linux are as follows:

1. Install Erlang:

sudo apt-get install erlang.

or from source,

Ensure all requirements are installed, Libncurses and OpenSS. Use apt-get for these.

Erlang:

wget http://www.erlang.org/download/otp_src_R14B.tar.gz
tar -xzvf otp_src_R14B.tar.gz
cd otp_src_R14B.tar.gz
LANG=C; export LANG 

./configure
make
make install 

Verify installation, type erl 
The following should be displayed:  

Erlang R14B (erts-5.8) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]

Eshell V5.8  (abort with ^G)
1>
 

2.  Install Ejabberd:

debian package: 
apt-get install ejabberd

binary installer:

wget http://www.process-one.net/downloads/ejabberd/2.1.6/ejabberd-2.1.6-linux-x86_64-installer.bin.gz

gunzip ejabberd-2.1.6-linux-x86_64-installer.bin.gz
chmod a+x ejabberd-2.1.6-linux-x86_64-installer.bin.gz
./ejabberd-2.1.6-linux-x86_64-installer.bin 


Accept all default options, installation complete



or from source:

wget http://www.process-one.net/downloads/ejabberd/2.1.5/ejabberd-2.1.5.tar.gz
tar -xzvf ejabberd-2.1.5.tar.gz
cd ejabberd-2.1.5/src
./configure
make
make install

/bin/ejabberd.cfg to specify settings




Use ejabberdctl start to start node instance.

Browse to http://localhost:5280/admin/ for server web admin, you will need to add exception for user admin to browse to web admin page.

Enter the following in /bin/ejabberd.cfg:

{acl, admin, {user, "admin_user", "your_sever"}}.


N.B ejabberd uses an internal Mnesia database by default. But it possible to an alternative relational database or LDAP server to ensure data is persistent.

In later posts I will discuss using a PostgreSQL database to store data for various applications such as ejabberd.

Refer to Ejabberd installation and operation guide