显示标签为“Linux”的博文。显示所有博文
显示标签为“Linux”的博文。显示所有博文

2007年10月16日星期二

SSH tips - configuring ~/.ssh/config to make your ssh command shorter

  有时候在家工作, 而我平时在办公室的工作环境是一台服务器, 所以在家时就需要以公司网关服务器做一些端口映射到我工作的服务器上. 但是经常敲一大串ssh command的确很烦恼, 所以就尝试着配置一下~/.ssh/config文件, 示例如下

Host gateway.com
Hostname gateway.company.com
User jacky
#forwarding of the authentication agent connection
ForwardAgent yes
GatewayPorts yes
#local ports forwarding for working servers
LocalForward localhost:9079 forge:9079
LocalForward localhost:9060 forge:9060
LocalForward localhost:9078 forge:9078
LocalForward localhost:9099 forge:9099
LocalForward localhost:9090 forge:9090
# local ports forwarding for vnc server
LocalForward localhost:5900 jacky:5900


2007年7月22日星期日

Linux 技术杂记 1

1) Ubuntu 中如何启动vncserver (reference https://help.ubuntu.com/community/VNCOverSSH)
曾经写过一篇关于如何在debian/sarge中配置vncserver来建立kde测试环境 (因项目需要)的杂记, 不过经过验证, 发现在ubuntu/edgy中已经不管用了 :( .
不过现在的vncserver已经变得很容易使用了. 参考上面的链接, 我很容易地使得vncserver又开始正常工作了
* 删除 $HOME/.vncrc 文件
* 在terminal中执行vncserver :1, 就会发现它会自动建立一个$HOME/.vnc/xstartup文件, 其中的默认脚本内容是:
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &

你只要将最后一行的"x-window-manager &"用你所需要的windows manager startup command 替换就可以了: startkde &  /  startxfce4 & / gnome-session & / metacity & 等等.


2) 让Firefox支持ed2k://链接 (reference http://www.amule.org/wiki/index.php/Ed2k_links_handling)
* 在地址栏中输入 about:config, 打开firefox的配置脚本
* 在配置列表中点击右键, 选择新增一个配置项: 类型: Boolean; 名称: network.protocol-handler.external.ed2k; 参数值: true
* 再新增另一个配置项: 类型: String; 名称: network.protocol-handler.app.ed2k; 参数值: /path/to/ed2k (ed2k命令的绝对路径, 例如在ubuntu/edgy中是 /usr/bin/ed2k)
这样, 点击ed2k链接, 就会自动在amule中下载了.
ps: 在ubuntu/debian中, 需要安装amule-utils包.

2007年2月14日星期三

Install Flash plugin for Opera in Ubuntu Edgy

There's a package named "flashplugin-nonfree", in Ubuntu Edgy package repository:

Package flashplugin-nonfree

  • edgy (web): Macromedia Flash Player plugin installer [multiverse]
    7.0.68~ubuntu3: i386
ps: for latest flash plug-in (version 9), you may need some external source list.

install it first. It will install flash plug-in module into "/usr/lib/firefox/plugins" directory.

Then edit your Opera configuration file in your home directory: ~/.opera/pluginpath.ini, adding the following line into the "Paths" section:

/usr/lib/firefox/plugins=1
ps: you can find there's already another two plug-in paths in the file.

Restart Opera, and type "opera:plugins" in the address bar of Opera browser, you can find that Shockwave Flash plug-in has been already installed.

2007年2月2日星期五

Building KDE environment in vncserver

1. Install packages
# apt-get install kdebase (Install KDE)
PS: you will install all necessary packages when install "kdebase"

# apt-get install vncserver
# apt-get install vncviewer (install vnc client & server)

2. create a user for KDE environment
To avoid to disturb your own working environment, I suggest you to add a user for KDE environment
# adduser kde

3. setup for user "kde"
# su kde
$ cd
(change to home directory)
$ cp /etc/vnc.conf .vncrc
$ vi .vncrc (configure vnc server)

configurations I defined in my own machine:
$vncUserDir = "$ENV{HOME}/.vnc";

# $vncPasswdFile contains the filename of the password file for Xvnc.
$vncPasswdFile = $vncUserDir . "/passwd";

# $vncStartup points to a script that will be started at the very beginning.
$vncStartup = "$ENV{HOME}/.vnc/kde";

# $xauthorityFile should be the path to the authority file that should be used
# by your vnc X server.
$xauthorityFile = "$ENV{HOME}/.Xauthority";

# $defaultDesktopName should be set to the default name of the desktop.
# This can be changed at the command line with -name.
$defaultDesktopName = "KDE";

# $geometry sets framebuffer width & height. Default will be calculated if
# server is started from within a running X servers. Can be changed at
# the commandline (-geometry). A fixed default will be used if
# vncserver is not invoked in a running X session.
# Example: $geometry ="640x480";
$geometry ="1024x768"
# $depth sets the framebuffer color depth. Must be between 8 and 32.
# $pixelformat sets the default pixelformat.
# The default will be calculated if none of both is specified
# and when vncserver is called from within a running X servers.
# Can be changed at the command line with option -depth.
# A fixed default value will be used if vncserver is not
# invoked in a running X session.
# Example: $depth = "16";
# $pixelformat = "rgb565";
$depth = "16"
$pixelformat = "rgb565"


PS: pay attention to "$vncStartup", we will define it later


$ mkdir .vnc (create the directory we defined in .vncrc, $vncUserDir, it's the default value)
$ cd .vnc
$ echo "startkde &" > kde (the file name is defined in "$vncStartup", it's the startup script for vncserver.)
(Use startkde & for KDE, gnome-session & for GNOME or fvwm2 & for FVWM2.)
$ vncpasswd (set password for vnc authentication, it will create a file with name defined in "$vncPasswdFile")

4. Start VNCServer
There's two ways to start vncserver:
1) setup crontab with kde user
#su kde
$ crontab -e
add following line in the crontab list:
@reboot vncserver -alwaysshared > /dev/null
It means: starting vncserver when machine startup. You can remove the "-alwaysshared" option if you don't want to share vncserver with multi-users. But only one connection is allowed if you disable the option.

2) start vncserver manually
To start the vncserver manually, you have to log in the 'kde' user in console. I have met a weird thing here: the vncserver doesn't work well in following steps:
open a Gnome Terminal in my own user
sudo su kde
vncserver

But if I log in 'kde' in tty1 (press Ctrl+Alt+F1), the vncserver works well.

For more details please read manual of vncserver.


5. Connect to VNCServer
$ vncviewer localhost:1 (1 means the display#, you should change it if the vncserver is using other display)
PS: run the command in your own user desktop.
Then you can enjoy your own KDE:)

6. Stop VNCServer
$ vncserver -kill :1 (stop the vncserver in display 1)

References:
http://www.linuxjournal.com/article/5499
http://perso.netplus.ch/FCorthay/InstallGentoo/Shortforms/gentoo-kde-2.6.html