We are pleased to announce that Trusty is now open for translation:

https://translations.launchpad.net/ubuntu/trusty

* Translation caveats. Remember that according to the release schedule [1] translatable messages might be subject to change until the User Interface Freeze [2].
* Language packs. During the Trusty development cycle, language packs containing translations will be released twice per week [3] except for the freeze periods. This will allow users and translators to quickly see and test the results of translations.
* Test and report bugs. If you notice any issues (e.g. untranslated strings or applications), do check with the translation team [4] for your language first. If you think it is a genuine bug, please report it [5].

Happy translating! :-)

[1] https://wiki.ubuntu.com/TrustyTahr/ReleaseSchedule
[2] https://wiki.ubuntu.com/UserInterfaceFreeze
[3] https://dev.launchpad.net/Translations/LanguagePackSchedule
[4] https://translations.launchpad.net/+groups/ubuntu-translators
[5] https://bugs.launchpad.net/ubuntu-translations/+filebug

首先介绍下背景,Linux 音频系统非常不完全简史:

  •  1. OSS3 是 Linux 内核中比较老的声音系统,目前已逐渐废弃
  •  2. OSS4 开发的时候是闭源软件,所以 2002 年 ALSA 被用来替代 OSS3 作为 Linux 内核中的声音构架
  •  3. 2007 年的时候 4Front Technologies 发布了 GPL 版本的 OSS4,此时 ALSA 已成气候
  • 关于 ALSA,OSS4,PulseAudio 和 Jack 一知半解版介绍(Esd 等就此省略一万字):

  •  1. ALSA 目前是 Linux 内核上标准的音频框架,但是仅支持 Linux 系统,没有软件混响。对各种设备的支持非常全面。
  •  2. OSS4 由于错过时机而没能成为官方内核的一部分,但是它的跨平台性远好于 ALSA,支持 Windows、BSD 和许多 UNIX,其 API 据说也更适合开发。OSS4 有实时、低延时的特性,支持软件混响,所有操作在内核层实现。但是对 USB 设备的支持明显薄弱许多。
  •  3. PulseAudio 是为 POSIX 兼容环境设计的一个声音代理程序,内置软件混响。PulseAudio 可以将程序对声音系统的请求代理到 ALSA、OSS 等多种后端,甚至可以通过网络传输这些讯息。
  • 4. Jack 是一个专业级的声音服务系统,跨平台性强,其表现对内核的实时性要求较 PulseAudio 高一些,在一般的操作系统上 Jack 没有前者流行。
  • Ubuntu 默认使用 ALSA 作为底层声音驱动,程序则与 PulseAudio 交互,这是一个很不错的方案。然而作者偶尔会遇到 ALSA 被独占其他软件无法发声的问题,才随着 #ubuntu-cn 上的 OSS4 热潮赶了把时髦。

    换 OSS4 是要折腾的,折腾就是有风险的,以下为折腾的理由:

  • 1. 默认的 ALSA 在你的电脑上不能正常工作
  • 2. 纯粹喜欢 OSS4,不喜欢 ALSA
  • 3. 想要跟风折腾
  • 换 OSS4 的具体好处:
    1. 某些情况下音质更好
    2. 低延迟,低 CPU 占用
    3. 自带软件混响
    4. 文档更全面

    换 OSS4 的具体坏处:
    1. 有些硬件不被支持
    2. 对 midi 支持很差
    3. USB 声音设备支持仍处于试验性阶段
    4. 自己折腾可能会把系统声音系统搞跨

    开始说安装 OSS4 的具体方法。
    方法一
    到 OSS4 官方网站下载免费商业版, 下载页面
    选择相应的版本,比如 Linux 2.6 (x86) (DEB),点 Submit 获得下载链接。注意这个版本按许可证仅可以使用一年。
    得到 deb 文件后双击安装(或者 sudo dpkg -i oss-linux*.deb)。
    方法二
    Ubuntu 10.10 可以直接从软件仓库安装版本略旧的 OSS4:
    sudo apt-get install oss4-base oss4-dkms oss4-gtk
    Ubuntu 10.04 和 11.04 不可以使用这个方法,10.04 仓库中的 oss4-dkms 存在打包问题无法正确构建内核模块,11.04 因为内核新(linux >= 2.6.36)而 oss4 版本太老而无法成功构建内核模块。
    方法三
    如果你像我一样喜欢开源版,又喜欢折腾,那么我们一起来编译最新版的。
    首先安装 mercurial 以便取回最新版代码:
    sudo apt-get install mercurial
    取出代码:
    cd ~
    hg clone http://opensound.hg.sourceforge.net:8000/hgroot/opensound/opensound oss-devel

    创建编译目录,OSS4 需要在空目录编译:
    cd ~/
    sudo rm -rf oss42build
    mkdir oss42build

    编译并安装,假设你的主目录是 /home/aron:
    cd oss42build/
    NO_WARNING_CHECKS=yes /home/aron/oss-devel/configure --enable-libsalsa=NO
    make
    sudo make deb
    sudo dpkg -i oss*.deb

    安装结束,如果没有遇到错误接下来开始配置:
    1. 尽管 OSS4 内建了软件混响,我还是没有删除 PulseAudio,因为 Ubuntu 的桌面环境很多部件仅设置了 PulseAudio 后端。我不想一一折腾,而只是尽量让程序使用 OSS4,毕竟主要的播放器等都支持自定义音频输出。如果你也这样想,照下面做;如果你不想,跳过这段。

    A. 修改 PulseAudio 设置使其默认使用 OSS4 输出:
    gksu gedit /etc/pulse/default.pa
    添加一行:

      load-module module-oss device=”/dev/dsp” sink_name=output source_name=input mmap=0

    B. 配置 gstreamer 使用 OSS4 作为后端:
    安装 gstreamer0.10-plugins-bad
    sudo apt-get install gstreamer0.10-plugins-bad
    运行命令:
    gstreamer-properties
    将输入和输出均设置为 OSS。

    C. 设置 libasound 将传递给 ALSA 的声音请求转至给 OSS4:
    gksu gedit /etc/asound.conf
    添加以下内容:

      pcm.oss {
      type oss
      device /dev/dsp
      }

      pcm.!default {
      type oss
      device /dev/dsp
      }

      ctl.oss {
      type oss
      device /dev/mixer
      }

      ctl.!default {
      type oss
      device /dev/mixer
      }

    D. 配置启动时默认启用 OSS4 而非 ALSA:
    sudo dpkg-reconfigure linux-sound-base
    选择 OSS 而非 ALSA 或 default。

    然后重启电脑,系统级配置基本完成。然后可以给支持自定义音频系统的软件配置成使用 OSS4,比如 Audacious,Wine,Audacity,VLC, (s)mplayer,clementine。

    2. 如果你想删除 PulseAudio,也有办法,但是不保证所有程序都能正确输出声音。首先是按照前一种配置方法里的 B、C、D 调整设置,然后按照 E 和 F 对 PulseAudio 开刀。

    E. 使用 GStreamer 接管 GNOME 声音系统,安装为 GStreamer 后端编译的 libcanberra:
    sudo add-apt-repository ppa:dtl131/ppa
    sudo apt-get update
    sudo apt-get purge pulseaudio
    sudo apt-get upgrade

    F. 配置 Rhythmbox 等程序使用 Gstreamer (没错,还需要配置)
    运行:
    gconf-editor
    找到 system/gstreamer/0.10/audio/default,将其中所有仍被设置为 pulsesink 的键(如 musicaudiosink 和 chataudiosink)都改为 osssink。
    系统默认的音量控制插件会失效,因为它是基于 PulseAudio 的,可以在面板上单击右键,添加一个 GNOME 的声音控制。

    然后重启,应该绝大部分声音系统都没有问题了。可能存在的问题:
    1.Flash,需要安装 flashplugin-nonfree-extrasound 来获得支持 oss4 的 libflashsupport。
    2.Firefox,xulrunner 无法编译成同时支持 Alsa 和 OSS4,所以可能有问题。

    FAQ

    1. 声音输入不能用,或者有噪音
    运行命令:
    ossxmix
    在显示的界面里把 pink 下拉菜单中选成 input,勾选界面里所有的 input-mix 和 input-mix-mute,然后在 pink 处拖动滑块减小音量,一般以 80% 上下为宜,否则会有噪音。

    2. 如何查看是否已经加载了 OSS4 内核模块,以及我的声卡用了什么模块?
    运行命令:
    lsmod | grep -i oss
    比如我是 HD Audio,输出如下:

      oss_usb 104136 1
      oss_hdaudio 144219 3
      osscore 545146 2 oss_usb,oss_hdaudio

    3. 如何查看我的声卡型号?
    lspci | grep -i audio

    4. 64 位系统能用吗?
    能,没问题。

    5. KDE4 用 Phonon,能用吗?
    Phonon 默认应该可以直接检测到 OSS4。KDE 4.0.x 用 Xine 后端时可能无法使用。

    6. 用什么调节音量?
    如果保留了 PulseAuido,则使用它的程序可以用原来的音量控制,如果是用 Gstreamer,则可以使用 GNOME 的音量控制程序。
    当然,也可以直接使用 ossxmix 工具调整,或者例如 xfce-oss、kmix 这样的工具。

    不想用 OSS4 了,怎么复原?
    我针对上面的 A B C D E F 分别说需要的操作。

    A. 恢复 PulseAudio 默认的硬件检测
    gksu gedit /etc/pulse/default.pa
    删除添加的行。

    B. 配置 gstreamer 使用 PulseAudio 作为后端
    运行命令:
    gstreamer-properties
    将输入和输出均设置为 PulseAuido。
    如果你不想要 gstreamer0.10-plugins-bad,可以删除它:
    sudo apt-get purge gstreamer0.10-plugins-bad

    C. 设置 libasound 使用 ALSA:
    删除 /etc/asound.conf 中增加的所有行。如果你开始折腾 OSS4 之前没有对它做过修改,直接删除就行:
    sudo rm /etc/asound.conf

    D. 配置启动时默认启用 ALSA:
    sudo dpkg-reconfigure linux-sound-base
    选择 ALSA。

    E. 换回支持 Gstreamer 和 PulseAudio 的 libcanberra 后端:
    安装必须的软件:
    sudo apt-get install pulseaudio indicator-sound libcanberra-pulse libcanberra-gstreamer pulseaudio-esound-compat pulseaudio-module-bluetooth pulseaudio-module-gconf pulseaudio-module-x11 ppa-purge
    删除添加的 PPA:
    sudo ppa-purge ppa:dtl131/ppa
    sudo apt-get update

    如果还不能正常,就手工降级所有相关软件包(是挺恶心的,但是没别的办法),可以在新立得里用“本地的或陈旧的”过滤器帮你确定是哪些包。

    F. 配置 Rhythmbox 等程序使用 PulseAudio
    运行:
    gconf-editor
    找到 system/gstreamer/0.10/audio/default,将其中所有仍被设置为 osssink 的键都改为 pulsesink。

    然后把所有前面修改过使用 OSS4 的程序都换回使用 PulseAudio,重启系统。

    有用的资料:
    1. 为常见应用程序配置 OSS4:Configuring Applications for OSSv4
    2. 故障处理:OSSv4 Troubleshooting
    3. Archlinux Wiki 上的 OSS 页面:英文 中文

    I am trying to keep this article concise for you to make you have an outline of current condition of Linux (and maybe other platforms like BSDs) input methods. It’s coverage is mostly CJK languages, but I think other languages that use input method would be sure to find there examples in this article. We will start with the most popular ones, and there will be some hints about other ones at last.

    Before we start our tour, there are two concepts to know, input method framework and input method engine:

  • An input method framework is designed to serve as a daemon and handle user input events, output the result to target applications or layers.
  • An input method engine is a program to analyze inputed characters and calculate a list of probably results, then send the results to their hosted input method framework to complete the reaction with users and applications.
  • 1. SCIM (Smart Common Input Method)

    Most Linux input method users may have the experience of using SCIM, which is created by Chinese developer Su Zhe for promoting his Intelligent Pinyin input method and providing a better input method framework.

    Some friends of mine are still keep using SCIM even though it is not being maintained, nor SKIM, its sister project on KDE. SCIM was the default choice of distros for years. People developed lots of input method engines for it, for example scim-pinyin, which has been mentioned above as Intelligent Pinyin input method. Users may be also familiar with scim-python, scim-xingma-*, scim-googlepinyin and the still-maintained scim-sunpinyin.

    On a distro maker’s point of view, the glorious age of SCIM has just finished.

    2. IBus (Intelligent Input Bus)

    IBus is the de facto standard of input method framework on nowadays Linux distros, whose author is a Chinese developer, Huang Peng, who has been mentioned as the author of scim-python and scim-xingma-*. IBus is aiming at a “next generation input framework” comparing to SCIM. I think this goal has been achieved – new comers may only know IBus from the very beginning of his adventure on Linux.

    IBus is written in C++, and is designed to be highly modularized: core input bus, gtk/qt interfaces, python binding, table engine, table modules and other input method engines. It uses Gtk immodule, thus is the best choice for GTK+ applications. What’s more, Flash Player support Gtk immodule only and IBus has no problem to work with it. The author of IBus is really helpful with other input engine developers, so there are many input method engines available on IBus framework.

    But IBus has obvious limitations from its design:

  • Firstly, it uses Gtk immodule only, which benefit GTK+ platform applications, but do poorly with QT.
  • Secondly, it depends on gconf, which is unacceptable for some users and distro makers (most of them are anti-gnome holic).
  • Thirdly, the most used input engine, ibus-pinyin is written in Python that caused serious performance limitation. And this engine has had some severe bugs like memory leak and dead loop (100%). Even though the condition is largely improved, users are still complaining about them.
  • Fourthly, the alternative Pinyin engine ibus-sunpinyin is not well maintained, and really lacks of testing. There are some obvious bug leaving their without people interested to fix.
  • Note: ibus-pinyin has been rewritten in mainly C++ with many improvements, and such changes will land on major in very near future (maybe some of them have already published it, I didn’t do a detailed research here).

    3. Fcitx (Free Chinese Input Toy for X)

    Fcitx is an old and new input method. It bears at the same time as SCIM, and now gets a new life with the brand new 4.x series. As name suggests, it is first designed to be a Chinese specific input method by Yuking. During 3.x series, the aim of being a feature rich Chinese input method gave it quite a few of fans, but also kept it from being a default choice of major distros. Fcitx uses XIM, which works well for most platforms (like GTK+ and QT), but has some small problems.

    However, starting from 4.x series, Fcitx has been given a new goal with a new maintainer – a college student at Peking University, Weng Xuetian. Now he has published 4.0.1, the second version of 4.x series, with features like customizable skins, tables which has been wanted for a long time. It has been heavily modularized: all tables are separated, developer-friendly input method engine interface, graphic user configuration tool. Also, 4.x series does not use GBK encoded Chinese configuration files anymore, and UTF-8 encoded English configuration files are used. I would like to highlight its perfect user experience of fcitx-sunpinyin, it is worthwhile for every Pinyin users to give a try.

    There are still issues on its way of (probably) being the default of distros:

  • Though the author has promised Gtk immodule support in 4.1.0 release, the feature is still not available now.
  • The internal Pinyin input method is old, and still not being separate out from the framework core because of too close integration before. The work will be done in 4.1.0 as well.
  • Fcitx is still lacking of people who are interested in developing input method engines, even if the interface is more friendly to developers. There is an example, fcitx-sunpinyin (written in C++) has only ~300 lines to make everything work perfectly with libsunpinyin.
  • Properly speaking, Fcitx is still not a input method framework because of the reasons listed above, but it will be, also as said above.

    Above are the most famous input methods, here is a list of other things in Linux input methods with short descriptions.

    1. ucimf (Unicode Console Input Method Framework)

    ucimf is an input method framework for Linux unicode framebuffer console, which is mainly with fbterm and jfberm. It is developed by Chinese developer, Mat. He maintains a series of input method engines ported from BSD licensed Mac OSX input method OpenVanilla.

    There are other solutions under framebuffer console, for example ibus-fbterm (development has stopped), but I still recommend to use ucimf because it full featured and well maintained.

    2. SunPinyin

    One thing to clarify, Sunpinyin isn’t a frame work, but it is important so I would like to mention it here. We have mentioned scim-sunpinyin, ibus-sunpinyin and the recommended fcitx-sunpinyin. In fact there is also a standalone xsunpinyin alive. SunPinyin is a statistical language model based Chinese input method, which was firstly developed by Sun Beijing Globalization team, and opened source to community with Opensolaris project, with LGPLv2 and CDDL dual-licenses.

    SunPinyin would be heavily used from now on, it is the best Pinyin engine on Linux and some other platforms.

    3. SCIM2
    SCIM2 was trying to be a next generation SCIM, but abandoned because of the emerging star during that period – IBus.

    4. ImBus

    ImBus is created by the author of SCIM, and he would like to make it a general input method framework including all known best techniques with minimal dependencies. But the project halted with the same reason like SCIM2, no code in its svn repository.

    5. Fitx (Fun Input Toy for Linux)

    Fitx was a flash in the pan on Linux, the project stopped soon after its emerging. Fitx is a ported version of FIT input method on Mac OSX, but implemented using SCIM framework.

    6. gcin
    gcin is a input method developed by traditional Chinese community, targeted to traditional Chinese users.

    7. uim

    uim is a input method framework made by Japanese developers. It is a little different because uim isn’t an input method server (XIM is a server), it’s just a library. Because the designer believe many people don’t need a full featured platform but only something enough to work.

    For information about input method types, there is a good website: http://seba.studentenweb.org/thesis/im.php

    Update:
    2011-01-15 21:30
    Thanks to Zhengpeng Hou, I’ve added some description about uim, and a notice about whether fcitx should be considered as a framework now.
    2011-01-28 00:15
    Thanks to Shawn P Huang, ibus-pinyin has been rewritten in mainly C++ with many improvements.

    原文发表于 Ubuntu 中文邮件列表,欢迎大家到邮件列表参与讨论。

    这两天讨论了一些拼音输入法的话题,我做个小小的总结,欢迎讨论。

    眼下 Ubuntu 默认的输入平台是 ibus,随光盘发布 ibus-pinyin,默认的五笔输入法是 ibus-table-wubi,繁体中文默认输入法是 ibus-chewing。

    我只会用拼音,五笔和酷音的情况不了解。下面我简单总结下我所知的几个常见输入法的情况,也看看各位认为将来 Ubuntu 默认使用哪个更好。

    1. IBus

    ibus 平台目前是各大发行版的标配,框架本身用 C++ 写成,模块化程度非常高,有很多可选的输入法。作者在继续开发,对输入法开发者也比较热情。

    ibus-pinyin 最初是 python 写成的,这些版本的效率略逊一筹,其中还出现过一些 CPU 100% 和内存泄露的 bug。ibus-pinyin 后来已经主要用 C++ 重写并做了非常多的改进,但是因为发行版的原因迟迟没有进入到仓库,接近纯 C++ 版本的 ibus-pinyin 会出现在 11.04 中。

    ibus 的拼音还可以选择 ibus-sunpinyin,但是使用的人比较少,反馈也比较少。

    ibus 是使用 gtk immodule的,这使得它在 GTK 程序里表现非常出色,可以在 flash 里输入中文,但是在 QT 程序上表现一般。可以说它主要是 GTK 的输入平台。

    2. Fcitx

    fcitx 是老牌的 Linux 中文输入法,有一些粉丝,不过很多人对它的印象还是基于 GBK 中文配置文件的 3.x。新的 fcitx 4 已经使用英文 utf8 配置文件,支持自定义皮肤和码表,改进了输入法接口,新增了图形化配置工具。Bug 也不比 ibus 多。

    fcitx 的最佳拼音方案是 fcitx-sunpinyin。上词准确度和所有 sunpinyin 核心的输入法相同。相比于 ibus-sunpinyin 和 scim-sunpinyin,它的优势在于可以利用 fcitx 本身的各种功能(比如皮肤),流畅性和fcitx 内置拼音输入法没什么差别。

    fcitx 的问题有以下几个:1. 内置的 pinyin 输入法还没能独立成为模块,且它的算法也已经落后;2. 虽然给 fcitx 写输入法已经比 ibus 更简单,却仍然缺乏关注,可用的输入法比 ibus 少一些。

    fcitx 使用 XIM,更接近是一个 X 的输入平台。但是 flash 不支持 XIM,某些光标跟随也有点小毛病。4.1 版本会有 gtk immodule 支持,上述问题会一并解决。

    3. Scim

    scim 平台是曾经各发行版的标配,scim-pinyin 的输入流畅性也始终好于 ibus-pinyin,相信有一些人仍然坚守在 scim 的阵地上。然而 scim 和它在 kde 上的 skim 都没有人在进行维护,Debian/Ubuntu 也只是打包人员偶尔修复几个简单的 bug。我们不可能逆行回去再使用它。

    scim 的拼音输入法有 scim-pinyin,scim-python,scim-googlepinyin 和 scim-sunpinyin,前三者目前都没有人维护。推广 scim-pinyin 的智能拼音输入法是作者开发 SCIM 的原因;scim-python 是 ibus-pinyin 的前身;scim-googlepinyin 是用 android 上输入法的算法写成的。

    4. Yong

    yong 是最近曝光率有点高的小小输入法,作者说是为了推广他的永码而开发。我没有使用过它,仅从配置文件看猜它是同 fcitx 一样使用了XIM,因此也会受 XIM 的各种问题影响。yong 是闭源软件,不论是许可证原因,还是平台移植性原因,都不可能被主流发行版作为默认输入法。当然,给用户多一个选择总是好事。

    Update:
    2011-01-28 00:15
    感谢 Shawn P Huang,Shellexy 和 BYBird,更新了 ibus-pinyin 的部分,说明新版已经用 C++ 重写,并已经改进了很多地方。

    Unzip 5.x has an option -O to specific the encoding of file names in an ZIP archive, but when 6.0 is arriving with unicode support, that option disappeared as well. CJK users need special cares on support and conversion of obsolete encoding while they are switching to utf-8.

    Here is my workaround about this problem, install p7zip and convmv packages on your system first, then:
    $ env LC_ALL=C 7z x file.zip
    $ convmv -f gbk -t utf8 --notest *

    File names extracted by unzip are not able to be converted to correct one whatever you do with it, but what is done by 7z can be converted by convmv.

    Moving more on, we can automate this action to a script:
    #! /bin/sh
    LANG=C /usr/bin/7z x -y "$1" | sed -n 's/^Extracting //p' | sed '1!G;h;$!d' | xargs convmv -f gbk -t utf8 --notest >/dev/null 2>/dev/null

    Save it us unzip.sh, then try:
    $ sh unzip.sh file.zip
    This will act as what unzip does, but with additional care about converting file name encoding from gbk to utf-8. Moreover, convmv can detect whether your file name is already utf-8 encoded and will skip it.

    If your file names are encoded other encoding, please replace “gbk” with the appropriate name.

    One of my friend planed to start an Ubuntu source services through the support of his college, so I helped him to do that. It’s also the first time for me, but I think it’s not so complex.

    1.Determination about what you really want to serve

    There are two kinds of mirrors, one served as archive and another release. Follow the instructions on http://www.ubuntu.com/getubuntu/mirror, we know that we need how much disk to host them.

    Of course my friend want to serve as an archive because that can be more beneficial. On his first stage, he doesn’t want to host the whole mirror, just for the latest version – Ubuntu 9.04 for a test run. This will cost less than 200GB disk storage.

    2.Considerations about hardware

    As a mirror which serves many file transfers, we need good hard disks as well as good Internet link, the disk space is the more the better, and of course the link speed is the faster the better,:)

    But for my friend, on the first stage, he cannot choose them because now should be a qualification for his college, if he’s going well, soon he can do it as a big project.

    3.Decisions on software

    Firstly, we need to choose an operating system.
    Here I recommend Debian, Ubuntu Server and CentOS to my friend, he finally chose Debian lenny with its ext3 file system. In my opinion, the server will deal with mostly files, so we need a platform to make our work easier. Consider about ext4, that’s a good file system.

    Secondly, we need to chose a software to handle the HTTP requests and another for FTP. Just like what I have repeated for times, we just serve files, so we don’t need PHP and other web application at all. For this reason, Apache may not be a good choice. Here we choose Nginx for HTTP service, and vsftpd for FTP service and installed with debian packages, we don’t need to compile them because there is not alternative changes need to be done. Lighttpd is also a good candidate for HTTP. The configuration process is kind of troublesome, we spent too much time to do it than expected. All in all, it can work well finally.
    Here are the configuration files for both software:
    1)nginx:/etc/nginx/nginx.conf & /etc/nginx/sites-enabled/default

    a) /etc/nginx/nginx.conf:

    user www-data www-data;
    worker_processes  3;
    error_log  /var/log/nginx/error.log;
    pid        /var/run/nginx.pid;
    worker_rlimit_nofile 51200;
    events {
    use epoll;
    worker_connections  51200;
    }
    http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    access_log  /var/log/nginx/access.log;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 16m;
    sendfile        on;
    tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;
    gzip  on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types       text/plain application/x-javascript text/css application/xml;
    gzip_vary on;
    limit_zone   limit  $binary_remote_addr  10m;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    }

    b)/etc/nginx/sites-enabled/default:

    server {
    listen   80;
    //replace the server_name section with your real server name.
    server_name  repo.domain;
    access_log  /var/log/nginx/repo.access.log;

    location  / {
    root   /var/repo;
    index  index.html index.htm;
    limit_conn   limit  50;
    autoindex on;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    root   /var/www/nginx-default;
    }
    }

    2)vsftpd: /etc/vsftpd.conf

    anonymous_enable=YES
    anon_root=/var/repo/
    local_enable=NO
    write_enable=NO
    local_umask=022
    dirmessage_enable=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    xferlog_std_format=YES
    idle_session_timeout=60
    data_connection_timeout=120
    ftpd_banner=Welcome to NJNU Ubuntu FTP mirror service.
    listen=YES
    listen_ipv6=NO
    pam_service_name=vsftpd
    tcp_wrappers=YES

    Thirdly, get rsync work, here is an script to do it:

    #!/bin/sh
    RSYNCSOURCE=rsync://archive.ubuntu.com/ubuntu
    BASEDIR=/var/repo/
    rsync –recursive –times –links –hard-links
    –stats
    –exclude “Packages*” –exclude “Sources*”
    –exclude “Release*”
    ${RSYNCSOURCE} ${BASEDIR}
    rsync –recursive –times –links –hard-links
    –stats –delete –delete-after
    –exclude “project/trace/${HOSTNAME}”
    ${RSYNCSOURCE} ${BASEDIR}

    This script will do a two-stage rsync, so it can secure that users won’t get error while we are running rsync.
    Then add this script to the crontab of a specific user, so that it will run every 24 hours.

    5.Long-term maintainance

    It’s simply a server, so you need to care about issues about the stablity, security and also think about the development of your own source server. You may need to consider if you want to be an official mirror or just a private one.

    Hello world!

    2009/05/17

    Hi everyone,

    I use this blog to communicate with you about technique related issues.