Posts Tagged ‘ubuntu’

fixing "libmozjs" missing when using mongodb on Ubuntu lucid

07月 13, 2010

Problem
When running mongod/mongo/mongos, you got message like this:
mongod: error while loading shared libraries: libmozjs.so: cannot open shared object file: No such file or directory

Solution
Make sure you have xulrunner-dev installed:
sudo apt-get install xulrunner-dev

then find libmozjs on your filesystem:
sudo locate libmozjs

in lucid, it’s supposed to locate at:
/usr/lib/xulrunner-1.9.2.6/libmozjs.so

(and some other directories, such as firefox / thunderbird / seamonkey)

Just create a symbol link:
sudo ln -s /usr/lib/xulrunner-1.9.2.6/libmozjs.so /usr/lib/

try to restart mongodb:
sudo service mongodb start

take a look at process list:
ps aux | grep mongo

it works.

The post is brought to you by lekhonee v0.7

Reset default cursor theme and web browser after installing kubuntu

04月 3, 2010

If you installed kubuntu parallel to ubuntu, you might find that the default browser is set to konqueror and cursor theme is oxygen which cannot modified by “gnome-default-applications-properties” and “gnome-appearance-properties”.

To fix this, use Debian update-alternatives tool:
update-alternatives –config x-www-browser
update-alternatives –config x-cursor-theme

All configurable options are listed at /var/lib/dkpg/alternatives

Virtual Machine Searcher for Gnome Deskbar Applet

02月 12, 2010

Very glad to announce another daily-coding work: an extension for gnome deskbar applet to search and launch virtual machine. There is a plugin for gnome-do that does the same job. That’s what I create the the plugin for. I switched to deskbar because gnome-do’s Do.exe reminds me nightmares when I was a M$ Windows user. The deskbar applet has been a great replacement, however, the virtualbox plugin in Do is really impressive while deskbar doesn’t provide me the same functionality.

You can ignore words above and just take a look at the screenshot:
deskbar-virtualbox

Download

Download the extension from (the highlighted one):
http://bitbucket.org/sunng/daily-coding/downloads/?highlight=5137

You can also trace the development at bitbucket project. However, the repository is mixed with other small code snippets. Currently, mercurial doesn’t support subdirectory pull. So there is no way to grab the deskbar-applet individually.

Installation

copy this file to /usr/lib/deskbar-applet/deskbar-applet/modules-2.20-compatible/ (Ubuntu installation for example) with super user privilege. Right click desktbar applet, select Preference, Searchers tab, hit “Reload” button, then check the Virtualbox Deskbar Module.
deskbar-preference

Issue

Feel free the report issues on bitbucket:
http://bitbucket.org/sunng/daily-coding/issues/

解决Ubuntu Openbox无法启动的问题

02月 11, 2010

今天在工作用的ArchLinux上安装了用Openbox取代了GNOME桌面,感觉良好,回来尝试一下在Ubuntu上也做同样的事情。不料遇到问题,在完成基本的配置之后,Openbox Session无法启动,总是自动跳回gdm。查看.xsession-errors,是gnome-setting-daemon报错:

(gnome-settings-daemon:2519): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL’ failed

既然是gnome-settings-daemon报错,就在.config/openbox/autostart.sh中注视掉和gnome-settings-daemon相关的部分:

# Make GTK apps look and behave how they were set up in the gnome config tools
#if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then
#  /usr/libexec/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null; then
#  gnome-settings-daemon &
# Make GTK apps look and behave how they were set up in the XFCE config tools
#elif which xfce-mcs-manager >/dev/null; then
#  xfce-mcs-manager n &
#fi

进而可以启动Openbox Session了,但是发现Conky仍然无法启动,经过搜索是sleep的时间不够长导致的。而根据launchpad上上的讨论,gnome-settings-daemon也可以在Openbox Session启动后正常运行,于是可以这样设置autostart.sh

(sleep 20 && conky 1>/dev/null 2>/dev/null) &
(sleep 2 && tint) &
(sleep 5 && tilda) &
(sleep 20 && gnome-settings-daemon 1>/dev/null 2>/dev/null) &

tint和tilda对启动顺序没有明确的要求,conky和gnome-settings-daemon需要设置一个较长的等待时间。

这是Ubuntu中Openbox的一个bug,可以在此跟踪:

https://bugs.launchpad.net/ubuntu/+source/openbox/+bug/459005

顺手展示一下我的Openbox桌面
myopenbox

openbox / tint2 / conky / tilda 还没来得及认真配置,呵呵。

再有,Ubuntu源里的的tint2版本很低,问题不少,不支持宽度的百分数配置,不支持systray等配置。建议安装开发版本:

http://code.google.com/p/tint2/wiki/Install#For_Ubuntu_9.10_%28Karmic%29

使用gnome-dictionary和dictd

02月 7, 2010

最近琢磨字典多一些,以前一直不知道gnome自带的gnome-dictionary如何使用,因为默认的字典源里都没有中文字典,而且离线更是无法使用。其实不然,字典服务可以自架,并且可以使用自己的字典。

在自己的机器上架设dictionary server,以ubuntu为例:

安装dictd / dict
sudo apt-get install dictd dict

前者是字典服务器,后者是字典服务客户端。还可以从仓库里安装已经打包好的字典,如
sudo apt-get install dict-stardic
是一个英汉字典

dictd安装好后会默认自启动,也可以通过
sudo service dictd start
来控制dictd的启动、重启和关闭。

通过dict测试服务的状况
dict -D
命令会列出可用的数据库(即字典)

在gnome-dictionary中添加字典源 Edit->Preference->Source->Add
Name: 自定义的字典名
Transport: Dictionary Source
Hostname: 127.0.0.1
Port: 2628

Close之后可以到主界面打开侧边栏,在Dictionary Source中双击选定此字典,在Aailable Dictionaries里双击选中目标字典,于是就可以在gnome-dictionary里使用本地的字典服务了。

接下来安装自己的字典。stardict的网站上有很多中文字典,上面也都标示了授权协议。要在dictd里使用这些字典,需要进行一个简单的格式转换。安装一个工具
sudo apt-get install dictconv

它的使用方法:
dictconv -o OUTPUT_FILE INPUT_FILE

在input_file指定stardict的.ifo文件,在output_file指定要生成的dictd的.index文件。这个转换非常耗时,需要有足够的耐心。这个操作将会生成.index和.dict文件。对.dict文件进行压缩:
dictzip OUT.dict

转换完成后,编辑/var/lib/dictd/db.list文件,在其中添加一个database定义
database YOUR_DB_NAME{
data PATH_TO_DICT_DZ
index PATH_TO_INDEX
}

其中PATH_TO_DICT_DZ是上一步的.dz文件,PATH_TO_INDEX是到上一步生成的.index文件的路径。编辑完成后,重启dictd服务
sudo service dictd restart

使用dict -D可以查看启用的字典。

建议备份/var/lib/dictd/db.list文件,因为每次从apt-get安装字典后,这个文件都会被覆盖。

dictd服务也可以在fantasdic里访问。

很山寨

02月 3, 2010

经常访问GNU的网站你会发现一些很神奇的东西,比如gNewSense,又比如最新的:
IceCat

怎么样,够震撼啊,GNUzilla套件里的第一个发布,IceCat。IceCat是嘛?你知道Firefox吧,那拉开冰箱门,把Firefox塞进去,带上冰箱门,嗯,那就是IceCat了。当然是开玩笑了,GNU IceCat is the GNU version of the Firefox browser. Its main advantage is an ethical one: it is entirely free software.

现在已经可以在Ubuntu中使用这个病猫,哦不,冰猫了:

sudo add-apt-repository ppa:gnuzilla-team/ppa
sudo apt-get update
sudo apt-get install icecat

Adding Ubuntu-GIS repository

11月 29, 2009

在Ubuntu上安装GIS软件,可以添加这个PPA源:
deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu karmic main

导入GPG KEY
gpg –keyserver subkeys.pgp.net –recv 089EBE08314DF160
gpg –export –armor 089EBE08314DF160 | sudo apt-key add -

这个源中目前包含了最新版本的GIS软件:

  • gdal 1.6
  • grass
  • qgis

Gnome Shell

10月 4, 2009

续昨,好吧,这个无聊的国庆假期就献给karmic了。gnome-shell已经可以在软件仓库里找到了,apt-get安装即可。要使用gnome-shell可以执行
gnome-shell –replace

要把gnome-shell作为默认的窗口管理器,打开gnome的配置编辑器,找到/desktop/gnome/session/required_components,把panel和windown-manager全部改成gnome-shell,重新登录即可。

上个图:

当然了,还没有正式release,大家试用尝鲜注意安全第一。

Upgrade to Karmic

10月 2, 2009

今天凌晨Ubuntu 9.10 Karmic的beta发布了,实在忍耐不到月底了,上午就update-manager -d升级了发行版。从下在到安装完成用了大约三个小时,当然升级不用花什么精力,只要让程序自动去处理就好了,现在跨版本升级越来越轻松了。

配好以后感觉还是很值得升级的,大概多半是因为Kernel 2.6.31,这次桌面性能的提升真的非常大,之前从来没有这么明显的感受。举个例子,很惭愧,我这机器在上一个9.04版本里alt-table的Application Switcher都还会卡,现在已经一如之前不开compositing时的性能了。

既然是ubuntu,还是要提一下面子上的事情。GDM有变化,按照release notes上说的是全部重写了。在从gdm登录到桌面载入之间有了一个loading效果,体验很不错。然后是Ubuntu主题变了,human不再是黄的了,变成了深褐色,有了新的图标主题humanity,尤其是在桌面的右上角区域很有特点。

再有就是Gnome2.28的变化还有Ubuntu对gnome相关的增强了,这次激进了一些,居然赶在arch更新之前在ubuntu上体验了gnome的新版本。主要有几个变化:

indicator变得更强大了,现在indicator和evolution empathy gwibber等等软件有了更好的集成,在indicator-applet里可以看到这些软件的新消息通知,另外indicator和原来Ubuntu的session manager也集成了,可以通过session manager设置empathy的状态。

empathy变化很大,据说已经支持xmpp的geolocation extension了,早先我就转载过一个在osm上显示xmpp好友位置的截图。不过这个功能似乎又没有在ubuntu的版本里找到,可能ubuntu这边还是有点谨慎吧。倒是geoclue这个框架已经被加进apt-get了,可以看出相关的工作确实是在进行中。

epiphany开始用webkit内核了,这样可以把midori彻底踢开了,epiphany也算是找到了自己在linux桌面上存在的意义。empathy可以抢走pidgin的位置,epiphany想强firefox的位置还是挺难的。

还有Ubuntu似乎修改了gnome桌面gnome-panel/panel-menu-item.c里面的参数,之前当places里的书签数大于5之后会产生一个Bookmarks子菜单,现在这个数值似乎变成了8,当然只是猜测,因为gnome的代码里这个值仍然是5。发现这个变化的过程实在比较无聊。。。

据说2.28的Evince看书的时候记annotation了,不过我好像没有发现这个功能,Gnome的release notes上也只是提了一下并没有发截图。

我还是很感激每半年就有很多新特性可以去discover的,这种感觉很不错。

[旧]Up and Running: PostgreSQL and PostGIS on Ubuntu 8.10, Step By Step

07月 10, 2009

每次安装pgsql的过程都是这么震撼人心。以下在Ubuntu 8.10上安装配置运行pgsql及postgis的简单步骤。和Windows相比,用apt-get安装不会再有服务安装不上的问题,但是可能会有包装不全、缺少配置的问题。

首先用apt-get下载安装pgsql和postgis的需要的包

sudo apt-get install postgresql-8.3 postgresql-8.3-postgis postgresql-client-8.3 postgresql-contrib-8.3 pgadmin3

安装过程中会提示创建一个默认名为postgres的用户。

安装结束后,启动pgsql服务器

sudo /etc/init.d/postgresql-8.3 start

在默认情况下pgsql ident的设置为postgres用户用ident sameuser的方式登录,这种方式类似于sqlserver使用windows的用户管理。因此要用postgres用户登录系统。

修改postgres用户的密码

sudo passwd postgres

用新密码登录为postgres

su – postgres

运行psql,可以检查pgsql的运行情况

psql

可以在psql中给postgres用户设置数据库密码

ALTER USER postgres ENCRYPTED PASSWORD ‘yournewpassword’;

继续在psql中创建plsql语言。如果安装时遗漏了contrib包这一步是不能完成的。

CREATE LANGUAGE plsql;

退出psql,创建Postgis数据库。

createdb postgis

导入postgis的两个sql文件,其中定义了EPSG数据库和Geometry类型。

psql -d postgis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
psql -d postgis -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql

进入psql对当前用户GRAND ALL

GRANT ALL ON TABLE geometry_columns TO postgres;
GRANT ALL ON TABLE spatial_ref_sys TO postgres;

这样做的结果是这两张表被导入到默认的postgres数据库中。这样今后创建postgis数据库就可以以postgres为template_db,不过这么做的后果是这两张表的owner都是postgres。在GeoServer里创建FeatureType时必须用postgres用户登录,否则权限不足。

这时PostGIS应该可以正常工作了,可以尝试导入shp

shp2pgsql /your/shp/file tablename | psql newgisdb

创建一个新的数据库用户

createuser -p username

修改/etc/postgresql/8.3/main/pg_hda.conf,设置数据库访问的认证方式

将local all all一行的验证方式(method)由ident sameuser改为password就可以用密码登录psql了,在python-psycopg中用新建的用户连接pgsql也不会报ident失败了。

将host all 127.0.0.1/32一行的验证方式也改为password就可以在本地用jdbc以用户名密码连接数据库了。


加关注

Get every new post delivered to your Inbox.