Archive for the ‘Linux’ Category

在64位的环境下编译32位的应用程序

测试环境:
CPU : 64bit Intel(R) Xeon(TM) CPU 2.80GHz * 2
OS :Debain / Linux 2.6.17.11 #2 SMP Thu Sep 7 00:44:27 CST 2006 x86_64 GNU/Linux
GCC: version 4.1.2 20060814 (prerelease) (Debian 4.1.1-11)
背景知识: http://www.divms.uiowa.edu/local/linux_help/rh_ws3_amd64_faq.html

我们的 64bit Debain 需要安装以下软件包
apt-get install ia32-libs libc6-dev-i386 linux32
1) 最关键的东西是需要告知gcc编译器编译的平台是 i386,CFLAGS 必须添加 -m32 参数. [关于gcc编译参数的官方文档]
2) 用 linux32 命令在configure改一下CHOST,设置一下编译环境

Read the rest of this entry »

SSH不输入密码连接远程Linux主机

系统环境 : ubuntu 6.06 / ubuntu 6.10
SSH服务 : openssh-server
1) 在本地主机生成密钥对
ssh-keygen -t rsa
这个命令生成一个密钥对:id_rsa(私钥文件)和id_rsa.pub(公钥文件)。默认被保存在~/.ssh/目录下。
2) 将公钥添加到远程主机的 authorized_keys 文件中
将文件上传到远程主机中
scp ~/.ssh/id_rsa.pub root@192.168.1.23:/root/
SSH到登陆到远程主机,将公钥追加到 authorized_keys 文件中
cat /root/id_rsa.pub >> /root/.ssh/authorized_keys
或直接运行命令:
cat ~/.ssh/id_dsa.pub|ssh root@192.168.1.23 ’sh -c “cat – >>~/.ssh/authorized_keys2″‘
3) 重启 open-ssh 服务
/etc/init.d/ssh restart

4) 测试
ssh root@192.168.1.23
scp /home/onion/.ssh/id_rsa.pub root@192.168.1.23:/root/
呵呵,不用输入密码了:)
== 附录 ==
/etc/ssd/sshd_config 几个关键配置点

PermitRootLogin yes
PasswordAuthentication yes
# AuthorizedKeysFile .ssh/authorized_keys # 这个地方尽量使用默认,gentoo 下 [...]

Read the rest of this entry »

解决ubuntu下mplayer播放乱码问题

安装请参考 http://www.oldskoolphreak.com/tfiles/hack/ubuntu.txt
遇到的主要问题是播放中文字幕文件时会乱码.
解决思路是中文字体和调整codepage.
在安装mplayer,先安装freetype支持
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.2.1.tar.bz2 tar –xjf   freetype-2.2.1.tar.bz2 cd freetype-2.2.1 ./configure make;make install
安装完毕后,重新编译mplayer
cd MPlayer-1.0pre7try2 ./configure –enable-gui –enable-freetype make;make install
之后将你喜欢的字体文件,如simhei.ttf, copy到 /usr/local/share/mplayer/fonts 下
重新运行gmplayer,在perfermences将Encoding改为simple chinese(cp936),并选中unicode subtitle,最后在Font选项卡,选中字体为simhei.ttf encoding 为默认的unicode即可,这样便大功告成了.

 Update ::
[2006/10/29] MPlayer-1.0rc1 可以在ubuntu 6.10上使用gcc-4.1.2编译通过,但是必须要卸载包 libgtk1.2-dev, 改装libgtk2.0-dev,否则编译的时候会提示 “undefined reference to `vo_setwindow’”

[2006/06/27] MPlayer-1.0pre8 使用gcc 4.0的编译器虽然能编译成功,但不能正常运行,会出现 *** glibc detected *** free(): 的错误之后就crash了,换成gcc 3.4编译后正常.另外编译的时候需要加上一个 –enable-png 的选项,否则可能会通不过configure.
[2006/06/06] [...]

Read the rest of this entry »

去看龙芯II和Suse Linux 10.1

上次在 LinuxFans.org 看到今天在上海有一个 Linux 技术交流大会,据说有龙芯II的样机和suse Linux的demo,反正没事,去瞧瞧呗。

Read the rest of this entry »

Linux下Firefox Flash 插件播放视频没有声音的问题

感谢 BLooDY 提供办法.
1.安装 alsa-oss 包:
sudo apt-get install alsa-oss
2.编辑 firefoxrc 文件:
sudo vim /etc/firefox/firefoxrc
将其中的 FIREFOX_DSP=”” 修改为 FIREFOX_DSP=”aoss”。
3.Enjoy!
我尝试不装 alsa-oss 只是修改 FIREFOX_DSP=”auto”,也能播放声音.
update::
2006-09-18:今晚按照上面的步骤再弄了一次,没有成功,但是重启一下计算机就OK了.

Read the rest of this entry »

在 Linux/Apache 2.2 上配置SVN服务器

准备,下载所需要文件.
检查已安装的 Apache2 是否已经安装了 mod_dav .
编译SVN,遇到的问题和解决方法

使用 默认文件系统(fsfs) 保存数据
使用 Berkeley DB 保存数据

配置Apache和SVN,测试.
其它小结

从Windows平台上数据转移
配置文件,使用其支持对文件中的 $Id$ 标签每次提交的时候自动更新版本信息.
基于路径的权限控制

Read the rest of this entry »

在Ubuntu Server上编译安装 Apache 2.2(with SSL) + PHP 5.1.4 + MYSQL 5.0.22

配置最新最IN的 Web Server!! 编译 Apache 2.2 + PHP 5.1.2 + MYSQL 5.0.19 的详细步骤.

准备,下载所需要的库文件
安装 Ubuntu Server
安装编译器和必须的运行库
编译安装 Apache 2.2、PHP 5.12、MySQL 5.01
测试,配置Apache和MySQL自启动.

Read the rest of this entry »

squid安装笔记

 —- 安装 —-
wget http://www.squid-cache.org/Versions/v2/2.5/squid-2.5.STABLE13.tar.gztar zxf squid-2.5.STABLE13.tar.gzcd squid-2.5.STABLE13./configure –prefix=/usr/localmakemake installvi /usr/local/squid/etc/squid.conf
mkdir /var/squid/cachechown -R nobody:nobody /var/squid/cachechmod 0777 /var/squid/cache -R/usr/local/squid/sbin/squid -z/usr/local/squid/sbin/squid -NCd1
 

 —- 配置文件 —-
# 默认端口http_port 80
# 缓存暂用内存大小cache_mem 512 MBmaximum_object_size_in_memory 4128 KB
# 缓存目录,及其大小cache_dir ufs /var/squid/cache 2048 16 256
# 关闭访问日志cache_access_log nonecache_log nonecache_store_log none
auth_param basic children 5auth_param basic realm Squid proxy-caching web serverauth_param basic credentialsttl 2 hoursauth_param basic casesensitive off
#hierarchy_stoplist cgi-bin [...]

Read the rest of this entry »