Ubuntu 9.04 安装手记

此次安装是在一台 Dell OptiPlex 740 台式机上进行,处理器 AMD Athlon 64 X2 4400+,显卡 nVIDIA GeForce 6150,声卡 SigmaTel STAC9200。Ubuntu 版本为 9.04 Jaunty Jackalope Alpha 5 amd64 位版,硬盘安装。

1. 硬盘安装时在分区那步仍无法列出分区表,需要 Ctrl-Alt-F2 进入控制台 2 手动 umount -l /hd-media 后重试。

2. 开箱显示正常,但 Compiz 3D 特效无法开启,可能因为没有可用的受限驱动。

3. 默认 ALSA 驱动不支持该声卡,但选择 OSS 驱动可以支持(很奇怪)。必须在音量设备那开启对 capture 设备,才能录入声音,此时可以使用 ALSA 驱动。在使用 Mplayer、SMplayer 之类播放器播放视频时,需要手动在选项中选择声音输出的驱动为 OSS。

4. 安装 smplayer 之后即支持 avi 格式解码,不用手动下载 codecs。在播放 720p 以上高清视频时,最好将 smplayer 的本地缓存调整为 10M 以上(默认为2M),否则容易引起底层 mplayer 内存问题,会无法播放、内存占用过大死机或崩溃。

5. Socks 代理软件 Dante 源代码在该 x86_64 平台上编译后运行会出现段错误;更换为 antinat,经源码编译后运行正常。

6. Libfetion for 64 位 deb 包不可用,异常退出;经源码编译后运行正常。

7. sendsms 编译为 64 位版本会出现段错误,但短信仍能发送成功。

9. 网易的 Ubuntu 软件仓库镜像不包含 Jaunty,cn 的镜像没有总镜像快,security 的连接速度太慢。正式发布后,网易已经有了 Jaunty 源。

10. 使用 Firefox 时可直接安装 Adobe Flash Player 10 64 位版本。

11. 新的状态通知很漂亮,可以显示 Pidgin 上好友的登录和短讯。

12. 根分区使用 ext4 文件系统,数据分区为了与其它系统保持共享仍采用 ext3 文件系统。

13. 安装中文支持时可以选择是否安装该语言用户常用软件,选择是则会增加 PCManX、StarDict 等软件。PCManX 中包含非常全的港台和大陆 BBS 地址簿,但是字体有问题,未解决;QTerm 5.3 会崩溃。

14. 传说中的启动加速没有明显感觉,也许是因为启动的服务太多。

15. Ubuntu 9.04 Jave 程序中文显示不正常,部分文字变成方格。文泉驿字体从 wqy-zenhei.ttf 改为 wqy-zenhei.ttc,导致 java 程序中文字体显示不正常。在 /etc/java-6-sun/fontconfig.properties 中添加 wqy 相关内容,diff 文件可以从这里下载。Java 貌似不可用 ttc 字体,从 8.04 拷来 wqy-zenhei.ttf 到 /usr/share/fonts/truetype/wqy 目录下可解决,wqy-zenhei.ttf 也可以从这里下载。

16. 在另一台笔记本 Dell D630 上安装 9.04 正式版时,发现居然默认不支持 NVS135M 视频驱动,需要配置好网络后,使用命令 sudo apt-get install nvidia-glx-180 安装 Nvidia 180 版本的驱动,或者自己到 NV 网站上下载最新驱动。

在双系统环境中使用Windows字体美化Linux中文字体

安装完 Linux 操作系统的中文支持后,看到那些难看的字体是不是很不爽,下面这个脚本就帮助你使用 Windows 字体来自动美化 Linux 中文字体。

下面的脚本使用 windows 自带字体美化 Linux 字体,主要是将软件中文字体使用宋体,终端使用黑体替换。脚本源程序可以在 http://share.solrex.org/scripts/install_win_CN_fonts_to_linux.sh 下载到。

首先确保 windows 系统所在分区被挂载到 /media 目录下将以下内容保存为脚本文件:install_win_CN_fonts_to_linux.sh

#!/bin/bash
check_answer()
{
    case $1 in
        y|Y|Yes|yes|YES)
            return 0;
            ;;
        n|N|No|no|NO)
            return 1;
            ;;
        *) echo "Answer either yes or no, default is yes"
            return 2
            ;;
    esac
}

LIN_FONTS_DIR=/usr/share/fonts/zh_CN/TrueType
LANG_SEL_FILE=/etc/fonts/language-selector.conf
SEARCH_DIR=/media

echo -n "This script is for installing Windows Chinese fonts to Linux on a dual-OS-installed computer. And the writer doesn't promise it will work on your system. Do you want to continue?(y/n)[y]:"
read ANS_STR
: ${ANS_STR:="y"}
check_answer $ANS_STR
ANS=$?
if [ $ANS -ne 0 ]; then
    echo "Exit."
    exit
fi

echo -n "There might be license problems, i.e. you have no permission to use Windows fonts in other program except Windows OS. Do you want to continue?(y/n)[y]:"
read ANS_STR
: ${ANS_STR:="y"}
check_answer $ANS_STR
ANS=$?
if [ $ANS -ne 0 ]; then
    echo "Exit."
    exit
fi

echo -n "You run this script with root account or "sudo" command?(y/n)[y]:"
read ANS_STR
: ${ANS_STR:="y"}
check_answer $ANS_STR
ANS=$?
if [ $ANS -ne 0 ]; then
    echo "Exit."
    exit
fi

echo -n "You mounted Windows System partation "C:\" to /media directory?(y/n)[y]:"
read ANS_STR
: ${ANS_STR:="y"}
check_answer $ANS_STR
ANS=$?
if [ $ANS -ne 0 ]; then
    echo "Exit."
    exit
fi

echo "Searching for windows's fonts directory..."
echo "That may take a few minutes, please wait."
WIN_FONTS_DIR=`echo $(find $SEARCH_DIR -name simsun.ttc -type f) | sed s/simsun.ttc//g`
if [ -d $WIN_FONTS_DIR ]; then
    while true; do
        echo "Windows fonts dir found! Your windows fonts directory is: "
        echo -n ""$WIN_FONTS_DIR" Is it right?(y/n)[y]:"
        read ANS_STR
        : ${ANS_STR:="y"}
        check_answer $ANS_STR
        ANS=$?
        if [ $ANS -eq 0 ]; then
            break
        elif [ $ANS -eq 1 ]; then 
            echo "Please enter path to your windows fonts dir?"
            read ANS_STR
            if [ -d $ANS_STR ]; then
                WIN_FONTS_DIR=$ANS_STR
                break
            else
                echo "Your input is not a dir. Exit."
                exit
            fi
        else
            echo "Unrecognized input."
        fi
    done
else
    echo "Can not find windows fonts directory. "
    echo -n "Please enter path to your windows fonts dir:"
    read ANS_STR
    if [ -d $ANS_STR ]; then
        WIN_FONTS_DIR=$ANS_STR
    else
        echo "Your input is not a dir. Exit."
        exit
    fi
fi

echo "Entering $WIN_FONTS_DIR"
cd $WIN_FONTS_DIR

echo "Creating Linux fonts directory: $LIN_FONTS_DIR..."
mkdir -p $LIN_FONTS_DIR
if [ $? -ne 0 ]; then
    echo "Creating Linux fonts dir failed. Exit."
    exit
fi

echo "Copying windows fonts to linux fonts dir... sim*|tahoma|tohomabd.ttf"
cp sim* SimSun18030.ttc tahoma.ttf tahomabd.ttf $LIN_FONTS_DIR
if [ $? -ne 0 ]; then
    echo "Copying windows fonts to linux fonts dir failed. Exit."
    exit
fi

echo "Changing font files' access permissions.."
chmod 644 $LIN_FONTS_DIR/*

echo "Entering $LIN_FONTS_DIR"
cd $LIN_FONTS_DIR

echo "Creating an index of scalable font files in $LIN_FONTS_DIR for X..."
mkfontscale
if [ $? -ne 0 ]; then
    echo "Creating an index of scalable font files for X failed. Exit."
    exit
fi

echo "Creating an index of X font files in $LIN_FONTS_DIR"
mkfontdir
if [ $? -ne 0 ]; then
    echo "Creating an index of X font files in $LIN_FONTS_DIR failed. Exit."
    exit
fi

echo "Creating an index of FreeType font files in $LIN_FONTS_DIR"
fc-cache $LIN_FONTS_DIR
if [ $? -ne 0 ]; then
    echo "Creating an index of FreeType font files in $LIN_FONTS_DIR failed. Exit."
    exit
fi

echo "Backing up $LANG_SEL_FILE"
if [ -f $LANG_SEL_FILE ]; then
    cp $LANG_SEL_FILE $LANG_SEL_FILE.bak
fi

echo "Generating new $LANG_SEL_FILE... for language select"
echo '
<fontconfig>
  <alias>
    <family>serif</family>
      <prefer>
        <family>Bitstream Vera Serif</family>
        <family>SimSun</family>
        <family>DejaVu Serif</family>
        <family>AR PL ShanHeiSun Uni</family>
        <family>AR PL ZenKai Uni</family>
      </prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
      <prefer>
        <family>Bitstream Vera Sans</family>
        <family>SimSun</family>
        <family>DejaVu Sans</family>
        <family>AR PL ShanHeiSun Uni</family>
        <family>AR PL ZenKai Uni</family>
      </prefer>
  </alias>
  <alias>
    <family>monospace</family>
      <prefer>
        <family>DejaVu Sans Mono</family>
        <family>Bitstream Vera Sans Mono</family>
        <family>SimHei</family>
    </prefer>
  </alias>

<match target="font" >
  <test name="family" compare="contains" >
    <string>Song</string>
    <string>Sun</string>
    <string>Kai</string>
    <string>Ming</string>
  </test>
  <test compare="more_eq" target="pattern" name="weight" >
    <int>180</int>
  </test>
  <edit mode="assign" name="embolden" >
    <bool>true</bool>
  </edit>
</match>

<match target="font" >
  <test name="family" compare="contains" >
    <string>Song</string>
    <string>Sun</string>
    <string>Kai</string>
    <string>Ming</string>
  </test>
  <edit name="globaladvance">
    <bool>false</bool>
  </edit>
  <edit name="spacing">
    <int>0</int>
  </edit>
  <edit name="hinting">
    <bool>true</bool>
  </edit>
  <edit name="autohint">
    <bool>false</bool>
  </edit>
  <edit name="antialias" mode="assign">
    <bool>true</bool>
  </edit>
  <test name="pixelsize" compare="less_eq">
    <int>18</int>
  </test>
  <edit name="antialias" mode="assign" >
    <bool>false</bool>
  </edit>
</match>

<match target="pattern">
  <test name="family">
    <string>SimSun</string>
    <string>SimSun-18030</string>
    <string>AR PL ShanHeiSun Uni</string>
    <string>AR PL New Sung</string>
    <string>MingLiU</string>
    <string>PMingLiU</string>
  </test>
  <edit binding="strong" mode="prepend" name="family">
    <string>Tahoma</string>
    <string>Verdana</string>
  </edit>
</match>

<match target="pattern">
  <test name="family">
    <string>宋体</string>
  </test>
  <edit name="family" mode="assign">
    <string>SimSun</string>
  </edit>
</match>
<match target="pattern">
  <test name="family">
    <string>新宋体</string>
  </test>
  <edit name="family" mode="assign">
    <string>SimSun</string>
  </edit>
</match>
<match target="pattern">
  <test name="family">
    <string>仿宋_GB2312</string>
  </test>
  <edit name="family" mode="assign">
    <string>FangSong_GB2312</string>
  </edit>
</match>
<match target="pattern">
  <test name="family">
    <string>楷体_GB2312</string>
  </test>
  <edit name="family" mode="assign">
    <string>KaiTi_GB2312</string>
  </edit>
</match>
<match target="pattern">
  <test name="family">
    <string>黑体</string>
  </test>
  <edit name="family" mode="assign">
    <string>SimHei</string>
  </edit>
</match>
</fontconfig> ' > $LANG_SEL_FILE
echo "Finished. Please quit your X session and relogin."
echo "If you have problems on start X(sometimes happened on Ubuntu 7.04.), please delete $LIN_FONTS_DIR and copy the backuped $LANG_SEL_FILE.bak to $LANG_SEL_FILE. Then do "fc-cache" with no options. That may work."

执行:
sudo sh ./install_win_CN_fonts_to_linux.sh

登出 Xwindow,再重新登录即可。