Posted by zuzhihui in Linux技术 on 2008/06/20 with No Comments
在Debian VPS下修改locales设置很简单,dpkg-reconfigure locales就可以了。ubuntu是出于debian,但locales的设置方法却不同:
echo "zh_CN.UTF-8 UTF-8" > /var/lib/locales/supported.d/locale
echo "en_US.UTF-8 UTF-8" >> /var/lib/locales/supported.d/locale
locale-gen
echo 'LANG="zh_CN.UTF-8"' >> /etc/environment
Posted by zuzhihui in Linux技术 on 2008/06/20 with No Comments
在 上篇文章 中我们介绍了怎样配置postfix的不加密的、明文的smtp发信认证,本文接着介绍怎样配置postfix下的TLS加密的smtp发信认证。
本文是基于为基础的,强烈建议先配置好明文的SMTP发现认证,再按照本文接着配置TLS加密的SMTP发现认证。之所以这么做是因为条理清楚,并非必须。在TLS认证配置好之后,你可以选择再把明文的SMTP发信禁止掉。
我用thunderbird邮件客户端软件类配合测试,首先在thunderbird里面把SMTP服务器配置成SSL的,注意SSL SMTP的端口是465,在thunderbird中选中SSL后,SMTP端口会自动改变。
先把下面这些追加到main.cf中去:
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtp_use_tls=yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
注意证书文件/etc/ssl/certs/ssl-cert-snakeoil.pem是Linux系统自带的,不用我们手工生成了。
在master.cf中,去掉如下部分前面的注释:
smtps inet n - - - - smtpd
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
然后重启postfix即可。
Posted by zuzhihui in Linux技术 on 2008/06/20 with 4 Comments
要用Postfix配置邮件服务器,配置SMTP要求发信认证是非常必要的,如果没有SMTP认证,就会有很多人利用你的SMTP来发送大量垃圾邮件。
本文记述了在Debian 4 VPS下是怎么配置一个明文的SMTP认证。明文的SMTP认证不安全,配置完明文的认证后,应该再配置一个Postfix的TLS发信认证,TLS是加密的,安全的,关于TLS的配置,我们会在另外一篇文章中描述。
安装必要的软件包:
apt-get install libsasl2 sasl2-bin libsasl2-modules
然后对postfix进行基本配置,这部分很简单,不再描述,下面描述怎样加入SMTP认证:
修改/etc/postfix/main.cf文件,在末尾加入:
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
修改/etc/default/saslauthd
START=yes
PWDIR="/var/spool/postfix/var/run/saslauthd"
PARAMS="-m ${PWDIR} -r"
PIDFILE="${PWDIR}/saslauthd.pid"
MECHANISMS="pam"
OPTIONS="-c -m ${PWDIR}"
然后运行:
mkdir -p /var/spool/postfix/var/run/saslauthd
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf
然后重启postfix和saslauthd,应该就能实现明文的发信认证了。本文参考了 http://www.debsir.org/main/?q=node/163
Posted by zuzhihui in 互联网技术 on 2008/06/18 with No Comments
v12n是Virtualization的缩写,这个单词中间有12个字母,所以就缩写成v12n,就像”国际化”的单词internationalization缩写成i18n一样,是个”国际惯例”。
http://v12n.cn 采用druppal建站,目前正处于调试期间,不久后就会正式退出。
Posted by zuzhihui in 产品介绍 on 2008/06/18 with No Comments
5月初我们推出的58元/月的特价VPS活动,到现在已经有很多客户选购,比我们预期的效果要好。这款基于Xen的VPS有96MB内存,4G硬盘,能安装Debian 4, Ubuntu 8.04, CentOS 5等Linux操作系统,不支持Windows操作系统。
有需要的顾客,请抓紧时间到我们的主页 http://rashost.com 去订购,活动结束之后就没有这种好机会了!
Posted by zuzhihui in vps技术 on 2008/06/16 with No Comments
我们的VPS主要面向国内用户,所以语言基本上都是中文。中文有很多种编码,最流行的就是UTF8和GBK。我们推荐客户使用UTF8编码,因为这是国际标准,能兼容任何语言的编码。
在CentOS VPS下修改语言编码:
localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
export LC_ALL=zh_CN.utf8
上面第一步是用来产生编码文件,这一步不是必须,编码文件一般都存在,运行localedef –help能查看当前编码文件所在的路径。第二步更改当前的编码为zh_CN.utf8,如果要永久更改,运行:
echo 'LANG=zh_CN.UTF-8' > /etc/sysconfig/i18n
echo 'LC_ALL=zh_CN.UTF-8' >> /etc/sysconfig/i18n
在Debian/Ubuntu VPS下修改语言编码更简单:
dpkg-reconfigure locales
Posted by zuzhihui in Linux技术 on 2008/06/16 with No Comments
在Eclipse中Javascript文件缺省是不能写入中文的,解决方法是使用UTF-8编码来保存Javascript文件,具体操作是在菜单中依次选择:
Preference
General
Content Types
JavaScript
Default encoding
然后修改缺省编码为UTF-8即可
Posted by zuzhihui in Linux技术 on 2008/06/15 with No Comments
MRTG是个常用的流量监控工具,它通过SNMP协议取得网络数据,并把这些数据绘制成图片。通过MRTG,我们可以很方便的健康VPS的网络流量。
安装和配置MRTG分为两个步骤,一是安装配置MRTG Server,二是安装配置SNMP Agent。
在CentOS VPS上配置SNMP Agent的步骤如下:
yum install -y net-snmp
chkconfig --list snmpd
chkconfig snmpd on
/etc/init.d/snmpd restart
SNMP Agent的配置文件为:/etc/snmp/snmpd.conf,在该文件开头加入:
rocommunity public
在CentOS VPS下要创建文件/etc/snmp/snmpd.options,否则SNMP Agent会启动失败
OPTIONS="-Lsd -Lf /dev/null -I -smux -p /var/run/snmpd.pid -a"
在CentOS VPS上安装MRTG:
yum install -y mrtg
MRTG的配置文件是/etc/mrtg/mrtg.cfg
cd /etc/mrtg
cp mrtg.cfg mrtg.cfg.orig
cfgmaker public@localhost >> mrtg.cfg
indexmaker mrtg.cfg > /var/www/mrtg/index.html
修改/etc/httpd/conf.d/mrtg.conf 文件为:
Alias /mrtg /var/www/mrtg
AuthName mrtg
AuthType Basic
AuthUserFile /etc/mrtg/mrtg.users
require valid-user
然后重启apache:
/etc/init.d/httpd reload
Posted by zuzhihui in Linux技术 on 2008/06/14 with No Comments
Windows VPS可以通过远程桌面进行访问。Linux VPS由于不支持图形界面,必须通过文字界面的SSH协议进行访问,步骤如下:
Posted by zuzhihui in vps技术 on 2008/06/14 with No Comments
Debian Linux 4 是我们推荐的VPS操作系统,我们在VPS上按照如下方式配置Debian Linux
apt-get install rcconf openssh-server less psmisc locales vim lftp
apt-get install bc bzip2 ntpdate sudo python curl ftp unzip
cp /usr/share/vim/vim70/vimrc_example.vim /etc/vim/vimrc.local
cat >> /etc/vim/vimrc.local < set fileformats=unix
set nobackup
set nu
set ignorecase
set tabstop=4
set shiftwidth=4
set noexpandtab
set noautoindent
set fileencodings=utf-8,euc-cn
EOF
注意:如果在ubuntu804下要把vimrc.local里面的set mouse=a注释掉,否则putty上没有办法选择
vi /etc/bash.bashrc /root/.bashrc /etc/skel/.bashrc #去掉相应的注释
echo ". /etc/bash.bashrc" >> /root/.bashrc
近期评论