Hiển thị các bài đăng có nhãn ubuntu 12.04. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn ubuntu 12.04. Hiển thị tất cả bài đăng

Chủ Nhật, 2 tháng 3, 2014

HOW-TO: set up Java environment on Ubuntu.

Hi all,
I am kind of big moving from Windows to Ubuntu including infrastructures, softwares, and even cultures. However, I still use both Windows and Linux. I cannot live isolated with surrounding Windows machine around me in labs even my laptop. Windows are simple and convenient for normal users, but Ubuntu is just great for developers.
I definitely love Eclipse. In this blog, we provide some guide to start Java life in Ubuntu. C/C++ life in Ubuntu are great and simple. I supposed that Java life is also simple across different OSs.
First, you need to install Java Development Kit (JDK) which includes Java Runtime Environments (JRE). Going to Oracle and download the newest jdk1.7 [1]. For example, I downloaded jdk1.7.0_51. Then I untar it.
tar xzf jdk-7u51-linux-x64.gz
 As a admin user, you can add or change these two lines in your /etc/profile to point to the installation and it will affect system-wide. OR as a normal user, you can export an environment variable in ~ /.profile. Where JAVA_HOME is the place you just untar your jdk, for instance, /home/tranlaman/Downloads/jdk1.7.0_51.
export JAVA_HOME=/home/tranlaman/Downloads/jdk1.7.0_51
export PATH=$PATH:$JAVA_HOME/bin
 Then, you log out and in again to see effect of the environment variables. After that, you download and install Eclipse from [2].
Further, if you want to install C/C++ plugin in Eclipse to develop C/C++ programs, you can follow this instruction. Go to Help/Install New Softwares, then add the C/C++ Development Toolkit (CDT) link in the box as http://download.eclipse.org/tools/cdt/releases/kepler.
You can replace kepler as the version of Eclipse. Then press Enter.

[1] http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
[2] https://www.eclipse.org/downloads/


Thứ Bảy, 15 tháng 6, 2013

Question: Where does my program reside if I install a program in Ubuntu?

Answer:
Normally, it would go to /usr/local. In /usr/local, you would have subdirectories such as /bin, /etc, /lib, /share, /src. These sub-folders contain appropriate files depending on the type of program that you want to install.

Thứ Tư, 20 tháng 6, 2012

HOW-TO: Manually Installing Mediaproxy 2.5 on Ubuntu 12.04 server 64 bits


      Media-proxy is a media relay for RTP/RTCP and UDP streams that works in tandem with OpenSIPS to provide NAT traversal capability for media streams from SIP user agents located behind NAT. Mediaproxy supports ICE negotiation by behaving like a TURN relay candidate and the policy can be controlled from OpenSIPS configuration.
       Mediaproxy 2 is a Python project from AG-projects which is consisted of  (at least) two components: A dispatcher and a relay.
       For more details, please skim at http://mediaproxy.ag-projects.com/
       If you want to install Mediaproxy by a Debian repository, you can refer to http://mediaproxy.ag-projects.com/projects/mediaproxy/wiki/InstallationGuide.
       There are many installation guide found on Internet such as
       But none of it is perfect for my case, Ubuntu server 12.04 64 bits, I tried to search on Google for solution and had this hand-on experience. This article is aimed to provide good example for installing Mediaproxy in Ubuntu server 64 bits. Try to do it step by step,  do it smoothly you need some knowledge about basic GNU installation and python installation.

Install kernel support
#apt-get install iptables
#apt-get install gcc
#apt-get install g++

Development libraries and headers for some existing packages
#apt-get install libgpg-error-dev
#apt-get install python-dev

Install Linux libnetfilter_conntrack
Libnfnetlink
Suggestion version: libnfnetlink-1.0.0.tar.bz2
Unzip #tar xvjf libnfnetlink-1.0.0.tar.bz2
Change to the sub-directory created when you unzipped the tarball: #cd libnfnetlink-1.0.0/
#./configure
#make
#make install

libnfnetlink-dev
#apt-get install libnfnetlink-dev

libnetfilter_conntrack
Similarly, we do the same thing with previous one.
libnetfilter_conntrack-dev
#apt-get install libnetfilter-conntrack-dev


Install Python 3.2.3
Install the new release of Python from the URL.
#tar -xf Python-3.2.3.tgz
#./configure
#make

Install some Python packages
Ctypes
Suggested version: ctypes-1.0.2.tar.gz
#wget http://downloads.sourceforge.net/project/ctypes/ctypes/1.0.2/ctypes-1.0.2.tar.gz
Unzip: #tar -xvzf ctypes-1.0.2.tar.gz
Change to the sub-directory created when you unzipped the tarball:
#cd ctypes-1.0.2/
Build and install the library:
./setup.py build
./setup.py install

Python-application
Suggested version: python-application-1.3.1.tar.gz
#wget http://pypi.python.org/packages/source/p/python-application/python-application-1.3.1.tar.gz#md5=615d670fcda2aa5a01de7bc12baa1fdf
Unzip: #tar -xvzf python-application-1.3.1.tar.gz
Change to the sub-directory created when you unzipped the tarball:
#cd python-application-1.3.1/
Build and install the library:
./setup.py build
./setup.py install

Python-cjson
Suggested version: python-cjson-1.0.5.tar.gz
#wget http://pypi.python.org/packages/source/p/python-cjson/python-cjson-1.0.5.tar.gz#md5=4d55b66ecdf0300313af9d030d9644a3
Unzip: #tar -xvzf python-cjson-1.0.5.tar.gz
Change to the sub-directory created when you unzipped the tarball:
#cd python-cjson-1.0.5/
Build and install the library:
#./setup.py build
#./setup.py install


Python-gnutls
Suggested version: python-gnutls-1.2.4.tar.gz
#wget http://pypi.python.org/packages/source/p/python-gnutls/python-gnutls-1.2.4.tar.gz#md5=e3536c421291a791869d875a41dcb26a
Unzip: #tar -xvzf python-gnutls-1.2.4.tar.gz
Change to the sub-directory created when you unzipped the tarball:
#cd python-gnutls-1.2.4/
Build and install the library:
#./setup.py build
#./setup.py install
Install Python-Zope Interface
Similarly, we do install this package from this url:
#wget http://old.zope.org/Products/ZopeInterface/3.3.0/zope.interface-3.3.0.tar.gz



Install Twisted
#wget http://pypi.python.org/packages/source/T/Twisted/Twisted-12.1.0.tar.bz2#md5=f396f1d6f5321e869c2f89b2196a9eb5
Install both of them similarly with other installation.

Install libgcrypt, gmp and gnutls from source tarball
In order to escape some unnecessary when installing media-proxy, you should install libgcrypt from source, albeit you can do in apt-get.
Libgcrypt
Suggested version: libgcrypt-1.5.0.tar.bz2
Unzip: #tar -xvjf libgcrypt-1.5.0.tar.bz2
Change to the sub-directory created when you unzipped the tarball:
#cd libgcrypt-1.5.0/
Build and install the library:
./configure --libdir=/usr/local/lib
make
make install

Gmp
Before installing nettle, you must install GMP. If you accidently install nettle previously, please install gmp first and then reinstall nettle.
Suggested version: gmp-5.0.5.tar.bz2
#wget  ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.5.tar.bz2
And don’t forget .sig file for untar: #wget ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2.sig
Unzip: #tar -xvjf gmp-5.0.5.tar.bz2
Change to the sub-directory created when you unzipped the tarball:
#cd gmp-5.0.5/
Build and install the library:
./configure
make
make install

Install nettle
Suggested version: nettle-2.4.tar.gz
#wget  http://www.lysator.liu.se/~nisse/archive/nettle-2.4.tar.gz
Unzip: #tar -xvzf nettle-2.4.tar.gz
Change to the sub-directory created when you unzipped the tarball:
#cd nettle-2.4/
Build and install the library:
./configure
make
make install

Install zlib

Install p11-kit


Then install gnutls
Suggested version: gnutls-3.0.9.tar.xz
#wget  ftp://ftp.gnu.org/gnu/gnutls/gnutls-3.0.9.tar.xz
And don’t forget .sig file for untar: #wget ftp://ftp.gnu.org/gnu/gnutls/gnutls-3.0.9.tar.xz.sig
Unzip: #tar -xvzf gnutls-3.0.9.tar.xz
Change to the sub-directory created when you unzipped the tarball:
#cd gnutls-3.0.9/
Build and install the library:
./configure --with-included-libtasn1 --libdir=/usr/local/lib
make
make install

Manually copy some run-time libraries to /usr/lib
Copy the following dynamic libraries from /usr/local/lib to /usr/lib
libgcrypt.so.11.7.0 (only if you installed from source)
libgnutls.so.27
libgnutls.so.27.0.1
libgnutls-openssl.so.27
libgnutls-openssl.so.27.0.1


For the RADIUS accounting module


Mediaproxy 2
Suggested version: mediaproxy-2.5.2.tar.gz
#wget http://download.ag-projects.com/MediaProxy/mediaproxy-2.5.2.tar.gz
Suggested location to copy and then unzip the tarball: /usr/local
Unzip: #tar -xzf mediaproxy-2.5.2.tar.gz
Change to the sub-directory created when you unzipped the tarball
Build and install the library (system wide):
./setup.py build
./setup.py install

Enable IP Forwarding by making changes in /etc/sysctl.conf file... 
Permanently enable ip forwarding,,,
# gedit /etc/sysctl.conf &
...

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

Then, try these commands
# echo 1 > /proc/sys/net/ipv4/ip_forward
# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

Make directory, copy necessary files to proper directories, and setup ownership:
#mkdir /var/run/mediaproxy
#cp config.ini.sample /etc/mediaproxy/config.ini
#cp tls/* /etc/mediaproxy/tls/
Config.ini
OpenSIPS+MediaProxy Integration:
# mkdir /var/run/mediaproxy
# gedit config.ini &

Make following changes in file...
Change IP address according to your server.

[Relay]
dispatchers = mydomain.net:5060 _sip._udp.mydomain.net
port_range = 50000:60000
log_level = DEBUG
on_hold_timeout = 1800

[Dispatcher]
listen = 10.1.10.205:50000
management_use_tls = no
log_level = DEBUG
accounting = radius

[Radius]
; This section needs to be configured if radius accounting is enabled
; OpenSIPS RADIUS configuration file. All RADIUS cofiguration parameters will
; be read from this file, including dictionary files.
;
;config_file = /etc/opensips/radius/client.conf
config_file = /etc/freeradius/clients.conf

; Additional dictionary file with MediaProxy specific attributes.
;additional_dictionary = radius/dictionary
additional_dictionary = /etc/freeradius/dictionary

[OpenSIPS]
socket_path = '/var/run/opensips/socket'


Now edit opensips.cfg file to include MediaProxy...
#
# ----- nat_traversal
#**
loadmodule "nat_traversal.so"
#**
modparam("nat_traversal", "keepalive_interval", 90)
modparam("nat_traversal", "keepalive_method", "OPTIONS")
modparam("nat_traversal", "keepalive_from", "sip:keepalive@mydomain.com")


#
# --> nathelper
#**
loadmodule "nathelper.so"
#**
modparam("nathelper", "natping_interval", 60)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", 7)
modparam("nathelper", "received_avp", "$avp(i:801)")
modparam("nathelper", "sipping_from", "sip:pinger@mydomain.com")

#
#**
loadmodule "mediaproxy.so"
#**
#--------------- Default Values
modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy/dispatcher.sock")
modparam("mediaproxy", "mediaproxy_timeout", 500)
modparam("mediaproxy", "signaling_ip_avp", "$avp(s:nat_ip)")
modparam("mediaproxy", "media_relay_avp", "$avp(s:media_relay)")

#--------------- Main Routing Logic

#

Starting MediaProxy Dispatcher...
#./media-dispatcher --no-fork
#./media-dispatcher &

The most notorious error I have met: “Libnettle 2.4 was not found” although nettle was installed.
Solution: This is because I did not install GMP before install Nettle, so Nettle did not create libhogweed for gnutls installing progress.