From d9a359cbad6b192c1e58ddb26bde6ebd5de05778 Mon Sep 17 00:00:00 2001
From: Navid Nikaein <navid.nikaein@eurecom.fr>
Date: Mon, 24 Mar 2014 17:54:14 +0000
Subject: [PATCH] *add README and scripts to install hss

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5212 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair-cn/OPENAIRHSS/README                 |  24 ++++
 openair-cn/OPENAIRHSS/scripts/install_hss.sh | 116 +++++++++++++++++++
 2 files changed, 140 insertions(+)
 create mode 100644 openair-cn/OPENAIRHSS/scripts/install_hss.sh

diff --git a/openair-cn/OPENAIRHSS/README b/openair-cn/OPENAIRHSS/README
index e69de29bb2..0e23cc4353 100644
--- a/openair-cn/OPENAIRHSS/README
+++ b/openair-cn/OPENAIRHSS/README
@@ -0,0 +1,24 @@
+Please follow the steps below to install hss:
+
+1) install the hss using the scripts/install_hss.sh 
+2) run autogen.sh
+3) mkdir objs
+4) cd objs; ../configure 
+5) make -j2
+6) make 
+7) sudo apt-get install mysql-client-core-5.5 mysql-server-core-5.5 mysql-server-5.5 phpmyadmin
+   set the password for mysql server
+   open a browser and connet to the phpmyadmin: localhost/phpmyadmin
+   create the oai_db table using database menu
+   select the oai_db and import db/oai_db.sql
+   select the users, and insert the data
+   or mannully use the cmd: sudo mysql -u root -p
+   update the oai_db tables for users,pgw, pdn, and mmeidentity
+   create a new phpmyadmin user, and name it hssadmin, with admin password, grant all the global privilages on DATA as well as create, alter, and index for the structure
+   mysql -u root -p and add the following cmd
+   grant all privileges ON *.* TO 'hssadmin'@'%' WITH GRANT OPTION;	
+   flush privileges;
+8) download and install php-myadmin or lampp from http://www.apachefriends.org/en/xampp-linux.html
+   copy the file in /opt
+   chmod 755 xampp-linux-1.8.2-0-installer.run
+   ./xampp-linux-1.8.2-0-installer.run
\ No newline at end of file
diff --git a/openair-cn/OPENAIRHSS/scripts/install_hss.sh b/openair-cn/OPENAIRHSS/scripts/install_hss.sh
new file mode 100644
index 0000000000..f20791efd5
--- /dev/null
+++ b/openair-cn/OPENAIRHSS/scripts/install_hss.sh
@@ -0,0 +1,116 @@
+# !/bin/sh
+
+CURRENT_PATH=`pwd`
+
+sudo apt-get install autoconf automake gawk cmake make gcc flex bison libsctp1 libsctp-dev libidn2-0-dev \
+libidn11-dev libmysqlclient-dev libxml2-dev swig python-dev cmake-curses-gui \
+valgrind guile-2.0-dev libgmp-dev libgcrypt11-dev gdb unzip libtasn1-3-dev g++ \
+linux-headers-`uname -r` build-essential -y
+
+source ./utils.bash
+
+if [ -f install_log.txt ]
+    then
+    rm -f install_log.txt
+fi
+
+if [ ! -d /usr/local/src/ ]
+    then
+    echo "/usr/local/src/ doesn't exist please create one"
+    exit -1
+fi
+
+if [ ! -w /usr/local/src/ ]
+    then
+    echo "You don't have permissions to write to /usr/local/src/"
+    exit -1
+fi
+
+cd /usr/local/src/
+echo "Downloading nettle archive"
+
+if [ -f nettle-2.5.tar.gz ]
+    then
+    rm -f nettle-2.5.tar.gz
+fi
+if [ -f nettle-2.5.tar ]
+    then
+    rm -f nettle-2.5.tar
+fi
+if [ -d nettle-2.5 ]
+    then
+    rm -rf nettle-2.5/
+fi
+
+wget ftp://ftp.lysator.liu.se/pub/security/lsh/nettle-2.5.tar.gz > install_log.txt
+gunzip nettle-2.5.tar.gz > install_log.txt
+echo "Uncompressing nettle archive"
+tar -xf nettle-2.5.tar
+cd nettle-2.5/
+./configure --disable-openssl --enable-shared --prefix=/usr > install_log.txt
+if [ $? -ne 0 ]
+then
+    exit -1
+fi
+echo "Compiling nettle"
+make -j2 > install_log.txt 2>&1
+make check > install_log.txt
+sudo make install > install_log.txt
+cd ../
+
+echo "Downloading gnutls archive"
+
+if [ -f gnutls-3.1.0.tar.xz ]
+    then
+    rm -f gnutls-3.1.0.tar.xz
+fi
+if [ -d gnutls-3.1.0/ ]
+    then
+    rm -rf gnutls-3.1.0/
+fi
+
+wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/gnutls-3.1.0.tar.xz > install_log.txt
+tar -xf gnutls-3.1.0.tar.xz
+echo "Uncompressing gnutls archive"
+cd gnutls-3.1.0/
+./configure --prefix=/usr
+if [ $? -ne 0 ]
+then
+    exit -1
+fi
+echo "Compiling gnutls"
+make -j2 > install_log.txt 2>&1
+sudo make install > install_log.txt
+cd ../
+
+echo "Downloading freeDiameter archive"
+
+if [ -f 1.1.5.tar.gz ]
+    then
+    rm -f 1.1.5.tar.gz
+fi
+if [ -d freeDiameter-1.1.5/ ]
+    then
+    rm -rf freeDiameter-1.1.5/
+fi
+
+wget http://www.freediameter.net/hg/freeDiameter/archive/1.1.5.tar.gz > install_log.txt
+tar -xzf 1.1.5.tar.gz > install_log.txt
+echo "Uncompressing freeDiameter archive"
+cd freeDiameter-1.1.5
+patch -p1 < $CURRENT_PATH/freediameter-1.1.5.patch > install_log.txt
+mkdir build
+cd build
+cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ../ > install_log.txt
+if [ $? -ne 0 ]
+then
+    exit -1
+fi
+echo "Compiling freeDiameter"
+make -j2 > install_log.txt 2>&1
+#make help
+make test > install_log.txt
+sudo make install > install_log.txt
+
+cd $CURRENT_PATH
+./make_certs.sh
-- 
GitLab