2014年12月11日星期四

Linux下执行脚本导出mysql表数据

mysql -uroot -ppassword asteriskcdrdb -e "select * from cdr" > b.txt
连接上mysql,使用root,password登录 asteriskcdrdb数据库,
执行select *from cdr并将数据内容输出至b.txt

2014年2月8日星期六

ubuntu 13.04 linphone enable g729

My HP 8540W installed Ubuntu 13.04, I want to install voip softphone, the first choice is Ekiga. After installed Ekiga, There was not G729 codec, so I give up.
The second choice is linphone,  serach in google, somebody saies install the linphone use ppa,  g729 can use.
Now, this is the step by step
1.add linphone source
sudo add-apt-repository ppa:linphone/release
2.updae the source
sudo apt-get update
3.install linphone
sudo apt-get install linphone
4.config the linphone
Open the Option menu -  preferences -  codecs, G729 was not in the codecs list,  but AMR in the list.
5.find out the difference between G729 and AMR
dpkg -L linphone-plugin-amr
the libmsamr.so model in this directory /usr/lib/mediastreamer/plugins
dpkg -L linphone-plugin-g729
the libmsbcg729.so model in this directory /usr/lib/x86_64-linux-gnu/mediastreamer/plugins/

6.copy the model to /usr/lib/mediastreamer/plugins
sudo cp -d /usr/lib/x86_64-linux-gnu/mediastreamer/plugins/libmsbcg729.*  usr/lib/mediastreamer/plugins

that's right! Now G729 in the codecs list, enjoy it


2014年1月24日星期五

eclipse sqlexplorer 配置

Install eclipas
HowTO
http://tutorialforlinux.com/2013/09/27/how-to-install-eclipse-ide-for-java-developers-ubuntu-13-04-raring13-10-saucy/
download eclipse from this sit
http://www.eclipse.org/downloads/

extract eclips package
sudo mv eclipse /opt
ln -s /opt/eclipse/eclipse /usr/local/bin/eclipse

Install JDK
HowTo
http://tutorialforlinux.com/2013/10/23/how-to-install-oracle-java-jdk7-on-ubuntu-13-10-saucy-i386amd64-easy-visual-guide/
download Oracle jave JDK from this site
http://www.oracle.com/technetwork/java/javase/downloads/index.html

extract JDK package

relocate JDK7
sudo su
if [ ! -d '/usr/lib/jvm' ]; then mkdir /usr/lib/jvm; fi
mv /tmp/jdk1.7* /usr/lib/jvm/

update system java to oracle JDK
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7*/bin/java 1065
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7*/bin/javac 1065
update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7*/bin/jar 1065
update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7*/bin/javaws 1065
update-alternatives --config java

install Eclipse SQL Explorer
run eclipse, help-install new software
add Eclipse SQL Explorer site http://eclipsesql.sourceforge.net/

1:Microsoft SQL Server
http://www.microsoft.com/en-us/download/details.aspx?id=11774
sqljdbc_4.0.2206.100_enu.tar.gz
download sqljdbc_4.0.2206.100_enu.tar.gz

eclipse config
window-preferences-sql explorer-jdbc drivers-Microsoft MSSQL Server JDBC Driver

Edit - Extra Class Path
Add sqljdbc4.jar(atfer extract the tar.gz file)

Driver Class Name:
com.microsoft.sqlserver.jdbc.SQLServerDriver

Example URL:
jdbc:sqlserver://<server_name>:<1433>;databaseName=databasename
jdbc:sqlserver://192.168.2.73:1433;databaseName=dlt
---------------------------------------------------------------------------------------------------------------------

2:Oracle Thin Driver
download oracle thin client driver
eclipse config
window-preferences-sql explorer-jdbc drivers-Oracle Thin Driver


Edit - Extra Class Path
Add ojdbc14.jar.jar(atfer extract the file)

Driver class Name:
oracle.jdbc.driver.OracleDriver
Example URL:
jdbc:oracle:thin:@<server>:1521:<database_name>
jdbc:oracle:thin:@192.168.2.31:1521:erpg
---------------------------------------------------------------------------------------------------------------------

3:My Sql
dev.mysql.com/downloads/connector/j/
download mysql-connector-java-5.1.28.tar.gz

Edit - Extra Class Path
Add mysql-connector-java-5.1.28.jar(atfer extract the file)

Driver class Name:
com.mysql.jdbc.Driver

Example URL: 
jdbc:mysql://<hostname>[<:3306>]/<dbname>
jdbc:mysql://192.168.2.45:3306/test

 


















2014年1月23日星期四

ubuntu安装qq international

ubuntu版本:13.10
安装playonlinux
1:install a non-listed program
2: install a program in a new virtual drive
3:wine版本1.7.4
4:安装的库文件riched20 msxml6 ie8 vcrun2008

5:qq版本qq intl 2.1
6:重要一点,将windows目录内tahoma字体复制到windows,font目录
安装完毕后即可正常使用,不过密码只能用软键盘输入


2013年12月13日星期五

安装vpn pptp服务器

安装SL linux 1CPU,512M
linux安装完毕,设置IP地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0










关闭IPV6,重启电脑
安装依赖包ppp perl
yum install ppp perl
wget   http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.4.0-1.el6.x86_64.rpm
rpm  -Uhv pptpd-1.4.0-1.el6.x86_64.rpm

vi /etc/pptpd.conf
localip 192.168.20.1

remoteip 192.168.20.21-40

vpnuser add 用户名 密码
此数据存贮于/etc/ppp/chap-secrets


/etc/ppp/options.pptpd PPTPD 常用选项

vi /etc/sysctl.conf

net.ipv4.ip_forward = 1 开启路由转发
sysctl -p /etc/sysctl.conf sysctl.conf 立即应用

service pptpd restart

在路由器上做tcp1723 及协议号47的映射
所谓协议号47映射,即使用下面的指令
nat server protocol 47 global X.X.X.X inside X.X.X.X

*nat
:PREROUTING ACCEPT [25:1568]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -s 192.168.20.0/24 -o eth0 -j MASQUERADE
 *filter
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1723 -j ACCEPT
-A INPUT -p gre -j ACCEPT
在/etc/sysconfig/iptables 添加
-A FORWARD -j REJECT --reject-with icmp-host-prohibited 一定要注释掉这条规则







2013年11月1日星期五

CentOS关闭ipv6




在CentOS中,关闭IPV6

vi /etc/sysctl.conf

添加,注意空格net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
运行
sysctl -p

在线服务器使用
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6


 

2013年10月28日星期一

Elastix关闭443,80,3306,22,5038,cyrus,rpc,portmap,op_server.pl

设置只监听Lan address 80
vi /etc/httpd/conf/httpd.conf
将Listen 80改为 Listen 192.168.1.1:80
即可让80端口只响应内网IP

关闭443
vi /etc/httpd/conf.d/ssl.conf
将Listen 443 注释掉
重启httpd
service httpd restart

关闭3306在外网监听
vi /etc/my.cnf
[mysqld]
添加 bind-address=127.0.0.1
/etc/init.d/mysqld restart

关闭22在外网监听
vi /etc/ssh/sshd_config
修改ListenAddress 192.168.1.1即可

关闭5038在外网监听
vi /etc/asterisk/manager.conf
将bindaddr = 0.0.0.0 改为 127.0.0.1
或将 enabled =yes 改为 no

关闭cyrus
service cyrus-imapd stop
chkconfig cyrus-imapd off

关闭 rpc.statd
service nfslock stop
chkconfig nfslock off

关闭portmap
service portmap stop
chkconfig 


关闭op_server.pl
vi /var/www/html/panel/op_server.cfg
设置listen_addr=192.168.1.1