??xml version="1.0" encoding="utf-8" standalone="yes"?>久久综合五月丁香久久激情,久久久久久极精品久久久 ,99国产欧美精品久久久蜜芽http://www.shnenglu.com/byc/category/17578.html学习资料记录zh-cnMon, 29 Oct 2012 16:55:56 GMTMon, 29 Oct 2012 16:55:56 GMT60U除bzImage文g?1f8b08'之前内容Q存为gz文ghttp://www.shnenglu.com/byc/archive/2012/10/29/194021.html八叶?/dc:creator>八叶?/author>Mon, 29 Oct 2012 08:02:00 GMThttp://www.shnenglu.com/byc/archive/2012/10/29/194021.htmlhttp://www.shnenglu.com/byc/comments/194021.htmlhttp://www.shnenglu.com/byc/archive/2012/10/29/194021.html#Feedback0http://www.shnenglu.com/byc/comments/commentRss/194021.htmlhttp://www.shnenglu.com/byc/services/trackbacks/194021.html 

#include <stdlib.h>
#include 
<stdio.h>

int _tmain(int argc, _TCHAR* argv[])
{
    FILE
* r=fopen("linux26","rb");
    FILE
* w=fopen("linux26.gz","wb");
    
int s=0;
    
for(;;)
    
{
        unsigned 
char c;
        
int l=fread(&c,1,1,r);
        
if(l>=1)
        
{
            
if(s==3)
            
{
                fwrite(
&c,1,1,w);
            }

            
else if(s==2)
            
{
                
if(c==0x08)
                
{
                    c
=0x1f;
                    fwrite(
&c,1,1,w);
                    c
=0x8b;
                    fwrite(
&c,1,1,w);
                    c
=0x08;
                    fwrite(
&c,1,1,w);
                    
++s;
                }

                
else
                
{
                    s
=0;
                }

            }

            
else if(s==1)
            
{
                
if(c==0x8b)
                
{
                    
++s;
                }

                
else
                
{
                    s
=0;
                }

            }

            
else if(s==0)
            
{
                
if(c==0x1f)
                
{
                    
++s;
                }

            }

        }

        
else
        
{
            
break;
        }

    }

    fclose(w);
    fclose(r);
    
return 0;
}

 



]]>
centos 6.2 手动~译 apche php ~译http://www.shnenglu.com/byc/archive/2012/01/11/163982.html八叶?/dc:creator>八叶?/author>Wed, 11 Jan 2012 03:14:00 GMThttp://www.shnenglu.com/byc/archive/2012/01/11/163982.htmlhttp://www.shnenglu.com/byc/comments/163982.htmlhttp://www.shnenglu.com/byc/archive/2012/01/11/163982.html#Feedback0http://www.shnenglu.com/byc/comments/commentRss/163982.htmlhttp://www.shnenglu.com/byc/services/trackbacks/163982.htmlwget http://apache.etoak.com//httpd/httpd-2.2.21.tar.gz
tar xzvf httpd-2.2.21.tar.gz
cd httpd-2.2.21
./configure --enable-so --enable-mods-shared=most
make
make install

vi /usr/local/apache2/conf/httpd.conf #~辑配置文g
扑ֈQ?ServerName www.example.com:80
修改为:ServerName localhost:80
扑ֈQDirectoryIndex index.html
修改为:DirectoryIndex index.html index.php
扑ֈQOptions Indexes FollowSymLinks
修改为:Options FollowSymLinks #不显C目录结?br />增加
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd 
vi /etc/init.d/httpd
 在文件最前面插入下面的行Q其支持chkconfig命oQ?nbsp;
#!/bin/sh
# chkconfig: 2345 85 15
# description: Apache is a World Wide Web server.
Q注Q在q行U?/3/4/5中加入服务,启动序85Q停止顺?5Q?br />
chkconfig --add httpd
service htpd start


yum install mysql-devel
yum install libpng-devel
yum install libjpeg-devel
yum install libxml2-devel

wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download
tar xzvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install


//wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
//tar xzvf libiconv-1.14.tar.gz
//cd libiconv-1.14 
//./configure
//make
//make install



wget http://museum.php.net/php5/php-5.1.6.tar.gz
tar xzvf php-5.1.6.tar.gz
cd php-5.1.6
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-gd --with-xlib --with-mysqli --with-jpeg-dir=/usr/lib/jpeg --with-zlib-dir=/usr/lib/zlib
//--with-mcrypt

make 
~译出错  ext/mysqli/mysqli_api.c:145: error: 'gptr' undeclared (first use in this function)
处理  ext/mysqli/mysqli_api.c and replace all occurrances of gptr with char*

make install

~辑 httpd.conf 文g以调?PHP 模块。LoadModule 表达式右边的路径必须指向 pȝ中的 PHP。以上的 make install 命o可能已经完成了这些,但务必要查?LoadModule php5_module modules/libphp5.so

cp php.ini-dist /usr/local/php5/etc/php.ini





PHP扩展mcrypt~译时提C:configure: error: *** libmcrypt was not found


需要安装libmcrypt+mhash+mcrypt

全部~译安装Q安装到mcrypt的时候出C问题

./config
checking for libmcrypt - version >= 2.5.0... no
*** Could not run libmcrypt test program, checking why...
*** The test program compiled, but did not run. This usually means
*** that the run-time linker is not finding LIBMCRYPT or finding the wrong
*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location  Also, make sure you have run ldconfig if that
*** is required on your system
***
*** If you have an old version installed, it is best to remove it, although
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH
***
configure: error: *** libmcrypt was not found

解决Ҏ如下Q运?export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

然后make Q?make install

完成




]]>
centos5 php5.1.6 升?php5.2.17http://www.shnenglu.com/byc/archive/2011/12/29/163068.html八叶?/dc:creator>八叶?/author>Thu, 29 Dec 2011 01:54:00 GMThttp://www.shnenglu.com/byc/archive/2011/12/29/163068.htmlhttp://www.shnenglu.com/byc/comments/163068.htmlhttp://www.shnenglu.com/byc/archive/2011/12/29/163068.html#Feedback0http://www.shnenglu.com/byc/comments/commentRss/163068.htmlhttp://www.shnenglu.com/byc/services/trackbacks/163068.htmlhttp://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-8.ius.el5.noarch.rpm
root@linuxbox ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-5-4.noarch.rpm
root@linuxbox ~]# rpm -Uvh ius-release*.rpm epel-release*.rpm
$ sudo yum install yum-plugin-replace
[root@linuxbox ~]# yum replace php --replace-with php52

来源  http://wiki.iuscommunity.org/Doc/ClientUsageGuide


MU办?br />

CentOS 5.x pȝ下用yum 升php?.2.x 最方便Ҏ

先将以下地址导入?/p>

# rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

# vi /etc/yum.repos.d/CentOS-Base.repo 增加下面信息

[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

执行命oQ自动升U?br />
yum update php -y
yum install libmcrypt -y



]]>
vsftpdhttp://www.shnenglu.com/byc/archive/2011/12/27/162898.html八叶?/dc:creator>八叶?/author>Tue, 27 Dec 2011 03:39:00 GMThttp://www.shnenglu.com/byc/archive/2011/12/27/162898.htmlhttp://www.shnenglu.com/byc/comments/162898.htmlhttp://www.shnenglu.com/byc/archive/2011/12/27/162898.html#Feedback0http://www.shnenglu.com/byc/comments/commentRss/162898.htmlhttp://www.shnenglu.com/byc/services/trackbacks/162898.htmlyum install vsftpd
adduser -d /var/www/html -g ftp -s /sbin/nologin ftptest
passwd ftptest
/etc/vsftpd/vsftpd.conf
只能讉K自己的目?br />chroot_local_user=yes



]]>
centos vnc 服务 配置http://www.shnenglu.com/byc/archive/2011/12/08/161733.html八叶?/dc:creator>八叶?/author>Thu, 08 Dec 2011 01:56:00 GMThttp://www.shnenglu.com/byc/archive/2011/12/08/161733.htmlhttp://www.shnenglu.com/byc/comments/161733.htmlhttp://www.shnenglu.com/byc/archive/2011/12/08/161733.html#Feedback0http://www.shnenglu.com/byc/comments/commentRss/161733.htmlhttp://www.shnenglu.com/byc/services/trackbacks/161733.html1Q首先确认你服务器是否配|了VNCSERVERQ可以在命o行下敲入以下命o查看Q?
rpm -qa |grep vnc 
yum isntall vnc-server


2 启动VNCSERVERQ第一ơ启动VNCSERVER会提C入密码,q里分ؓ理员̎户及普通̎P启动方式略有所不同?
[root@localhost /]# vncserver
You will require a password to access your desktops.
Password: 123456 #输入vnc q接密码
Verify: 123456 #认vnc密码
xauth: creating new authority file /root/.Xauthority
New ‘localhost.localdomain:1 (root)’ desktop is localhost.localdomain:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log


3 每个用户都可以启动自qVNCSERVERq程桌面Q同时每个用户可以启动多个VNCSERVERq程桌面Q它们用ip加端口号Qip:1、ip:2、ip:3 来标识、区分,使用同一端口会另外d的用戯动退出。另QVNCSERVER的大部分配置文g及日志文仉在用户home目录?vnc目录下?
用户可以自定义启动号码如Q?
[ceboy@localhost /]$ vncserver :2 #注意:2前面一定要有空根{?
A VNC server is already running as :2


3 配置gnome桌面
如果你是gnome桌面Q那么你需要修?root/.vnc/xstartup的配|文件?
[root@localhost .vnc]# vi xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session & #dq一句是q接时用gnome 桌面环境
#twm &

讄修改完毕最好是重启一ơ系l,否则讄不会生效。我采用的方法是杀死VNCSERVERq程再重q行VNCSERVER?

[root@localhost .vnc]#vncserver -kill :1 #q里你启动vncserver时是什么端口号要对应上?
[root@localhost .vnc]#vncserver :1 #重启VNCSERVERQ注?1前面一定要有空根{?

4Q设|用户信息及分L率?

[root@localhost: ~]#vi /etc/sysconfig/vncservers

VNCSERVERS=”1:root 2:ceboy” #此处d用户Q一般只d一?:root也就行了?
VNCSERVERARGS[1]=”-geometry 800×600 -nolisten tcp -nohttpd -localhost”
-nolisten tcp -nohttpd
如果你要透過 Browser 來?VNC,請移除這設?
-localhost
如果你只允許local(127.0.0.1) 透過 Browser 來連結 VNC.請加入這設?/span>

另外也可以通过命o行时修改分辨率及色深,q种方式重启后就会丢失,q里暂时用不刎ͼ命o如下Q?
[root@localhost: ~]#vncserver -geometry 800×600 #讄vncserver的分辨率
[root@localhost: ~]#vncserver -depth 16 #讄vncserver的色?/span>
|密?br />
#vncpasswd




5Q同一个显C器可以q接多个客户?
#vncserver -alwaysshared





]]>
centos groupinstall http://www.shnenglu.com/byc/archive/2011/11/26/161009.html八叶?/dc:creator>八叶?/author>Sat, 26 Nov 2011 13:47:00 GMThttp://www.shnenglu.com/byc/archive/2011/11/26/161009.htmlhttp://www.shnenglu.com/byc/comments/161009.htmlhttp://www.shnenglu.com/byc/archive/2011/11/26/161009.html#Feedback0http://www.shnenglu.com/byc/comments/commentRss/161009.htmlhttp://www.shnenglu.com/byc/services/trackbacks/161009.htmlyum groupinstall "DNS Name Server"

yum groupinstall "Web Server"
yum groupinstall "Mail Server"

yum groupinstall "MySQL Database"

yum groupinstall "Development Tools" 
yum groupinstall "GNOME Desktop Environment"

yum groupinstall "X Window System"
yum groupinstall "KDE (K Desktop Environment)"

yum groupremove

rpm -e *
"error: %preun(*) scriptlet failed, exit status 1"
解决Ҏ为加 --noscripts 标记来删除RPM?--noscripts 相当?--nopre --nopost --nopreun --nopostun?/font>



]]>
grub4dos menu.lsthttp://www.shnenglu.com/byc/archive/2011/11/26/160995.html八叶?/dc:creator>八叶?/author>Sat, 26 Nov 2011 05:00:00 GMThttp://www.shnenglu.com/byc/archive/2011/11/26/160995.htmlhttp://www.shnenglu.com/byc/comments/160995.htmlhttp://www.shnenglu.com/byc/archive/2011/11/26/160995.html#Feedback0http://www.shnenglu.com/byc/comments/commentRss/160995.htmlhttp://www.shnenglu.com/byc/services/trackbacks/160995.html
title centos57-gui
find --set-root /centos57/vmlinuz
kernel /centos57/vmlinuz
initrd /centos57/initrd.img

title centos57-text
find --set-root /centos57/vmlinuz
kernel /centos57/vmlinuz text
initrd /centos57/initrd.img

title pbr
rootnoverify (hd0,3)
chainloader +1

title syslinux
find --set-root /syslinux.BIN
chainloader /syslinux.BIN


--ks

#Use CDROM installation media
#cdrom
harddrive  --partition=/dev/hd3  --dir=/

#System bootloader configuration
bootloader --location=none
bootloader --location=mbr --driveorder=sda,sdb

title elastix
find --set-root /menu.lst
kernel /elastix/vmlinuz ks=hd:sdb4:/elastix/ks_default.cfg ramdisk_size=8192
initrd /elastix/initrd.img

title centos6livecd
kernel /LiveOS/vmlinuz0 root=live:CDLABEL=GRUB rootfstype=auto ro liveimg quiet nodiskmount nolvmmount  rhgb vga=791 rd.luks=0 rd.md=0 rd.dm=0
initrd /LiveOS/initrd0.img






]]>
VNC(Virtual Network Computing) http://www.shnenglu.com/byc/archive/2011/11/24/160929.html八叶?/dc:creator>八叶?/author>Thu, 24 Nov 2011 12:47:00 GMThttp://www.shnenglu.com/byc/archive/2011/11/24/160929.htmlhttp://www.shnenglu.com/byc/comments/160929.htmlhttp://www.shnenglu.com/byc/archive/2011/11/24/160929.html#Feedback0http://www.shnenglu.com/byc/comments/commentRss/160929.htmlhttp://www.shnenglu.com/byc/services/trackbacks/160929.htmlhttp://blog.yam.com/iwinblue/article/14961544
Step 0:介
Step 1:檢查你的pȝ是否有提?VNC 工具
Step 2:VNC的設定檔
Step 3:VNC ?password
Step 4:檢查 VNC 服務是否啟動
Step 5:指定用哪?XWindow
Step 6:VNC Viewer
Step 7:VNC via Browser

Step 0:介
VNC(Virtual Network Computing) 是可以遠端遙?Linux 桌面的服?

Step 1:檢查你的pȝ是否有提?VNC 工具
[root@unsvr root] # rpm -aq | grep -i vnc
vnc-server-version
vnc-version

如果沒有關係可以?VNC 的官方網站下?http://www.realvnc.com

Step 2:VNC的設定檔
VNC的設定檔存放?/etc/sysconfig/vncservers
[root@unsvr root] # vi /etc/sysconfig/vncservers
--------------------------------------------------------
VNCSERVERS="2:root"
VNCSERVERARGS[2]="-genometry 800*600 -nolisten tcp -nohttpd -localhost"
--------------------------------------------------------

VNCSERVERS="2:root"
上面意思是?我們要啟動一?VNC ?port 5900+2 ?5902 的意?使用者為 root.

VNCSERVERARGS[2]="-genometry 800*600 -nolisten tcp -nohttpd -localhost"
-genometry 800*600
x-windows的解析度?800*600
-nolisten tcp -nohttpd
如果你要透過 Browser 來?VNC,請移除這設?
-localhost
如果你只允許local(127.0.0.1) 透過 Browser 來連結 VNC.請加入這設?br />

Step 3: VNC ?password
基本?VNC ?password 無法使用 /etc/passwd,所以要自己a定.
[root@unsvr root] # vncpasswd
Password:
Verify:
這是?root 使用者來a定.如果要設定其他用者請 #su - user 轉換後在a定.

Step 4:檢查 VNC 服務是否啟動
[root@unsvr ~]# service vncserver start
如果要讓每次開機時都能啟?vnc server,請鍵入下面指?
[root@unsvr ~]# chkconfig vncserver on

[root@unsvr root]# netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:5802 0.0.0.0:* LISTEN 15287/Xvnc
tcp 0 0 0.0.0.0:5902 0.0.0.0:* LISTEN 15287/Xvnc
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 15019/X


說明:
port 5802 是 Web Browser 使用.
port 5902 是 VNCViewer 使用.

Step 5:指定用哪?XWindow
指定用哪?XWindow 是設定在 $HOME/.vnc/xstartup ?
---------------------------------------------------------------------------
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
---------------------------------------------------------------------------
預設?XWindow?twm如果有需要其他的請設定成下面?XWindow.
gnome-session & (==> for GNOME)
startkde & (==> for KDE)


Step 6:VNC Viewer
?Linux 下可以直接?br />[root@unsvr root]#vncviewer

不過 Windows 並沒有安?所以需要至 http://www.realvnc.com 下載.

Step 7:VNC via Browser
Windows:
不想下載一堆有的沒有的,可以考慮使用 web browser的方式來連結.不過前提是需要加?Java Runtime Environment (JRE) http://www.java.com
?Windows 底下?browser,輸入E址,再加?port number : 5802 可以透過 Web 方式連結.

Linux:
安裝 java runtime environment
你可以在 java 的安裝目錄下 /usr/jave/plugin/i386/ns7/ 扑ֈ libjavaplugin_oji.so ?
?~/.mozilla/plugins/ 目錄做一個符號連結?libjavaplugin_oji.soQ不可以直接複製?

[root@unsvr root]# cd ~/.mozilla/plugins/
[root@unsvr root]# ln -s /usr/java/jre1.5.0_04/plugin/i386/ns7/libjavaplugin_oji.so

可以參?Mozilla 的網?br />http://wiki.moztw.org/index.php/Plugins_%E7%9A%84%E5%AE%89%E8%A3%9D

另一:
C? linux 开机启?oracle


下蝲地址Qhttp://www.realvnc.com/download.html

参考资?

http://liy.slat.org/study/tips/vnc.html

http://www.realvnc.com

< W一Ҏ>

遠端控制一直是個理想的工作目標Q你不但可以在本用電腦,在離開之後,還可以用網路用遠端的功能來繼U你未完的工作?br />珑֜市面上最行?Symantec PcAnywhere 也是這種功能Q但是這是要花 錢的Q而且還蠻貴的Q當Ӟ它還包含了一些其它的進階功能。然而,如果你只 需要單純只要可以遠端控制你的電腦的話,當然׃用如此殺雞用牛刀了,VNC (Virtual Network Computing) 正是我們所需要的軟體Q他不但是完?Free 的,你可以拿C的可埯檔,或是如果你的興趣的話Q也可以扑ֈ他的 Source 供你研究Q最重要的一點,他的檔案很小Q只需要一片磁片就夠了?br />
這篇文章?RedHat 8 、RedHat 9 ?Fedora 1 上測過,可以正常埯?br />
1. 首先Q我們們要先下?VNC 來安裝,假設我們現在裝在自q家目錄 ?VNC/vncgo 目錄裡?br />
# cd ~
# wget http://www.realvnc.com/dist/vnc-3.3.7-x86_linux.tar.gz
# tar -zxvf vnc-3.3.7-x86_linux.tar.gz
# mv vnc-3.3.7-x86_linux vnc
# cd vnc
# mkdir -p ~/VNC/vncgo
# ./vncinstall ~/VNC/vncgo


2. 接著Q我們就要設定環境變數,因為 VNC 在啟動的時候,會去扄關的檔案Q所以一定要先指?PATH 的變數。如果你?rootQ你可以把下面的三行指o寫到 /etc/profile 裡面?br />
# PATH="$PATH":~/VNC/vncgo
# export $PATH
# echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/UserHomeDir/VNC/vncgo

3. 以上安裝完?VNC Server Q現在就開始來玩玩吧Q先開啟W一ơ,讓他
產生必要的檔案,如果是第一ơ執行,會要你輸入d的密才行!

# vncserver

4. 然後關閉 VNC

# vncserver -kill :1

5. 修改 X 的設? 這樣你的遠端桌面才會美?

# cd ~/.vnc/xstartup
# vi xstartup
________________________________________________________________
#!/bin/sh
#下面都註解v?br />#輸入下面這一?br />/etc/X11/xinit/Xclients
#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
:______________________________________________________________



6. 最? 開?VNC ?br />
# vncserver

7. 遠端控制
埯 vncviewer Q?VNC Viewer 來看Q入IP:numQIP 是主的位置Qnum ?vnc 的啟動項目,開啟 vnc 服務時會有提C)

< W二U方?gt;

(1)tar -xvf vnc-4.0-x86.tar

(2)cd vnc-4.0-x86

(3) ./vncinstall /usr/local/bin

(4) mkdir -P /usr/local/vnc/classes

(5) cp java/* /usr/local/vnc/classes

(6) vncserver 启动Q可以正常运行了 可以通过 netstat -an | grep 01查看端口是否正常启动Q如果要看到桌面可按如下ҎQ?br />
vi ~/.vnc/xstartup文g中加入如下两句:

unset SESSION_MANAGER

exec /etc/X11/xinit/xinitrc 如有/etc/X11/xinit/Xclients 此句注掉

另二:

Vnc Server 4.1.2 建置on CentOS 5
adj D? 2007-11-29 21:57 來源: ADJE\控股集團

Check what's installed
First check if you already have them installed on your system, open a terminal and type:
CODE:

$ rpm -qa|grep vnc
vnc-server-4.1.1-36
vnc-4.1.1-36
If you get an output something like this then you're all ready, if not you need to install them via yum.

Add a user(s)
Next we need to add at least 1 VNC user, open the file /etc/sysconfig/vncservers as root and add the information shown:
CODE:

$ vi /etc/sysconfig/vncservers

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# .

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.

VNCSERVERS="1:bobpeers"
VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"
The important part is the VNCSERVERS="1:bobpeers", this sets up a users for the vnc server, you can add as many as you like here. The VNCSERVERARGS[1] line refers to the arguments for user 1, in this case the only user. Geometry sets the size and depth sets the colour depth, you can adjust these to suit your preferences but in my case the client machine has a resolution of 1024x768 and the depth 16 makes the connection a bit faster since the less information that needs to be sent the more responsive the session will feel.

Knowing which port to use
It's also important to note the session number user as this will tell us which port vncserver will listen on. Remember the Gnome Remote Desktop asked us to use computername:0 as the connection string, the number needs to be added to 5900 to get the listening port. In this case we need to use port 5901 since we are using session 1. In the same way we could use any number, for example:
CODE:

VNCSERVERS="2000:bobpeers"
VNCSERVERARGS[2000]="-geometry 1024x768 -depth 16"
In this case we need to use port 5900+2000 so port 7900.

Setting a password
To add some security we need to add a password that must be given before a connection can be established, open a terminal and type:
CODE:

$ vncpasswd
Password:
Verify:
This creates a hidden folder called .vnc in your home folder containing the password file.

Starting the server and startup options
To start the server we type the command 'vncserver' and the session you wish to start (if you have set up more than 1 entry in the /etc/sysconfig/vncservers file:
CODE:

$ vncserver :1
Starting VNC server: 1:bobpeers
New 'linux.bobpeers:1 (bobpeers)' desktop is linux.bobpeers:1

Starting applications specified in /home/bobuser/.vnc/xstartup
Log file is /home/bobuser/.vnc/linux.bobpeers:1.log

[ OK ]
Now the server is started and a user could connect, however they will get a plain grey desktop by default as the connection will not cause a new session of X to start by default, to fix this we need to edit the startup script in the .vnc folder in your home directory.
CODE:

$ vi ~/.vnc/xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
As the file says make sure the two lines at the top are uncommented by removing the leading # sign. Next we need to restart vncserver to pick up the changed we just made. To restart the vncserver we need to kill the process and start a new one as root:
CODE:

$ vncserver -kill :1
Killing Xvnc process ID 13728

$ vncserver :1
Starting VNC server: 1:bobpeers
New 'linux.bobpeers:1 (bobpeers)' desktop is linux.bobpeers:1

Starting applications specified in /home/bobuser/.vnc/xstartup
Log file is /home/bobuser/.vnc/linux.bobpeers:1.log

[ OK ]
PS: 測試時發?$Home/.vnc/xstartup 需要有 +x 的權?..要不然登入遠端主時會看不到GDM的畫?..可能要注意一?br />

盔R文章來至:
http://bobpeers.com/linux/vnc.php

另二:
Configuring the VNC server/viewer in Linux.
Page contents
Overview of VNC
Gnome Remote Desktop (vino)
vncserver and viewer
Allowing remote connections
Overview of VNC
VNC, or Virtual Networked Computing, is a way of controlling a remote computer just as though you are sitting in front of it. In the Windows world it is also known as remote desktop but it's normally referred to as VNC in the Linux world. All that happens is that you connect using a VNC client to a remote computer running the VNC server, then an image of the remote desktop is transmitted to your local computer and you can see and control the desktop just as though you are there since all keyboard and mouse commands are sent from your client machine to the server.

Gnome Remote Desktop
If you are running the Gnome desktop on Fedora Core then you already have a VNC server built in. Click on the Fedora icon > Desktop > Preferences > Remote Desktop to open the dialog shown.



The screen is pretty self explanatory but basically when set up this way another computer can connect to your computer using the command listed on the dialog. There are a few important things to note, you must open port 5900 on the server for this to work since by default the Gnome Remote Desktop (called vino) listens on this port, also the person connecting will see the same session that you are currently logged in as. This means that any programs you have open will also be visible to the client, of course this is very useful if you are helping someone remotely.

A more flexible way to use VNC is to install the VNC server and client software via yum, these are rpm's based on RealVNC.

vncserver and vncviewer
Check what's installed
First check if you already have them installed on your system, open a terminal and type:

$ rpm -qa|grep vnc
vnc-server-4.1.1-36
vnc-4.1.1-36

If you get an output something like this then you're all ready, if not you need to install them via yum.

Add a user(s)
Next we need to add at least 1 VNC user, open the file /etc/sysconfig/vncservers as root and add the information shown:

$ vi /etc/sysconfig/vncservers

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
#
.

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.

VNCSERVERS="1:bobpeers"
VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"

The important part is the VNCSERVERS="1:bobpeers", this sets up a users for the vnc server, you can add as many as you like here. The VNCSERVERARGS[1] line refers to the arguments for user 1, in this case the only user. Geometry sets the size and depth sets the colour depth, you can adjust these to suit your preferences but in my case the client machine has a resolution of 1024x768 and the depth 16 makes the connection a bit faster since the less information that needs to be sent the more responsive the session will feel.

Knowing which port to use
It's also important to note the session number user as this will tell us which port vncserver will listen on. Remember the Gnome Remote Desktop asked us to use computername:0 as the connection string, the number needs to be added to 5900 to get the listening port. In this case we need to use port 5901 since we are using session 1. In the same way we could use any number, for example:

VNCSERVERS="2000:bobpeers"
VNCSERVERARGS[2000]="-geometry 1024x768 -depth 16"

In this case we need to use port 5900+2000 so port 7900.

Setting a password
To add some security we need to add a password that must be given before a connection can be established, open a terminal and type:

$ vncpasswd
Password:
Verify:

This creates a hidden folder called .vnc in your home folder containing the password file.

Starting the server and startup options
To start the server we type the command 'vncserver' and the session you wish to start (if you have set up more than 1 entry in the /etc/sysconfig/vncservers file:

$ vncserver :1
Starting VNC server: 1:bobpeers
New 'linux.bobpeers:1 (bobpeers)' desktop is linux.bobpeers:1

Starting applications specified in /home/bobuser/.vnc/xstartup
Log file is /home/bobuser/.vnc/linux.bobpeers:1.log

[ OK ]

Now the server is started and a user could connect, however they will get a plain grey desktop by default as the connection will not cause a new session of X to start by default, to fix this we need to edit the startup script in the .vnc folder in your home directory.

$ vi ~/.vnc/xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

As the file says make sure the two lines at the top are uncommented by removing the leading # sign. Next we need to restart vncserver to pick up the changed we just made. To restart the vncserver we need to kill the process and start a new one as root:

$ vncserver -kill :1
Killing Xvnc process ID 13728

$ vncserver :1
Starting VNC server: 1:bobpeers
New 'linux.bobpeers:1 (bobpeers)' desktop is linux.bobpeers:1

Starting applications specified in /home/bobuser/.vnc/xstartup
Log file is /home/bobuser/.vnc/linux.bobpeers:1.log

[ OK ]

Using vncviewer
To start the viewer type:

$ vncviewer localhost:5901
This open a dialog as shown for us to enter our password we set earlier, enter the password and you should now see a copy of your desktop. Note that unlike the Gnome Remote Desktop this has started a new session of X so any applications open on the host machine are not visible to the new session, it's basically a whole new logon running at the same time.

If you just type 'vncviewer' at the prompt then you will asked for the host to connect to, then you can type localhost:5901 for example. Remember to use the correct port number when connecting, if you set your VNCSERVERS to be 2000:myname then you would need to connect on localhost:7900.



Stopping the vncserver
There are two ways to stop the server, either as root:

$ /sbin/service vncserver stop
Shutting down VNC server: 1:bobpeers [ OK ]

or you can explicitly kill a particular session without being root:

$ vncserver -kill :1
Killing Xvnc process ID 13728

Just replace the 1 with the vnc session you wish to stop.

Allowing remote connections
So far we have only connected to our own computer using localhost so we have not needed to open any ports in the firewall, however if we want to allow remote connection we will have to do the following. This can either be done from the command line or using system-config-security if you have it installed.

Using system-config-security to opens ports.
First we'll look into the GUI system-config-security. Go to the Fedora start menu > Desktop > Administration > Security Level and Firewall, then type your root password when prompted to see this:



Click on other ports at the bottom and enter the port you wish to open, 5901 in my case, select tcp, then click OK and OK again to save your settings. That's all there is to it, but remember to close the port again when you are finished.



Editing the iptables manually to opens ports.
To do the same from the command line add the line in bold to the file /etc/sysconfig/iptables while logged in as root:

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

Finally we need to restart the iptables service to reload the changes.

$ sudo /sbin/service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
Loading additional iptables modules: ip_conntrack_netbios_n[ OK ]

Connecting from the remote machine.
Now from the remote client computer start up vncviewer but this time use the IP address of the host computer followed by the port number. So on my home network this might be:

$ vncviewer 192.168.1.105:5901




]]>
ubuntu DVD讄本地更新?/title><link>http://www.shnenglu.com/byc/archive/2011/08/18/153713.html</link><dc:creator>八叶?/dc:creator><author>八叶?/author><pubDate>Thu, 18 Aug 2011 03:16:00 GMT</pubDate><guid>http://www.shnenglu.com/byc/archive/2011/08/18/153713.html</guid><wfw:comment>http://www.shnenglu.com/byc/comments/153713.html</wfw:comment><comments>http://www.shnenglu.com/byc/archive/2011/08/18/153713.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/byc/comments/commentRss/153713.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/byc/services/trackbacks/153713.html</trackback:ping><description><![CDATA[ubuntu DVD讄本地更新?br />1 ~辑sources.list<br />执行Qsudo gedit /etc/apt/sources.list<br />备䆾之后全部删除写入如下一行!<br />deb "<a href="file:///media/Ubuntu">file:///media/Ubuntu</a> 11.04 i38" natty main restricted<br />3 更新一?br />执行Qsudo apt-get update<br /><img src ="http://www.shnenglu.com/byc/aggbug/153713.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/byc/" target="_blank">八叶?/a> 2011-08-18 11:16 <a href="http://www.shnenglu.com/byc/archive/2011/08/18/153713.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.85062.com.cn" target="_blank">ҹƷþþþþþþ</a>| <a href="http://www.dywanjiale.cn" target="_blank">ŷۺϾþþ</a>| <a href="http://www.xiaosp4.cn" target="_blank">seguiþùƷ</a>| <a href="http://www.fxmodels.com.cn" target="_blank">ƷžžþþƷŮͬŷպۺ </a>| <a href="http://www.spurr.cn" target="_blank">þþƷһ</a>| <a href="http://www.gdciecco.cn" target="_blank">þñۺϾþ</a>| <a href="http://www.dingbay.cn" target="_blank">һһþۺϺݺ</a>| <a href="http://www.tianyicpa.com.cn" target="_blank">þþƷɧ</a>| <a href="http://www.eaglehr.com.cn" target="_blank">ۿ ۺϾþþþùɫ ŷ һ </a>| <a href="http://www.ttprinting.cn" target="_blank">þþƷƷް</a>| <a href="http://www.onlinehotel.com.cn" target="_blank">þþþùƷ鶹ARӰԺ</a>| <a href="http://www.kzwn.net.cn" target="_blank">˾þۺϳ</a>| <a href="http://www.znhongsheng.com.cn" target="_blank">99þþƷֻоƷ</a>| <a href="http://www.ggjkb.cn" target="_blank">ۺպþóAV</a>| <a href="http://www.01pz.cn" target="_blank">þҹɫƷav</a>| <a href="http://www.wjjj8.cn" target="_blank">ھƷþ޻</a>| <a href="http://www.mutian100.cn" target="_blank">޾Ʒһۺ99þ </a>| <a href="http://www.pz851.cn" target="_blank">ȾþùþƷ</a>| <a href="http://www.ithaiyang.com.cn" target="_blank">99þþƷ⿴һ</a>| <a href="http://www.deografenny.com.cn" target="_blank">ѾƷþþþþĻ</a>| <a href="http://www.taotaoduoduo.cn" target="_blank">Ʒþþþþ</a>| <a href="http://www.cnnsmi.org.cn" target="_blank">ɫͷվþ</a>| <a href="http://www.51jintianfang.cn" target="_blank">Ʒþˬۺ </a>| <a href="http://www.linux123.cn" target="_blank">þĻһ</a>| <a href="http://www.xfqbaby.cn" target="_blank">þþŷղa</a>| <a href="http://www.rpsrbk.cn" target="_blank">69Ʒþþþùۿ</a>| <a href="http://www.00225858.cn" target="_blank">þùֻоƷ</a>| <a href="http://www.zghzmj.com.cn" target="_blank">þþþAV鶹</a>| <a href="http://www.265zz.cn" target="_blank">˾þþƷһ</a>| <a href="http://www.zhidaow.com.cn" target="_blank">ھƷþþþþþɬ</a>| <a href="http://www.uqtl.cn" target="_blank">ѹ99þþ㽶</a>| <a href="http://www.xmxfz.cn" target="_blank">һۺϾþ</a>| <a href="http://www.glhu.cn" target="_blank">91Ըߺþþþ</a>| <a href="http://www.xyszgh.cn" target="_blank">޳˾þ</a>| <a href="http://www.rc51.cn" target="_blank">ŷƷ˿þþĻ</a>| <a href="http://www.ldzx.sh.cn" target="_blank">Ʒ99þþƷ</a>| <a href="http://www.ip-domain.com.cn" target="_blank">99þһa</a>| <a href="http://www.arqing.cn" target="_blank">þ޸ۿ</a>| <a href="http://www.bayercas.cn" target="_blank">ھƷþþþþþɬ</a>| <a href="http://www.jm1818.cn" target="_blank">þþþ</a>| <a href="http://www.xlijz.cn" target="_blank">ƷһþþƷɬ </a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>