lizongbo at 618119.com 工作,生活,Android,前端,Linode,Ubuntu,nginx,java,apache,tomcat,Resin,mina,Hessian,XMPP,RPC

2014年08月18日

Linode VPS从 Ubuntu 12.04 升级到 Ubuntu 14.04

Filed under: Linux — 标签:, , — admin @ 10:40

Linode VPS从 Ubuntu 12.04 升级到 Ubuntu 14.04

linode官网现在还是只有升级到Ubuntu 12.04的步骤
参考:
https://www.linode.com/docs/security/upgrading/how-to-upgrade-to-ubuntu-12-04-precise
升级到Ubuntu 14.04的步骤是一样的,但是升级过程中出现个错误信息,出错信息如下:

Error in sys.excepthook:
Traceback (most recent call last):
File “/tmp/update-manager-Ik4Dhk/DistUpgrade/DistUpgradeViewText.py”, line 108, in _handleException
“\n”.join(lines))
File “/tmp/update-manager-Ik4Dhk/DistUpgrade/DistUpgradeViewText.py”, line 142, in error
print(twrap(summary))
UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-5: ordinal not in range(128)

Original exception was:
Traceback (most recent call last):
File “/tmp/update-manager-Ik4Dhk/trusty”, line 10, in <module>
sys.exit(main())
File “/tmp/update-manager-Ik4Dhk/DistUpgrade/DistUpgradeMain.py”, line 230, in main
app = DistUpgradeController(view, options, datadir=options.datadir)
File “/tmp/update-manager-Ik4Dhk/DistUpgrade/DistUpgradeController.py”, line 126, in __init__
self._view.updateStatus(_(“Reading cache”))
File “/tmp/update-manager-Ik4Dhk/DistUpgrade/DistUpgradeViewText.py”, line 122, in updateStatus
print(msg)
UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-5: ordinal not in range(128)
=== Command detached from window (Fri Aug 15 11:42:55 2014) ===
=== Command terminated with exit status 1 (Fri Aug 15 11:42:55 2014) ===

在网上找资料看了说是没设置LC_ALL导致的。
参考:
http://blueecho.info/wp/?p=78

修改/root/.bashrc文件

命令 vi /root/.bashrc

按A,然后在文件末尾添加

export LC_ALL=C

按Esc,再按冒号和W和Q,

再运行  source /root/.bashrc 使修改后的文件生效。

然后再运行screen命令,再运行 sudo do-release-upgrade。

 

 

2010年11月14日

使用MyEnTunnel和WinSCP连接linode上的Ubuntu服务器

Filed under: Linux — 标签:, , , , , — lizongbo @ 17:34

使用MyEnTunnel和WinSCP连接linode上的Ubuntu服务器

先安装配置MyEnTunnel:
1.MyEnTunnel官方下载地址:http://nemesis2.qx.net/download.php?filename=myentunnel-unicode.zip
语言包: http://nemesis2.qx.net/download.php?filename=simplified_chinese_language.txt
来源: http://nemesis2.qx.net/pages/MyEnTunnel
由于官方下载地址限制了Referer信息,因此需要先打开上面的来源页面, 然后手工点击下载。

不过下载的版本是没附带pageant.exe,plink.exe,pscp.exe,psftp.exe,putty.exe,puttygen.exe,puttytel.exe这些文件的。

因此推荐下载别人整合好可以直接使用的版本:http://microembedded.googlecode.com/files/myentunnel-unicode.zip
来源:http://code.google.com/p/microembedded/updates/list
2.解压myentunnel-unicode.zip到:E:\Programs
3.运行E:\Programs\myentunnel-unicode\myentunnel.exe。
4.切换到“设定“面板,将启动时自动连接,失败时重新连接,冗余记录,启用慢速查询,不限制重试次数,启用动态套接字,隐藏断开连接,启用压缩这几项都选中,
只有使用私人密钥和禁用提示不需要打钩。
SSH服务器填上linode分配的ip地址,SSH端口保持默认值22,用户名填SSH账号,比如lizongbo,密码比如填:618119.com,重试延迟填10,本地端口填:7070.
5.点右下角的“连接“,不出一万就连接上了,在弹出的提示保存密钥时选是,连接就正常建立了。可以切换到“状态”面板查看日志。

6.在Firefox里使用7070端口:Firefox主菜单–>工具–>选项–>”高级”面板–>“网络”–>连接,点设置,选择手动配置代理,HTTP代理栏清空,SOCKS主机填:127.0.0.1,端口填7070,选中SOCKSv5。
确定保存之后,在Firefox地址栏输入about:config,回车后点“我保证会小心”,然在过滤器栏输入dns,双击network.proxy.socks_remote_dns,设置为true。

再安装配置WinSCP
7.WinSCP 4.3 Beta 绿色版官方下载地址:http://winscp.net/download/winscp430.zip
(实际下载地址:http://softlayer.dl.sourceforge.net/project/winscp/WinSCP/4.3%20beta/winscp430.zip
http://winscp.net/translations/dll/chs.zip
来源:http://winscp.net/eng/download.php
中文简体语言包下载:http://winscp.net/translations/dll/chs.zip
来源:http://winscp.net/eng/translations.php
8.解压winscp430.zip到E:\Programs\WinSCP;解压chs.zip到E:\Programs\WinSCP。
9.运行E:\Programs\WinSCP\WinSCP.exe,在会话栏添加连接配置:主机名为Linux服务器的ip地址,端口号默认22,用户名和密码参考MyEnTunnel的配置,点“登录”进行连接。

WinSCP具体使用可参考:http://618119.com/archives/2008/03/20/76.html

2010年11月4日

linode上配置resin的CGIservlet来支持perl运行awstats7.0

Filed under: Linux,nginx,Resin — 标签:, , , , , — lizongbo @ 00:19

linode上配置resin的CGIservlet来支持perl运行awstats7.0
在网上搜索了linode的vps上安装配置nginx来支持awstats的相关文章,感觉比较麻烦,而我的linode vps上因为部署了Resin4.0.12,因此我选择通过resin的CGIservlet来运行awstats.

1.如果是windows操作系统,需要下载安装最新的ActivePerl:
http://downloads.activestate.com/ActivePerl/releases/5.12.2.1202/ActivePerl-5.12.2.1202-MSWin32-x86-293621.msi
来源:http://www.activestate.com/activeperl/downloads

2.下载最新的AWStats:
AWStats 6.9正式版是2008年底发布的,因此下载7.0beta版来:
http://awstats.sourceforge.net/files/awstats-7.0.tar.gz
来源: http://awstats.sourceforge.net/

3.下载准备插件
GeoLiteCity.dat
http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
来源:http://www.maxmind.com/app/geolitecity
http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
来源:http://www.maxmind.com/app/geolitecountry
http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
来源:http://www.maxmind.com/app/asnum
http://www.ieasy.org/download/qqwry.pl
http://www.ieasy.org/download/qqhostinfo.pm
来源:http://www.ieasy.org/reload/cat2/awstats_qqhosti.html
geoip插件的依赖库:http://geolite.maxmind.com/download/geoip/api/pureperl/Geo-IP-PurePerl-1.25.tar.gz
来源:http://www.maxmind.com/app/perl

4.将下载的awstats-7.0.tar.gz!/awstats-7.0/wwwroot/解压成/usr/local/app/resin/webapps/awstats/

建立 /usr/local/app/resin/webapps/awstats/WEB-INF/resin-web.xml,内容如下:

<web-app xmlns=”http://caucho.com/ns/resin”
xmlns:resin=”urn:java:com.caucho.resin”>

<servlet >
<servlet-name>cgi</servlet-name>
<servlet-class>com.caucho.servlets.CGIServlet</servlet-class>
<!–下面三个是可配置的参数,参考:http://www.caucho.com/resin-javadoc/com/caucho/servlets/CGIServlet.html
<init>
<executable>C:\\Perl\\bin\\perl</executable>
<ignoreExitCode>false</ignoreExitCode>
<stderrIsException>true</stderrIsException>
</init>
–>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cgi</servlet-name>
<url-pattern>*.pl</url-pattern>
</servlet-mapping>

<session-config>
<use-persistent-store/>
</session-config>
<!–
– Security configuration
–>
<resin:BasicLogin realmName=”awstats statistics”/>
<resin:Deny>
<url-pattern>*.conf</url-pattern>
<url-pattern>*.pm</url-pattern>
<url-pattern>*.txt</url-pattern>
</resin:Deny>

<resin:Allow url-pattern=”/*”>
<resin:IfUserInRole role=”awstats_role”/>
</resin:Allow>

<resin:XmlAuthenticator password-digest=”none”>
<resin:user name=”awstats” password=”awstats” group=”awstats_role”/>
</resin:XmlAuthenticator>

</web-app>

5.安装Geo-IP-PurePerl组件:
root@lizongbo.com:/usr/local/app# wget http://geolite.maxmind.com/download/geoip/api/pureperl/Geo-IP-PurePerl-1.25.tar.gz
root@lizongbo.com:/usr/local/app# tar -zxvf Geo-IP-PurePerl-1.25.tar.gz
root@lizongbo.com:/usr/local/app# cd Geo-IP-PurePerl-1.25
root@lizongbo.com:/usr/local/app/Geo-IP-PurePerl-1.25# perl Makefile.PL
root@lizongbo.com:/usr/local/app/Geo-IP-PurePerl-1.25# make
root@lizongbo.com:/usr/local/app/Geo-IP-PurePerl-1.25# make test
root@lizongbo.com:/usr/local/app/Geo-IP-PurePerl-1.25# make install

6.在/usr/local/app/resin/webapps/awstats/cgi-bin/下面建立awstats.localhost.conf配置,内容如下:

Include=”awstats.model.conf”
LogFile=”/usr/local/app/resin/log/access.log.%yyyy%MM%dd”
SiteDomain=”localhost”
LoadPlugin=”decodeutfkeys”
LoadPlugin=”hashfiles”
LoadPlugin=”tooltips”
LoadPlugin=”geoip_city_maxmind GEOIP_STANDARD  /usr/local/app/resin/webapps/awst
ats/cgi-bin/plugins/GeoLiteCity.dat”
LoadPlugin=”geoip GEOIP_STANDARD /usr/local/app/resin/webapps/awstats/cgi-bin/pl
ugins/GeoIP.dat”
LoadPlugin=”geoip_asn_maxmind  GEOIP_STANDARD  /usr/local/app/resin/webapps/awst
ats/cgi-bin/plugins/GeoIPASNum.dat”
LoadPlugin=”qqhostinfo”

LogFormat=1
HostAliases=”localhost lizongbo.com 127.0.0.1 REGEX[^[a-zA-Z0-9]+\.lizongbo\.com$]”

DirIcons=”/awstats/icon”
DNSLookup=1
DirData=”.”
DirCgi=”/cgi-bin”

AllowToUpdateStatsFromBrowser=1

7.下载纯真ip库:
http://update.cz88.net/soft/ip_setup.exe
来源:http://www.cz88.net/fox/
运行ip_setup.exe安装之后,找到C:\Program Files\cz88.net\ip下面的qqwry.dat,上传到服务器的/usr/local/app/resin/webapps/awstats/cgi-bin/plugins。
root@lizongbo.com:/usr/local/app/resin/webapps/awstats/cgi-bin/plugins# cp /usr/local/app/geoip/qqwry.dat  ./
由于linux下区分文件名大小写,所以必须将ip库文件名改成QQWry.Dat.
root@lizongbo.com:/usr/local/app/resin/webapps/awstats/cgi-bin/plugins# mv qqwry.dat  QQWry.Dat
参考:http://www.ieasy.org/reload/cat2/awstats_qqhosti.html
root@lizongbo.com:/usr/local/app/resin/webapps/awstats/cgi-bin/plugins# vi qqwry.pl
然后在  my $ipfile=”./QQWry.Dat”;
下面再插入下面一行:
my $ipfile=”${DIR}/plugins/QQWry.Dat”;

8.在命令行上测试一下:
root@lizongbo.com:/usr/local/app/resin/log# /usr/bin/perl /usr/local/app/resin/webapps/awstats/cgi-bin/awstats.pl -config=localhost -output
<html><body>
<br /><span style=”color: #880000″>
Error: Plugin load for plugin ‘decodeutfkeys’ failed with return code: Error: Can’t locate URI/Escape.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl . /usr/local/app/resin/webapps/awstats/cgi-bin/lib /usr/local/app/resin/webapps/awstats/cgi-bin/plugins) at (eval 3) line 1.

</span><br />
<br /><b>Setup (‘/usr/local/app/resin/webapps/awstats/cgi-bin/awstats.localhost.conf’ file, web server or permissions) may be wrong.</b><br />
Check config file, permissions and AWStats documentation (in ‘docs’ directory).
</body></html>

根据错误信息提示,需要安装URI组件,于是下载: http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/URI-1.56.tar.gz
来源:http://search.cpan.org/dist/URI/

root@lizongbo.com:/usr/local/app# wget http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/URI-1.56.tar.gz
root@lizongbo.com:/usr/local/app# tar -zxvf URI-1.56.tar.gz
root@lizongbo.com:/usr/local/app# cd URI-1.56
root@lizongbo.com:/usr/local/app/URI-1.56# perl Makefile.PL
root@lizongbo.com:/usr/local/app/URI-1.56# make
root@lizongbo.com:/usr/local/app/URI-1.56# make test
root@lizongbo.com:/usr/local/app/URI-1.56# make install

root@lizongbo.com:/usr/local/app/resin/webapps/awstats/cgi-bin/plugins# ls -alh *.dat
-rw-r–r– 1 root root 1.1M Oct 30 10:40 GeoIP.dat
-rw-r–r– 1 root root 3.5M Oct 30 10:40 GeoIPASNum.dat
-rw-r–r– 1 root root  30M Oct 30 10:40 GeoLiteCity.dat
-rw-r–r– 1 root root 8.1M Oct 30 10:40 qqwry.dat

9.在浏览器中访问:http://lizongbo.com/awstats/cgi-bin/awstats.pl?config=localhost
输入用户名awstats,密码:awstats,即可查看统计结果。

Windows的resin上运行awstats还需要安装perl插件:

开始菜单–>ActivePerl 5.12.2 Build 1202–>Perl Package Manager (实际命令是:C:\Perl\bin\wperl.exe -x ppm.bat)
输入URI,搜索到插件,然后选中点右键:Install URI 1.56。

windows下resin-web.xml里的cgi配置是:
<init>
<executable>C:\\Perl\\bin\\perl</executable>
<ignoreExitCode>true</ignoreExitCode>
</init>
否则会出下面的错误信息:
java.io.IOException: Cannot run program “/usr/bin/perl” (in directory “D:\3gdev\Java\resin-4.0.10\webapps\awstats\cgi-bin”):
CreateProcess error=3, ???????
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at java.lang.Runtime.exec(Runtime.java:593)
at com.caucho.servlets.CGIServlet.service(CGIServlet.java:211)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
at com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChain.java:131)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:183)
at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:92)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:286)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:789)
at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:662)
at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:625)
at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:576)
at com.caucho.network.listen.TcpSocketLink$AcceptTask.doTask(TcpSocketLink.java:1159)
at com.caucho.network.listen.TcpSocketLink$ConnectionReadTask.runThread(TcpSocketLink.java:1092)
at com.caucho.network.listen.TcpSocketLink$AcceptTask.run(TcpSocketLink.java:1126)
at com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:170)
at com.caucho.env.thread.ResinThread.run(ResinThread.java:126)
不过我配置之后通过浏览器访问时还是出现了下面的出错信息:
javax.servlet.ServletException: CGI execution failed.  Exit code -1072365564
at com.caucho.servlets.CGIServlet.service(CGIServlet.java:296)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
at com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChain.java:131)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:183)
at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:92)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:286)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:789)
at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:662)
at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:625)
at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:576)
at com.caucho.network.listen.TcpSocketLink$AcceptTask.doTask(TcpSocketLink.java:1159)
at com.caucho.network.listen.TcpSocketLink$ConnectionReadTask.runThread(TcpSocketLink.java:1092)
at com.caucho.network.listen.TcpSocketLink$AcceptTask.run(TcpSocketLink.java:1126)
at com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:170)
at com.caucho.env.thread.ResinThread.run(ResinThread.java:126)

-1072365564 就是 cgi perl 0xc0150004,可惜在网上搜索了很久,也没找到有用的信息。
儿通过dos夏的命令行运行却是能正常执行的。

相关参考:http://blog.chinaunix.net/u/31550/showart_317525.html

在Tomcat中通过cgi安装配置awstats:

http://618119.com/archives/2007/12/07/41.html

Older Posts »

Powered by WordPress