Archive for the ‘BSD+Linux’ Category
VPS as Remote Desktop take 2
Tuesday, May 20th, 2008GDM over VNC was great, until I discovered FreeNX. FreeNX was based on NX technologies by NoMachine. Quoted from Wikipedia:
NX technology is a computer program that handles remote X Window System connections, and attempts to greatly improve on the performance of the native X11 protocol to the point that it can be usable over a slow link such as a dial-up modem.
You see that right, dial-up modem. It’s been three days now since I’ve installed FreeNX on the Hardy VPS on SliceHost. Result? Impressive. Not only there’s barely anything you have to configure, it also tunnels connections through ssh by default to give better security. What makes it a winning choice is that it does not get disconnected :) In the previous VNC setup, if I’m disconnected and server did not realize, I have to log in and do a kill-all-pid-by-user script to finish off all processes related to the dead x-session. Maybe there’s workaround (I’m pretty sure there is), but I didn’t bother looking it up. With NX, say byebye to disconnections and hello to the sweet working x-session. Installation instruction for Ubuntu Gusty and Hardy is availble here: Installing FreeNX in Ubuntu 7.10 Gutsy. Summary:
- Add apt-source and key:
deb http://www.datakeylive.com/ubuntu hardy main
deb-src http://www.datakeylive.com/ubuntu hardy mainwget http://www.datakeylive.com/ubuntu/dists/gutsy/wjeremy.key -O - | sudo apt-key add - sudo apt-get update
- Install all necessary packages (seperately install X if you haven’t):
sudo apt-get install expect openssh-server tcl8.4 dbus-x11 libxcomp3 libxcompext3 libxcompshad nxlibs nxagent nxproxy nxclient freenx-server
- Make sure font path in /etc/X11/xorg.conf is set correctly like the following:
Section "Files" # path to defoma fonts FontPath "/usr/share/fonts/X11/misc" FontPath "/usr/share/fonts/X11/100dpi/:unscaled" FontPath "/usr/share/fonts/X11/75dpi/:unscaled" FontPath "/usr/share/fonts/X11/Type1" FontPath "/usr/share/fonts/X11/100dpi" FontPath "/usr/share/fonts/X11/75dpi" FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" EndSection - Add user:
sudo nxserver --adduser xxxx
- Download Client
總之,很好用就是了 XD
Turn your VPS/Dedicated Server into a Remote Desktop!
Monday, April 21st, 2008警告,這很惡搞 XD
Why would you do that? Because you can! And the fact that it’s a VPS/Dedicated Server, chances are its Internet connection is a lot faster than yours. As root, the following steps are tested working for Ubuntu 7.10 Gutsy.
1) Install Gnome, vnc4server, inetd
apt-get install gnome compiz vnc4server openbsd-inetd
2) Enable XDMCP
Edit /etc/gdm/gdm.conf
Look for:
[xdmcp]
Enable=false
Change it to:
Enable=true
3) Configure inetd:
Edit /etc/inetd.conf, add (one line):
5901 stream tcp nowait root /usr/bin/Xvnc Xvnc -inetd :1 -query localhost -geometry 800x600 -once -fp /usr/share/fonts/X11/misc -DisconnectClients=0 -NeverShared securitytypes=none -extension XFIXES
Now restart inetd with service restart openbsd-inetd
4) Restart GDM
service restart gdm
DONE. Now you can access your VPS as a GNOME desktop with with any vnc client at serveraddress:1, :1 being the display. You can add multiple displays for multiple desktops at the same time ;)
好孩子不要嘗試喔 XD
SSH 斷線問題
Sunday, April 20th, 2008最近剛搬到 Slicehost,有個大問題就是 SSH 沒放多久就自動斷線
明明隔壁視窗的 Bluehost 都放了兩天 idle 都沒斷,為啥 Slicehost 才半個小時就葛掉了
稍微找了一下 (其實我丟了一張 ticket :$),發現其實只要再 sshd 裡面修改一下就好了:
編輯 /etc/ssh/sshd_config
KeepAlive yes
ClientAliveInterval 60
還有因為我是從 Ubuntu 下面 GTerm 連過去的,所以其實還可以這樣改:
編輯 ~/.ssh/config
ServerAliveInterval 60
然後很奇妙的是,不再斷線了 XD
Bye bye SSH disconnecting every so fu*ing often :)
2-pass ffmpeg ipod video encoding
Friday, April 4th, 2008把檔案存成 ipodconv
input_file=$1
output_dir=/home/peter/.ipodvideos
ffmpeg -y -i "${input_file}" -an -v 1 -threads auto -vcodec libx264 \
-b 1000k -bt 175k -refs 1 -loop 1 -deblockalpha 0 -deblockbeta 0 \
-parti4x4 1 -partp8x8 1 -me full -subq 1 -me_range 21 -chroma 1 \
-slice 2 -bf 0 -level 30 -g 300 -keyint_min 30 -sc_threshold 40 \
-rc_eq 'blurCplx^(1-qComp)' -qcomp 0.7 -qmax 51 -qdiff 4 \
-i_qfactor 0.71428572 -maxrate 768k -bufsize 2M -cmp 1 -s 640x480 \
-f mp4 -pass 1 /dev/null
ffmpeg -y -i "${input_file}" -v 1 -threads auto -vcodec libx264 -b 1000k\
-bt 175k -refs 1 -loop 1 -deblockalpha 0 -deblockbeta 0 -parti4x4 1 \
-partp8x8 1 -me full -subq 6 -me_range 21 -chroma 1 -slice 2 -bf 0 \
-level 30 -g 300 -keyint_min 30 -sc_threshold 40 \
-rc_eq 'blurCplx^(1-qComp)' -qcomp 0.7 -qmax 51 -qdiff 4 \
-i_qfactor 0.71428572 -maxrate 768k -bufsize 2M -cmp 1 -s 640x480 \
-acodec libfaac -ab 192k -ar 48000 -ac 2 -f mp4 \
-pass 2 "${output_dir}/${input_file}.mov"
2 pass encoding 的用意是在於第一次是作 profiling,然後第二次就參照第一次得到的 profile 來分配哪些片段要比較高的 bitrate,這樣整體壓縮起來的效果會好很多。
不過話說回來以上的 h264 + aac 的壓縮實在非常 CPU intensive,速度大概是 mp4 的 4~5 倍.. 囧

Recent Comments