Ubuntu搭建本地Mail Server

Postfix(配置最简单,两步)
选择”网络站点”->系统邮件名(local,此处随意填写,与本地主机名无关,只是用于标签internet的outbound邮件)

测试邮件,注意查看垃圾邮件文件夹:)
echo “This is a test.” | mail -s Testing youremail@yourdomain.com

Postfix支持四种类型
网络站点:邮件直接通过SMTP发送和接受
带smarthost的网络站点:邮件的接受直接通过SMTP或fetchmail,发送则使用smarthost
卫星系统:所有邮件被被发送到smarthost邮寄
本地:无网络,只用于本地用户的邮件

smarthost是用作mail代理的另一台mail server,通常用户集中控制管理outbound邮件

/etc/postfix           #配置目录
/etc/aliases           #用户别名
/var/log/mail.*      #日志
/etc/init.d/postfix  #控制脚本
常用命令
$postqueue -p
$sudo postsuper -d 522    (ALL 删除所有)
$sudo newaliases  #更新aliases.db
$sudo postmap /etc/postfix/virtual      #更新数据库
$sudo postconf      #查看当前配置,man 5 postconf
几个常用配置项
myhostname    #internet hostname
myorigin           #发出邮件显示的域名
mydestination  #本邮件服务器接受的邮件域,即本机为最终目的地
relayhost          #默认为空,或者要路由所有outbound邮件到另一台邮件服务器的名字
mynetwork       #本机会relay邮件的网段,需要小心设置,仅为本机和内网段


Exim4
Exim是Ubuntu缺省MTA[参考]
$sudo apt-get install exim4 mailutils
$sudo dpkg-reconfigure exim4-config
基本设置
第一步: 互联网站;直接通过SMTP发送或接受邮件
第二步: 系统邮件名称(local)
邮件中转的两步留空即可,其他默认

基于Gmail的设置[参考]
第一步:邮件系统设置的常见类型(用smarthost发信,无本地邮件)
第六步:寄信使用的smarthost的IP地址或主机名(smtp.gmail.com::587)
$sudo vi  /etc/exim4/passwd.client 添加
*.google.com:yourAccountName@gmail.com:y0uRpaSsw0RD
$sudo update-exim4.conf
$sudo /etc/init.d/exim4 restart

其他命令:
mailq   #查看消息队列

删除frozen邮件队列
$sudo exiqgrep -i frozen | xargs exim -Mrm


基础知识
MTA:Message Transfer Agent [WIKI]
MX: Mail Exchanger [WIKI]
POP:Post Office Protocol [WIKI]
IMAP:Internet message access protocol [WIKI]
MIME[WIKI]

Reddit

最早看到关于Reddit技术平台介绍是从DBANotes那,当时没深入研究,昨天看到说它的框架基于Pylons才想起来研究下代码。为了方便期间重装回了Ubuntu10.04,硬盘安装倒是很快,而且/Home在独立分区所以不用备份。
安装向导写的很清楚,尤其有自动化的sh脚本,看依赖就知道用了多少技术:
Cassandra:[wiki>]Distributed database  (注: 详见大辉的文章,不是所有项目都适用)
memcached:Fast in-memory caching server. Used throughout reddit
RabbitMQ:AMQP server. Used for offline processing  (也有它的应用场合
HAProxy:Load balancer for distributing requests to app servers
web框架基于Pylons (Paste 1.7.2+Mako 0.2.5+SQLAlchemy 0.5.3++webhelper 0.6.4+Routes 1.8)
此外还用到:
solr: 基于Lucence的检索服务器

Fedora和Gnome3

Ubuntu 11.04搭配的Unity真是失败啊,正好用用Gnome3 (之前试用Ubuntu11.04下的Gnome3一堆问题)。
安装:
yum gnome-tweak-tool
yum install wqy-bitmap-fonts wqy-microhei-fonts

错误处理:
Q: yum install  时报错fedora Error: database disk image is malformed
A: yum clean all

Gnome3使用:
Q: 通过系统菜单关机/重启
A: 点击右上角用户名后,按Alt键,Suspend就变成Shutdown了

优盘安装Fedora15

Fedora15出来了,最早接触的就是RedHat和Fedora,后来切换到Ubuntu,多年之后的今天突然像看看Fedora.
照例,比较喜欢硬盘/优盘安装操作系统(光盘不但浪费更主要的是没多久就过时了,而且安装慢),本来想基于Ubuntu的Grub2安装,可上网一查,普遍的反映对Grub2不支持。好在ubuntu论坛搜到一个帖子,是用优盘在Grub2安装的,今天就是这样费劲周折装上的。
至少在我的笔记本上硬盘安装不管是基于grub2还是Win7的grub4dos都没能成功。
制作Fedora优盘看这里,下面是关键的配置,供参考:
1)编辑/etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
menuentry “Fedora 15” {
set root=(hd1,msdos4)
linux /EFI/boot/vmlinuz0 root=live:LABEL=”UDISK” rootfstype=vfat ro liveimg rhgb rd_NO_LUKS rd_NO_MD rd_NO_DM
initrd /EFI/boot/initrd0.img
boot
}
注: hd1,msdos4是在机器启动时按c键进入grub>ls得到的,是为了得到优盘的编号
UDISK是在Win7看到的优盘名字,我通过属性给它改了名字

2)运行$sudo update-grub更新gurb.cfg,重启机器,进入Fedora15 Live
点击Activity 选择最下方的安装到硬盘,此后就是安装步骤了

创业建议

雷军谈创业企业

http://player.youku.com/player.php/sid/XMjAxMzg4ODc2/v.swf
[文字稿]雷军:第一个机会是移动互联网 第二个是消费升级
【总结】第一条,就是看五年想三年认认真真做好一两年。第二条,在对的时候做对的事情。第三条,顺势而为,不要逆天而为,不要做逆天的事情,顺势而为。其实有些成功是极其流畅自如,如果你能把准大的时机,把握好每个看似运气的关键点,你的成功就会变得轻轻松松。

雷军投资十条标准
1能洞察用户需求对市场极其敏感。2志存高远并脚踏实地。3最好是两三个优势互补的人一起创业。4一定要有技术过硬并能带队伍的技术带头人。5低成本情况 下的快速扩张能力。6有创业成功经验的人加分。7做最肥的市场。8选择最真确的时间点。9专注、专注再专注。10业务在小规模被验证

互联网创业的葵花宝典:“专注”、“极致”、“快”和“口碑”
1.专注:解决用户一个迫切的需求,解决的问题一句话就可以说清楚。
2.极致:要在这个功能点上做到所有同类产品的极致,做到最好才能赢。
3.快:开发周期一定要控制在三到六个月的时间,一定要快。
4.口碑:初期市场营销坚持少花钱甚至不花钱,才能看出产品对用户真正的吸引力。

薛蛮子谈创业

http://player.youku.com/player.php/sid/XMjAxNDE5NDM2/v.swf

第一届清华大学中国创业者训练营

第二届清华大学中国创业者训练营

清华创业者训练营Youku专页

Linux窗口管理器

OpenBox
安装: $sudo apt-get install openbox obconf
cp /etc/xdg/openbox ~/.config/
Gnome下使用

常用快捷键
鼠标中键 -> 显示快捷菜单
Win+d  -> 隐藏所有窗口

资源:
[From LinuxToy]入门指南

awesome
$sudo apt-get install awesome
无线网连接失败: nm-applet&

IPhone推荐应用

iPhone必备应用

系统:
Cydia
Installous
iFile
iFiles
游戏:
Cut The Rope
Angry Birds
Drop Chicken
Fluffy Birds
PvZ
Falldown
Holes&Balls
Bubble Ball
音乐:
iRadio (最好用的广播电台软件)
Shazam (歌曲识别)
照片(参考链接)
Adobe Photoshop Express
PhotoGene (图片精灵)
PhotoStudio
ColorSplash
Hipstamatic

管理类:
iSSH
RDP

精品网站
Gizzomo
威锋
Apptrackr

图形化远程访问Linux

$sudo apt-get install xrdp  x11vnc
设置密码: x11vnc -storepasswd
启动: x11vnc -usepw

要保持x11vnc为系统启动项,参考官方FAQ

xrdp默认打开新的X Sesssion,要像RDP那样打开已有Session:
注: Most vnc implementation present to clients a new desktop session for each new connection, only x11vnc presents the same main console desktop to every client session
编辑etc/xrdp/xrdp.ini 添加
[screen]
name=Display Screen
lib=libvnc.so
username=n/a
password=ask
ip=127.0.0.1
port=5900

Troubleshooting:
Q: Unable to copy the users Xauthorization file
A: Create a blank .Xauthority file in the home directory of the user you are connecting with. Be sure to log in as that user (either graphically, or via the terminal), then run:
touch ~/.Xauthority
chmod 600 ~/.Xauthority

Selenium应用

MozillaAMO项目
源码:http://svn.mozilla.org/addons/trunk/site/app/tests/

规范:
https://wiki.mozilla.org/QA/Execution/Web_Testing/Docs/Automation/Testcases/Guidelines
https://wiki.mozilla.org/QA/Execution/Web_Testing/Docs/Automation/StyleGuide
页模型:
http://code.google.com/p/selenium/wiki/PageObjects
https://wiki.mozilla.org/QA/Execution/Web_Testing/Docs/Automation/page_object_model_project

基本介绍:
https://wiki.mozilla.org/QA/Execution/Web_Testing/Docs/Automation/Testcases/ConfigFiles

Summary of Python modules

  • AMOlocators contains Xpath and CSS locators for elements on AMO pages.

Purpose:

  • Provide a quick way to define locators for new scripts.
  • Changes to web pages which could break many scripts could be resolved by updating the module.
  • Centralize ‘best practices’ for locator definition and ‘tricks’ to address complicated situations.
  • AMOfunctions contains functions for elements specific to AMO pages.


Selenium

Selenium (与watir类似,Ruby应用)
Python下的应用
安装:pip install -U selenium
官方文档

使用WebDriver (Selenium2)

XPATH:
示例:
allSuggestions = wd.find_element_by_xpath(“//td[@class=’gac_c’]”)
browser.find_element_by_xpath(“//a[contains(@href,’http://seleniumhq.org‘)]”)

Firefox Profile
$ java -jar selenium-server-standalone-2.0b1.jar -firefoxProfileTemplate <ProfilePath>

使用代理:
java -jar selenium-server.jar -Dhttp.proxyHost=my.proxy.com -Dhttp.proxyPort=8080 -Dhttp.proxyUser=my_username -Dhttp.proxyPassword=my_password

运行时不显示浏览器窗口(后台运行)
参考文档(1)官方(2)Linux下
xvfb-run java -jar selenium-server-standalone-2.0b1.jar
安装xvfb
sudo apt-get install xvfb
sudo apt-get install xfonts-cyrillic

应用示例:
DISPLAY=:8
# Start the framebuffer.
Xvfb $DISPLAY -screen 0 800x600x24 &
export DISPLAY
/usr/local/bin/myprogram