新版 Fedora 软件维护者指南

Written by liangsuilong. Posted in 业界资讯

拖了近一年的时间,终于有时间有精力更新这一篇文档。 本次更新包含的内容主要有:
  • 因应自 Fedora 14 以来的改变,汇入 SRPM 包部分和更新已有软件包部分的内容从 CVS 改成 Git。
  • 增加 RPM Fusion Packager 的相关内容。
  • 修正格式和用字不当。
原文地址请点击此处,如有错漏,请不吝指教。 原文地址请点击<a href=”https://fedoraproject.org/wiki/Fedora_%E6%96%B0%E8%BD%AF%E4%BB%B6%E7%BB%B4%E6%8A%A4%E8%80%85%E6%8C%87%E5%8D%97″ target=”_blank”>此处</a>,如有错漏,请不吝指教。

Fedora 的 fcitx 计划

Written by liangsuilong. Posted in 业界资讯

刚刚应 CSSlayer 和 Aron Xu 的要求,把 Fedora 的 fcitx 细分成多个 sub package,最主要的是把各个码表分离开。 以前的做法是把码表一并放在 fcitx 这个 sub package 里面,但是很多人并不是需要安装所有码表,因此现在的做法是增加多个 sub package 以打包各种码表。 fcitx-table-bingchan 是冰蟾的码表,fcitx-table-erbi 则是二笔的码表,fcitx-table-cangjie 则是仓颉的码表,fcitx-table-dianbaoma 是电报码的码表,fcitx-table-wanfeng 是万峰的码表,fcitx-table-wubi 是五笔的码表,fcitx-table-wbpy 是五笔-拼音的码表,fcitx-table-ziranma 是自然码的码表。所以现在安装新版 fcitx,就只能自带拼音输入法的码表,其他码表需要自行安装。 细分下来,实际上是挺多,spec 文件已经超过 300 行了。以后或许会默认加入更多的码表,spec 文件的行数也会不断得增加。你很难想象维护一个输入法要维护一个超过 500 行的 spec 文件。如果我放弃维护这个软件包了,一个如此长的 spec 文件让别人接手也是一个很大的问题。 同样在 fcitx-4.1 分支中,CSSlayer 增加了 fcitx 的 gtk2、gtk3 和 qt4 的模块,以后可能会加入 m17n 的支持,如果还在包所有的东西包在同一个源代码包里面的话,写 spec 也够辛苦了,说不定是会变成一个有 1000 行的 spec。而且码表、m17n 和图形库的输入法接口未必需要跟着输入法主程序一直同步更新。很多时候主程序更新多次以后码表和 m17n 也不用更新也可以直接用,同样图形库的接口也一样。所以我希望在源代码分包是 fcitx 主程序和相关的库组成一个源代码包 fcitx,中文码表一个源代码包 fcitx-table,图形库接口一个源代码包 fcitx-bridge,另外以后的 m17n 一个源代码包 fcitx-m17n。上述猜想还得和 CSSlayer 商量。

ubuntu 下快速安装交叉编译工具

Written by zwxie. Posted in 业界资讯

开始做嵌入式开发的朋友都在前期配置交叉编译工具而烦恼,网上的交叉编译工具的教程很多,但是要么很繁琐要么就是资料不全。那么怎么样快速而又简单地配置交叉编译工具呢,我们现在就用ubuntu里面的apt-get工具快速安装交叉编译工具。 1,添加一个源到/etc/apt/sources.list里,
           sudo gedit /etc/apt/sources.list
           deb http://www.emdebian.org/debian/ stable main
保存关闭;更新一下源列表
         sudo apt-get install emdebian-archive-keyring
         sudo apt-get update
3.更新成功后;我们开始安装arm 交叉编译环境
        sudo apt-get install gcc-4.4-arm-linux-gnueabi
        sudo apt-get install gcc-4.4-arm-linux-gnueabi-base
        sudo apt-get install gcc-4.3-arm-linux-gnueabi
        sudo apt-get install gcc-4.3-arm-linux-gnueabi-base
        sudo apt-get install libc6-dev-armel-cross
        sudo apt-get install binutils-arm-linux-gnueabi
4.测试,输入arm,然后会出现自动补全,就证明环境变量起效了,再补全输入
        arm-linux-gnueabi-gcc -v
出现如下面这样,就证明安装成功了:
       Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.5-4' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.3.5 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-sjlj-exceptions --enable-checking=release --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi
Thread model: posix
gcc version 4.3.5 (Debian 4.3.5-4)
补充:在sudo apt-get install gcc-4.4-arm-linux-gnueabi时,遇到了这样的问题: ubuntu:~$ sudo apt-get install gcc-4.3-arm-linux-gnueabi Reading package lists… Done Building dependency tree Reading state information… Done You might want to run `apt-get -f install’ to correct these: The following packages have unmet dependencies: gcc-4.3-arm-linux-gnueabi: Depends: gcc-4.3-arm-linux-gnueabi-base (= 4.3.5-4) but it is not going to be installed Depends: cpp-4.3-arm-linux-gnueabi (= 4.3.5-4) but it is not going to be installed Depends: binutils-arm-linux-gnueabi (>= 2.19.1) but it is not going to be installed Recommends: libc6-dev-armel-cross (>= 2.5) but it is not going to be installed libmpfr4: Depends: libgmp10 but it is not installable E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solution). 解决办法: ubuntu:~$ sudo apt-get install libc6-dev-armel-cross ubuntu:~$ sudo apt-get install binutils-arm-linux-gnueabi 安装libmpfr4,下载地址:http://www.anheng.com.cn/debian/pool/main/m/mpfr4/libmpfr4_3.0.0-9_i386.deb ubuntu:~$sudo dpkg -i libmpfr4_3.0.0-9_i386.deb ubuntu:~$ sudo apt-get install cpp-4.3-arm-linux-gnueabi 安装libgmp10,下载地址:http://www.anheng.com.cn/debian/pool/main/g/gmp/libgmp10_5.0.1+dfsg-7_i386.deb ubuntu:~$sudo dpkg -i libgmp10_5.0.1+dfsg-7_i386.deb ubuntu:~$ sudo apt-get install gcc-4.3-arm-linux-gnueabi-base ubuntu:~$sudo apt-get install gcc-4.4-arm-linux-gnueabi

怎样将Ubuntu Linux变成Windows 7的模样

Written by zwxie. Posted in 趣味分享

Ubuntu具备相当不错的桌面主题系统、视觉效果和养眼程序,不过你或许还是喜欢Windows 7 Aero的精美、透明度和开始菜单。今日我们将为你展示怎样将Ubuntu转换为Windows 7的模样。
当然,这不会是一模一样,不过两者足够接近,乍一看去,许多人都会以为这就是Windows 7。继续阅读,看看该怎么做吧。
我们先来输入一些命令,只需打开终端窗口并输入以下内容:
cd ~/
sudo wget http://web.lib.sun.ac.za/ubuntu/files/help/theme/gnome/win7-setup.sh
sudo chmod 0755 ~/win7-setup.sh
这将下载一个脚本文件以备后面使用,该文件告知计算机该下载哪些文件来完成Win7主题包的安装。一旦完成,会弹出一个窗口,告知你安装现在即将开始,只需点击OK就好了。

使用wp-super-cache插件静态缓冲的nginx rewrite规则

Written by BOY PT. Posted in 快速教程

Wordpress的缓冲插件wp-super-cache默认支持apahce的缓冲方式,在生成了静态页面数据后,通过.htaccess的规则直接让apache读取静态文件,完全不经过PHP,可以很大的提高博客的页面性能。 但是Nginx的改写规则就没这么容易让代码来配置了,虽然wp-super-cache的第二种缓存方式就是为这种使用环境设计,但实际上是用了PHP来提供静态数据了,在使用apache benchmark压力的时候,php-cgi依然占很高的CPU占有率。 通过编写nginx的rewrite规则还是可以让nginx直接读取静态文件,参考来自Code Exchange: nginx rewrite rules for WordPress + WP Super Cache,这里的配置被很多地方引用过,但实际尝试使用过程看到那里面的代码还需要微调。
    server {
        listen          80;
        server_name     apt-blog.net;
        root    /var/www/pt-sites/wordpress;
        index   index.html index.htm index.php;
        location / {
                # enable search for precompressed files ending in .gz
                # nginx needs to be complied using –-with-http_gzip_static_module
                # for this to work, comment out if using nginx from aptitude
                gzip_static on;
 
                # if the requested file exists, return it immediately
                if (-f $request_filename) {
                        break;
                }
 
                set $supercache_file '';
                set $supercache_uri $request_uri;
 
                if ($request_method = POST) {
                        set $supercache_uri '';
                }
 
                # Using pretty permalinks, so bypass the cache for any query string
                if ($query_string) {
                        set $supercache_uri '';
                }
 
                if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
                        set $supercache_uri '';
                }
 
                # !!!! IMPORTANT
                # if we haven't bypassed the cache, specify our supercache file
                if ($supercache_uri ~ ^(.+)$) {
                        set $supercache_file /wp-content/cache/supercache/$http_host/$1/index.html;
                }
 
                # only rewrite to the supercache file if it actually exists
                if (-f $document_root$supercache_file) {
                        rewrite ^(.*)$ $supercache_file break;
                }
 
                # all other requests go to Wordpress
                if (!-e $request_filename) {
                        rewrite ^(.*)$ /index.php?q=$1 last;
                }
 
        }
        location ~ \.php$ {
              include        fastcgi_params;
              fastcgi_pass   127.0.0.1:9000;
              fastcgi_index  index.php;
              fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
    }
需要重点关注的是set $supercache_uri这一行,这里的路径是wp-super-cache生成静态文件的路径,配置文件起作用的时候,这个路径会和$document_root组成最终静态文件的绝对路径,最终输出文件。所以如果这个路径不对的话,最终还是交给了index.php,缓冲就不起作用了。 wp-super-cache在wordpress目录/wp-content/cache/supercache/$http_host/下生成了各个请求url的目录,目录下是一个index.html静态文件,可以在wordpress工作时候,在这个目录下用命令watch find观察(在缓冲不多的情况下),总之小心的把这个路径写好,因为估计每个博客的permanent link的样式都不一样,wp-super-cache生成的目录也不一样,需要仔细调试一下。 完成后用apache benchmark压一下,Request per second应该很容易上百,而且php-cgi应该不会出现在top的列表前面了,CPU应该集中在nginx的子进程上,而且都是个位数CPU占有率,系统的load非常低。 顺便说一下,如果仅使用ab测试压力,用不着安装整个apache2,只需要apt-get install apache2-utils

搭建企业级邮件系统 iRedMail

Written by zwxie. Posted in 快速教程

一 软件环境 最近负责一个公司网站和邮件系统的搭建,以前自己一直没有仔细的研究过邮件系统的从零开始搭建工作,趁现在工作之余也同时将文档整理一次; 主要针对快捷高效搭建,简单实用为主,基本够一个人数50-100的小型公司使用。 操作系统:CentOS release 5.3 (Final) x86_64 数据库:mysql Ver 14.12 Distrib 5.0.45 php:php 5.2 up 邮件系统:postfix 2.5.6 + iredmail 0.4.0 webmail:RoundCube 1.0.2 iRedMail 0.4.0 下载地址:这里 二 安装过程 因许多软件涉及到yum安装,这里我给出国内一个非常快的Centos镜像,请 这里下载 1. 数据库和邮件系统安装 mysql 安装和postfix 安装 全部采取yum安装
$ yum install -y mysql mysql-server mysql-devel
$ yum install -y postfix
2.php安装
$ yum install -y php php-ldap php-gd php-imap php-mysql php-pear php-mbstring
3.iredmail 安装 下载解压 iRedMail-0.4.0.tar.bz2 安装指令:
$ cd /path/to/iRedMail-x.y.z/
$ cd pkgs/
$ sh get_all.sh
$ cd ../
$ sh iRedMail.sh
安装过程详细介绍请参看:戳这里 注: a:安装之前请先行设定mysql的root帐号和密码;空密码不被接受; b:其中数据库只需选择mysql即可; c:webprogrem选择RoundCube即可,其他默认; d:请记住设定的mail admin的帐号和密码。 三 配置过程 因为iRedMail的高度整合,使得配置过程异常的简单。甚至可以不需要对postfix进行多余设定; 注意修改以下基本配置:iRedmail安装过程中已经增加的这部分设定,请在配置文件的最末尾处修改; 1. myorigin myorigin参数指明发件人所在的域名。如果你的用户的邮件地址为user@domain.com,则该参数指定@后面的域名。缺省 地,postfix使用本地主机名作为myorigin,但是建议你最好使用你的域名,因为这样更具有可读性。比如:安装postfix的主机为 mail.domain.com则我们可以这样指定myorigin:
myorigin = domain.com
当然我们也可以引用其他参数,如:
myorigin = $mydomain
2. mydestination mydestination参数指定postfix接收邮件时收件人的域名,换句话说,也就 是你的postfix系统要接收什么样的邮件。比如:你的用户的邮件地址为user@domain.com, 也就是你的域为domain.com, 则你就需要接收所有收件人为user_name@domain.com的邮件。与myorigin一样,缺省地,postfix使用本地主机名作为 mydestination。如:
mydestination = $mydomain
mydestination = domain.com
3. notify_classes 在postfix系统中,必须指定一个postfix系统管理员的别名指向一个用户, 只有这样,在用户遇到问题时才有报告的对象,postfix也才能将系统的问题报告给管理员。notify_classes参数就是用来指定向postfix管理员报告错误时的信息级别。共有以下几种级别:
bounce:将不可以投递的邮件的拷贝发送给postfix管理员。出于个人隐私的缘故,该邮件的拷贝不包含信头。
2bounce:将两次不可投递的邮件拷贝发送给postfix管理员。 delay:将邮件的投递延迟信息发送给管理员,仅仅包含信头。 policy:将由于UCE规则限制而被拒绝的用户请求发送给postfix管理员,包含整个SMTP会话的内容。 protocol:将协议的错误信息或用户企图执行不支持的命令的记录发送给postfix管理员。同样包含整个SMTP会话的内容。 resource:将由于资源错误而不可投递的错误信息发送给postfix管理员,比如:队列文件写错误等等。 software:将由于软件错误而导致不可投递的错误信息发送给postfix管理员。 缺省值为:
notify_classes = resource, software
4.myhostname myhostname 参数指定运行postfix邮件系统的主机的主机名。缺省地,该值被设定为本地机器名。你也可以指定该值,需要注意的是,要指定完整的主机名。如:
myhostname = mail.domain.com
5.mydomain mydomain参数指定你的域名,缺省地,postfix将myhostname的第一部分删除而作为mydomain的值。你也可以自己指定该值,如:
mydomain = domain.com
6.mynetworks mynetworks 参数指定你所在的网络的网络地址,postfix系统根据其值来区别用户是远程的还是本地的,如果是本地网络用户则允许其访问。你可以用标准的A、B、C类网络地址,也可以用CIDR(无类域间路由)地址来表示,如:
192.168.1.0/24
192.168.1.0/26
7.inet_interfaces inet_interfaces 参数指定postfix系统监听的网络接口。缺省地,postfix监听 所有的网络接口。如果你的postfix运行在一个虚拟的ip地址上,则必须指定其监听的地址。如:
inet_interfaces = all
inet_interface = 192.168.1.1
关于postfix的配置详细介绍可参看戳这里 需要注意的是dovecat配置在main.cf中的和master.cf的端口一致;否则会导致邮件发送失败;
#main.cf
content_filter = smtp-amavis:[127.0.0.1]:10024
#master.cf
127.0.0.1:10024  inet n  –   –   –   –  smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks_style=host
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
以上设定完成后,确认启动postfix、policyd、dovecot、httpd、mysqld; 四、测试过程 1. 访问:http://your_server/mail/ 以上设定正确,请登录测试发送邮件是否正常; 2. 增加邮件用户和邮箱容量大小配额设定 a.首先登录mysql; b.依次执行以下指令:
mysql&gt; use vmail;
Database changed
mysql&gt; INSERT INTO mailbox (username, password, name, maildir, quota, domain, active)
-&gt;     VALUES (‘testuser@hiadmin.com’,  ‘$1$W.UWoG.0$Bnq8mcbsi1UhFVpiJ2jvY0′, ‘testuser’,  ‘hiamdin.com/testuser/’, ’2048′, ‘hiadmin.com’, ’1);
Query OK, 1 row affected (0.00 sec)
注: #在mailbox生成用户帐号、密码、以及邮箱容量quota 2048为2GB #其中password字段值,可以使用 openssl passwd -1 testuser生成;
mysql&gt; INSERT INTO alias (address, goto, domain, active)
-&gt;     VALUES (‘testuser@hiadmin.com’, ‘testuser@hiadmin.com’, ‘hiadmin.com’, ’1);
Query OK, 1 row affected (0.00 sec)
注: #alias 中生成别名; c.也可以用iRedmail的tools 脚本; ———————————————-
$cd /path/to/iRedMail-0.4.0/tools
#该目录下有个create_mail_user_MySQL.sh的脚本,可以为你生成增加用户的sql语句; #执行脚本前实现生成userlist.txt
$echo testuser &gt;userlist.txt
#每行一个用户名即可
$sh create_mail_user_MySQL.sh userlist.txt
#生成output.sql #登录到mysql,在vmail库中执行
mysql&gt; source /path/to/output.sql
d.设定自己域名的mx记录,再登录RoundCube测试能否收发邮件! 源文