record my way to ubuntu

Sunday, November 12, 2006

Monday, October 09, 2006

转贴:X.org 下 XMMS aMule 等 Gtk1 程序的中文解决

X.org 下 XMMS aMule 等 Gtk1 程序的中文解决
Up to table of contents

X.org 下 XMMS aMule 等 Gtk1 程序的中文解决

Xorg 和 XFree86 的 locale 处理不太一样,如果再用 gtkrc.utf-8 的话 , 就必须指定一定的顺序中日韩等多个字体,不然中文就有问题.


这样,直接用 gtkrc.zh_CN.utf-8 就会更简单了

如果存在 /etc/gtk/gtkrc.zh_CN 这个文件
$sudo cp /etc/gtk/gtkrc.zh_CN /etc/gtk/gtkrc.zh_CN.utf-8



就可以了

XMMS 字体可以设置为:

-adobe-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1,-*-*-medium-r-normal--16-*-*-*-*-*-gb2312.1980-0,*-r-*


如果不存在,直接建立

$sudo gedit /etc/gtk/gtkrc.zh_CN.utf-8



文件内容为:

# $(gtkconfigdir)/gtkrc.zh_CN
#
# This file defines the fontsets for Chinese language (zh) using
# the simplified chinese standard GuoBiao as in mainland China (CN)
#
# 1999, Pablo Saratxaga
#

style "gtk-default-zh-cn" {
fontset = "-adobe-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1, -*-*-medium-r-normal--16-*-*-*-*-*-gb2312.1980-0,*-r-*"
}
class "GtkWidget" style "gtk-default-zh-cn"


by oneleaf — last modified 2005-11-24 20:53
Contributors: 作者:jhuangjiahua


如何让UTF-8下XMMS显示mp3的GBK标签

原文[http://www.linuxsir.org/bbs/showthread.php?t=214985 ]

1. 安装 xmms-mpg123-ja

sudo apt-get install xmms-mpg123-ja

xmms-mpg123-ja 比默认的 多了 编码转换

2. 用 xmms-mpg123-ja 插件代替 xmms 默认的 xmms-mpg123

xmms 首选项-》音频输入输出插件

去掉 libmpg123 的[启用] 选上 libmpg123-ja 的 [启用]

3. xmms 首选项-》音频输入输出插件 -》 libmpg123-ja -》配置 -》标题

选上 输入转换 GB18030 -》 UTF-8

另外可能也要禁止 id3v2

注:GB18030包涵了GB2312

Monday, August 21, 2006

mount samba folder

sudo mount -t smbfs //192.168.1.2/Video ~/video -o credentials=/etc/samba/cred-file,uid=ronadams,gid=users


that's the way, use command to mount samba folder

Sunday, August 20, 2006

Remove jEdit deb Package

Remove jEdit deb Package

autor
maillist

sudo dpkg --remove --force-depends --force-remove-reinstreq jedit


And here is the rest of it.

Saturday, August 19, 2006

Quick little speed trick for Ubuntu Gnome menus

Gnome

Say you’re a speed demon, and that 1 second pause before opening a menu in Gnome is just too much for you to bear?

Well friend, I’ve got your relief right here.

First, create a file in your home directory called .gtkrc-2.0

vi .gtkrc-2.0

Now add the following single line into this new file:

gtk-menu-popup-delay = 0
Save the file (in VI do this by hitting the escape key and then typing :wq!) and click on your Applications menu. Are you awed yet? Have your friends been calling you to rave about your new speed? Expect that raise from your boss for much increased productivity!

geek out.

add my code hier


And here is the rest of it.

Tuesday, August 15, 2006

gFTP and Download for X

为了下载,装了这两个兔崽子软件,弄了一个上午。按说gFTP源里面有,折腾个啥。偏偏网上说源里面的支持中文文件名有问题。而源里面的D4X也不是最新版。得了,这么一来折腾了一个上午才搞定。

先说gFTP,将gFTP的源代码先下载下来,上gFTP的主页就有。再下载Patch。把它们两个放到一个目录下面。然后打补丁:
tar -jxvf gftp-2.0.18.tar.bz2
patch -p0 < gftp_remote_charsets.patch
注意安装之前,要去源里面,把libgtk2.0的包全给装上,否则configure时会出错。安装补完的gFTP源码:
cd gftp-2.0.18
./configure
make
make install
运行gFTP,将Remote Character Sets设成GB2312,这样就行了。


为啥要装Download for X呢?是因为Firefox下面的Flashgot在Linux下面只支持Download for X。源里面的版本已经不是最新的了。从http://www.krasu.ru/soft/chuchelo/下载了源文件和rpm包。这时我机器里还没有alien,马上装一下:
apt-get install alien
用后用alien安装那个rpm包:
alien -i d4x-2.5.7.1-1.i386.rpm
装完了发现不好用,找不到ssl。这里是缺少libssl,因为openssl是缺省安装的。上源,拉下libssl0.9.8,libssl0.9.8-dbg和libssl-dev。可还是不行,在terminal里面输入d4x出来这样的错误提示:
nt
nt: error while loading shared libraries: libssl.so.6: cannot open shared object file: No such file or directory
但是在d4x源文件目录下面configure是可以的(如果不装前面三个libssl提示找不到openssl),于是决定从源文件里面装。

Cisco VPN Client in Ubuntu

安装编译工具包
apt-get install build-essential
安装kernel header
apt-get install linux-headers-`uname -r`
4.6版本的Cisco需要打一下补丁。

我用的是4.8的Cisco就不需要补丁了。接下来可以先make一下看看有没有问题,然后就直接运行vpn_install就可以了。
xin@ubuntu:~/cisco/vpnclient$ sudo ./vpn_install
Cisco Systems VPN Client Version 4.8.00 (0490) Linux Installer
Copyright (C) 1998-2005 Cisco Systems, Inc. All Rights Reserved.

By installing this product you agree that you have read the
license.txt file (The VPN Client license) and will comply with
its terms.


Directory where binaries will be installed [/usr/local/bin]

Automatically start the VPN service at boot time [yes]

In order to build the VPN kernel module, you must have the
kernel headers for the version of the kernel you are running.


Directory containing linux kernel source code [/lib/modules/2.6.15-23-686/build]

* Binaries will be installed in "/usr/local/bin".
* Modules will be installed in "/lib/modules/2.6.15-23-686/CiscoVPN".
* The VPN service will be started AUTOMATICALLY at boot time.
* Kernel source from "/lib/modules/2.6.15-23-686/build" will be used to build the module.

Is the above correct [y]

Making module
make -C /lib/modules/2.6.15-23-686/build SUBDIRS=/home/alan/cisco/vpnclient modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.15-23-686'
Building modules, stage 2.
MODPOST
Warning: could not find /home/alan/cisco/vpnclient/.libdriver.so.cmd for /home/alan/cisco/vpnclient/li bdriver.so
make[1]: Leaving directory `/usr/src/linux-headers-2.6.15-23-686'
Create module directory "/lib/modules/2.6.15-23-686/CiscoVPN".
Copying module to directory "/lib/modules/2.6.15-23-686/CiscoVPN".
Already have group 'bin'

Creating start/stop script "/etc/init.d/vpnclient_init".
/etc/init.d/vpnclient_init
Enabling start/stop script for run level 3,4 and 5.
Creating global config /etc/opt/cisco-vpnclient

Installing license.txt (VPN Client license) in "/opt/cisco-vpnclient/":

Installing bundled user profiles in "/etc/opt/cisco-vpnclient/Profiles/":
* New Profiles : sample

Copying binaries to directory "/opt/cisco-vpnclient/bin".
Adding symlinks to "/usr/local/bin".
/opt/cisco-vpnclient/bin/vpnclient
/opt/cisco-vpnclient/bin/cisco_cert_mgr
/opt/cisco-vpnclient/bin/ipseclog
Copying setuid binaries to directory "/opt/cisco-vpnclient/bin".
/opt/cisco-vpnclient/bin/cvpnd
Copying libraries to directory "/opt/cisco-vpnclient/lib".
/opt/cisco-vpnclient/lib/libvpnapi.so
Copying header files to directory "/opt/cisco-vpnclient/include".
/opt/cisco-vpnclient/include/vpnapi.h

Setting permissions.
/opt/cisco-vpnclient/bin/cvpnd (setuid root)
/opt/cisco-vpnclient (group bin readable)
/etc/opt/cisco-vpnclient (group bin readable)
/etc/opt/cisco-vpnclient/Profiles (group bin readable)
/etc/opt/cisco-vpnclient/Certificates (group bin readable)
* You may wish to change these permissions to restrict access to root.
* You must run "/etc/init.d/vpnclient_init start" before using the client.
* This script will be run AUTOMATICALLY every time you reboot your computer.
将Profile dul.pcf拷贝到/etc/opt/cisco-vpnclient/Profiles/下面。最后连接一下试试看。
sudo /etc/init.d/vpnclient_init start
sudo vpnclient connect dul
为了每次不用root权限来运行vpnclient,修改一下访问权限。
chmod 4111 /opt/cisco-vpnclient/bin/cvpnd
然后把"/etc/init.d/vpnclient_init start"写到启动程序里面,那样的话,不需要root也能连接vpn了。

参考了下列两篇好文:
http://popey.com/node/62
http://www.mcmaster.ca/uts/network/vpn/vpnclient_linux.htm
还有一个ubuntu网站的,一时找不到了。

Install Multimedia Software

安装下列软件:
FlashPlayer PlugIn or from Adobe
Realplayer,修改启动script,具体看后面。
安装多媒体包
安装Skype:要装1.3beta,我装1.2没有声音。

Realplayer 装完后需要注意!
Realplayer和SCIM有冲突。冲突反应为
root@ubuntu:/opt/RealPlayer# ./realplay
./realplay: line 75: 9774 Segmentation fault $REALPLAYBIN "$@"
为解决冲突,需要修改/opt/Realplayer/realplay文件(文件具体目录看你装在哪里了)。在#!/bin/sh后面加入
export GTK_IM_MODULE=xim
然后存盘,再运行realplay就好了。

后来居然发现Adobe Reader也和SCIM有冲突,解决方法和上面一样。

Monday, August 14, 2006

设置字体显示:local.conf,firefox和系统字体

除了等宽字体使用Vera Sans YuanTi Mono外,其它都使用文泉驿字体。系统字体设置如图所示:

Vera Sans YuanTi Mono在显示等宽字体的情况下不会出现字体重迭的现象。如果仅仅这样设置,那么系统的英文字体也是文泉驿的宋体了。我觉得Ubuntu下的默认英文字体比较好看,为了让文泉驿和系统英文字体同时显示,需要修改/etc/fonts/local.conf文件。下面代码要加入该文件。系统安装完毕后,没有这个local.conf文件,自己要建一个。
<!-- Use Bitstream Vera Sans in Chinese Font -->
<match target="pattern" >
<test compare="eq" name="family" qual="any" >
<string>WenQuanYi Bitmap Song</string>
</test>
<edit mode="prepend_first" binding="strong" name="family" >
<string>Bitstream Vera Sans</string>
</edit>
</match>
有了以上代码,系统在使用文泉驿字体时,遇到英语字母会自动调用Bitstream Vera Sans字体。效果如图所示,同时使用文泉驿和Bitstream Vera Sans字体:

firefox的字体设置如下:


local.conf:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file for local customizations -->
<fontconfig>

<!-- Serif faces -->
<alias>
<family>DejaVu Serif</family>
<family>Bitstream Vera Serif</family>
<family>Times New Roman</family>
<family>Thorndale AMT</family>
<family>Times</family>
<family>Nimbus Roman No9 L</family>
<family>Luxi Serif</family>
<family>Kochi Mincho</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL New Sung</family>
<family>Vera Sans YuanTi</family>
<family>AR PL SungtiL GB</family>
<family>AR PL Mingti2L Big5</family>
<family>MS 明朝</family>
<family>Baekmuk Batang</family>
<family>FreeSerif</family>
<family>MgOpen Canonica</family>
<default><family>serif</family></default>
</alias>

<!-- Sans-serif faces -->
<alias>
<family>DejaVu Sans</family>
<family>Bitstream Vera Sans</family>
<family>Helvetica</family>
<family>Arial</family>
<family>Verdana</family>
<family>Albany AMT</family>
<family>Nimbus Sans L</family>
<family>Luxi Sans</family>
<family>Kochi Gothic</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL New Sung</family>
<family>Vera Sans YuanTi</family>
<family>AR PL KaitiM GB</family>
<family>AR PL KaitiM Big5</family>
<family>MS ゴシック</family>
<family>Baekmuk Dotum</family>
<family>SimSun</family>
<family>FreeSans</family>
<family>MgOpen Moderna</family>
<default><family>sans-serif</family></default>
</alias>

<!-- Monospace faces -->
<alias>
<family>DejaVu Sans Mono</family>
<family>Bitstream Vera Sans Mono</family>
<family>Courier</family>
<family>Courier New</family>
<family>Andale Mono</family>
<family>Luxi Mono</family>
<family>Cumberland AMT</family>
<family>Nimbus Mono L</family>
<family>Vera Sans YuanTi Mono</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL New Sung</family>
<family>NSimSun</family>
<family>FreeMono</family>
<default><family>monospace</family></default>
</alias>

<!-- Use Bitstream Vera Sans in Chinese Font -->
<match target="pattern" >
<test compare="eq" name="family" qual="any" >
<string>WenQuanYi Bitmap Song</string>
</test>
<edit mode="prepend_first" binding="strong" name="family" >
<string>Bitstream Vera Sans</string>
</edit>
</match>

<!-- Disable font alias for Chinese <= 16px -->
<match target="font">
<test qual="any" name="family" compare="eq">
<string>WenQuanYi Bitmap Song</string>
<string>Vera Sans YuanTi</string>
<string>AR PL New Sung</string>
<string>AR PL Mingti2L Big5</string>
<string>AR PL SungtiL GB</string>
<string>MS 明朝</string>
<string>Kochi Mincho</string>
<string>Baekmuk Batang</string>
</test>
<test name="pixelsize" compare="less_eq">
<double>16</double>
</test>
<edit name="antialias">
<bool>false</bool>
</edit>
<edit name="hinting">
<bool>false</bool>
</edit>
</match>

</fontconfig>
可惜文泉驿没有大字体,显示我的Blog文章的标题就不能用大字体显示,看图吧:

安装圆体字体:Vera Sans YuanTi

参考这里
这款字体来自中国 Linux 公社,作者是 cnhnln ,这款字体是用 fontforge http://fontforge.sourceforge.net/ 修改的,内含两套字体,一套 Vera Sans YuanTi 是比例字体,不等宽。一套 Vera Sans YuanTi Mono 是等宽字体,可以用在终端,不会出现字符重叠,包含常规、斜体、粗体、粗斜体。不需要通过算法生成斜体,也不需要粗体补丁。支持 GBK。英文部分按照是否等宽分别用 Bitstream Vera Sans 和 Bitstream Vera Sans mono,中文常规部分是 方正准圆 ,中文粗体部分用 方正粗圆。并且这款字体中嵌入了从 simsun 里提出的 12、13、14、15、16、18 pixelsize 的 GBK 点阵字体。
字体从这里下载

这个包中 ttf-vera-sans-yuanti 目录下为字体文件,把该目录下的文件连同该目录一起复制到 /usr/share/fonts/truetype/ 目录下。接着在 /usr/share/fonts/truetype 执行
fc-cache -f -v
然后将FontPath "/usr/share/fonts/truetype/ttf-vera-sans-yuanti"加入/etc/X11/xorg.conf,就和文泉驿字体一样。

安装文泉驿点阵宋体

接下来就要安装中文字体了。文泉驿的宋体的字型很不错。先从文泉驿的网站下载字体。我下载的是pcf格式的wqy-bitmapfont-pcf-0.7.0-4.tar.gz。安装过程参考了文泉驿网站上面的debian的安装说明。先用su取得root权限,再进行下面的操作。
tar -zxvf wqy-bitmapfont-pcf-0.7.0-4.tar.gz
cd wqy-bitmapfont
mkdir -p //usr/share/fonts/bitmap/wenquanyi
cp *.pcf //usr/share/fonts/bitmap/wenquanyi
fc-cache -f -v
cd /usr/share/fonts/bitmap/wenquanyi
mkfontdir
cp fonts.dir fonts.scale
gedit /etc/X11/xorg.conf
在xorg.conf中加入文泉驿字体的路径"/usr/share/fonts/bitmap/wenquanyi":
......
Section "Files"
......
FontPath "/usr/share/X11/fonts/100dpi"
FontPath "/usr/share/X11/fonts/75dpi"
FontPath "/usr/share/fonts/bitmap/wenquanyi"
......
接下去要unlink掉一个/etc/fonts/conf.d下的文件,否则字体不会被调用。
cd /etc/fonts/conf.d/
unlink 30-debconf-no-bitmaps.conf
最后重启X或系统。就能在System->Performaces->Font下面看到WenQuanYi Bitmap Song的字体了。然后在Firefox中也选择文泉驿字体。

Saturday, August 12, 2006

安装设置SCIM

本文中的设置是根据SCIM网站的wiki,加上我自己的设置所记录的。官方网址是:
http://www.scim-im.org/wiki/documentation/installation_and_configuration/ubuntu_kubuntu

Installation of scim on Ubuntu
先安装中文包
sudo apt-get install language-pack-zh
Make sure you have the universe repository enabled.
sudo apt-get install scim-gtk2-immodule
Then install the input method engines you plan to use.
sudo apt-get install scim-pinyin
System configuration
Environment variables
Create a file called 75custom-scim_init in /etc/X11/Xsession.d
Paste the following into it:
export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE="scim"
export XIM_PROGRAM="scim -d"
It is useless to export QT_IM_MODULE="scim" because the Qt-immodule patch is not applied in Ubuntu's Qt. Therefore, scim (or skim) interacts with KDE/Qt apps via XIM protocol.

Locale configuration
Please read the System configuration section to know which locale you should use. We strongly recommand you to choose a *.UTF-8 locale.
sudo dpkg-reconfigure locales
Select the locale you have chosen as default, it may be already.
Then edit the /etc/environment file. It must include the following:
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
**切记,这里不能是utf8
Where en_US.UTF-8 is to replace with the locale you have chosen.
The file must not define the LC_ALL variable !

If your locale is not en_US.UTF-8, you have to add it to scim supported unicode locales.
mkdir ~/.scim
echo '/SupportedUnicodeLocales = en_US.UTF-8,fr_FR.UTF-8' > ~/.scim/global
where fr_FR.UTF-8 is your locale.

Scim loading at start-up
Scim should be loaded when you start a Gtk application.
If you want it to be loaded automatically at start-up, go to System->Preferences->Sessions, choose Startup Programs, and add
scim -d
You can keep the order at 50.

OK,配置完成,重启X或者系统。

Firefox加速

Firefox在Ubuntu下面速度很慢,为了加快它的速度,修改一下设置。
network.dns.disableIPv6: true
network.http.max-connections-per-server: 24
network.http.pipelining: true
network.http.pipelining.maxrequests: 8
network.http.proxy.pipelining: true
nglayout.initialpaint.delay: 0

摘自Michael Kofler "Ubuntu Linux - Installation, Anwendung, Tipps & Tricks"

添加Root密码

常常用到sudo,每次输入密码麻烦。改一下root密码,这样就能用su命令了。
sudo passwd

安装 Linux 686 Kernel

从LiveCD安装后,kernel是386的。在terminal里面输入
sudo apt-get install linux-686
就会把686的kernel给装上了。当然这里需要联网。装完之后重启,在terminal输入
uname -a
查看,发现kernel是686的了。在下面这篇东西所引用的链接里面,可以知道386的kernel和686的kernel有什么区别。
from http://www.vmware.com/community/thread.jspa?messageID=419923

*HUGE SIGH OF RELIEF*

Well I think I got it working in my case. I needed to install the 686 kernel for things to work. Below are instructions on how to install Ubuntu server 6.06 as a guest virtual machine in Windows VMware workstation 5.5.1 using the Ubuntu 686 kernel. These instructions may also apply if you're not using VMware.

How to Install the Ubuntu 686 Kernel
====================================

1.) boot to the Ubuntu 6.06 server install cd. Choose 'Rescue a broken system.'

2.) when you get to the Rescue Operations screen choose "execute a shell in /dev/discs/disco/part1", this option may read a little differently on your system.

3.) Click continue if another screen appears.

4.) At the prompt, type: sudo apt-get install linux-686

5.) You will be asked if you want to continue, type: y

6.) The installation of the 686 kernel will begin. It looks like an internet connection is required so the install files can be downloaded from the ubuntu website.

7.) When the installation is done, type: exit

8.) You should be returned to the Rescue Operations screen. Choose the last option: reboot the system. Make sure you're not booting to the install cd!

9.) Give the system a few moments to boot-up. At last, you should be placed at the login: prompt.

10.) Celebrate!

Helpful websites:

http://ubuntuforums.org/showthread.php?t=85917
This is a very nice piece of documentation that explains all of the different Ubuntu kernel versions.

http://www.tuxme.com/node/544
This is the website that gave me the idea to try the 686 kernel. This specific document also talks about installing Ubuntu on laptops.

I really wish ubuntu would detect which kernel is best for a system. It's things like this that I think keep people away from linux. Linux definitely requires a lot of patience sometimes but I think it's worth it in the end.

开篇

这段时间一直在折腾ubuntu,设置内容包括软件设置的东西很多。于是总想找个地方把笔记记录下来。也让自己以后有个可以查找的地方。本来想放到大学空间里面那个自己用WP做的Blog,后来想想大学空间并不稳定,于是作罢。还是上Google来开块地方来写吧。

Followers