月度归档:2011年01月

xwindows远程连接centos

http://www.netsarang.com/products/xmg_faq.html#a-1

其实就是官方的faq文档:

For XDMCP connection to Red Hat 7, Red Hat 8, Red Hat 9, Red Hat 3.0 AS
1. XDM Configuration
1. Change runlevel to 5

Open/etc/inittab and set the initial runlevel to 5 as following:
id:5:initdefault:

 

2. Enable XDMCP 
   For GDM:
 
Open /etc/X11/gdm/gdm.conf and set the Enable entry to 1 in the [xdmcp] section as following.
[xdmcp]
Enable=1

 

   For KDM:
 
Open /etc/X11/xdm/xdm-config comment out the “requestPort” option as following:
DisplayManager.requestPort: 0 ==>
!DisplayManager.requestPort: 0
Open /etc/X11/xdm/Xaccess and remove the initial “#” character for the following line:
#* #any host can get a login window ==>
* #any host can get a login window
Open /etc/kde/kdm/kdmrc and set the Enable entry to true in the [xdmcp] section as following.
[xdmcp]
Enable=true

 

2. Firewall (TCP/UDP Ports) Configuration
Open UDP port 177 from the PC to the remote host direction.
Open incoming TCP ports 6000~6010 from the remote host to your PC.
3. Reboot the remote host and start Xmanager
# init 3; init 5
For XDMCP connection to Red Hat 5 EL
1. XDM Configuration
1. Change runlevel to 5

Open/etc/inittab and set the initial runlevel to 5 as following:
id:5:initdefault:

 

2. Enable XDMCP 
   For GDM:
 
Open /etc/gdm/custom.conf and set the Enable entry to 1 in the [xdmcp] section as following.
[xdmcp]
Enable=1

 

   For KDM:
 
Open /usr/share/config/kdm/Xaccess and remove the initial “#” character for the following line:
#* #any host can get a login window ==>
* #any host can get a login window
Open /usr/share/config/kdm/kdmrc and set the Enable entry to true in the [xdmcp] section as following.
[xdmcp]
Enable=true

 

2. Firewall (TCP/UDP Ports) Configuration
Open UDP port 177 from the PC to the remote host direction.
Open incoming TCP ports 6000~6010 from the remote host to your PC.
3. Reboot the remote host and start Xmanager
# init 3; init 5
For XDMCP connection to Red Hat 4 EL
1. XDM Configuration
1. Change runlevel to 5

Open/etc/inittab and set the initial runlevel to 5 as following:
id:5:initdefault:

 

2. Enable XDMCP 
   For GDM:
 
Open /etc/X11/gdm/gdm.conf set the Enable entry to true in the [xdmcp] section as following.
[xdmcp]
Enable=true

 

   For KDM:
 
Open /usr/share/config/kdm/Xaccess and remove the initial “#” character for the following line:
#* #any host can get a login window ==>
* #any host can get a login window
Open /usr/share/config/kdm/kdmrc and set the Enable entry to true in the [xdmcp] section as following.
[xdmcp]
Enable=true

 

2. Firewall (TCP/UDP Ports) Configuration
Open UDP port 177 from the PC to the remote host direction.
Open incoming TCP ports 6000~6010 from the remote host to your PC.
3. Reboot the remote host and start Xmanager
# init 3; init 5

没看明白的给我留言,我来翻译。呵呵。

ssh自动断开的问题

高版本的Linux自带的OpenSSH在使用的时候,几分钟不操作的话就会自动断开连接,这是出于安全的考虑,但是对于需要长时间使用的用户来说很麻烦,每次都要重新连接。解决方法如下:

将/etc/ssh/sshd_config中的“ClientAliveInterval”设置取消注释,并把0改为一个较小的数值即可。具体说明参看下面的解释:

OpenSSH ClientAliveInterval

Using an OpenSSH server’s ClientAliveInterval, it is possible for the ssh server to send periodic “keep alive” messages to the ssh client, keeping the connection open indefinitely. This is useful when a firewall or other packet filtering device drops idle connections after a certain period of time. Note that this is different from the KeepAlive directive in ssh_config.

From the sshd_config manpage:

     ClientAliveInterval
             Sets a timeout interval in seconds after which if no data has
             been received from the client, sshd will send a message through
             the encrypted channel to request a response from the client.  The
             default is 0, indicating that these messages will not be sent to
             the client.  This option applies to protocol version 2 only.

Example (send “keep alive” messages every 5 minutes) on Red Hat Linux:

1. Add ClientAliveInterval 300 to /etc/ssh/sshd_config

2. Reload the sshd server configuration with /sbin/service sshd reload

Note: you may want to configure the ClientAliveCountMax value in sshd_config to set the number of times that “keep alive” messages are sent. If ClientAliveCountMax number of “keep alive” messages are not acknowledged by the ssh client, the connection is terminated by the ssh server. The default value of 3 should be sufficient for most users.

OpenVPN persist-tun 配置项问题

OpenVPN persist-tun 配置项问题

之前有一个用户抱怨说OpenVPN 不稳定,不定时的断,而且断了之后还不能自动重新连上。 经过调试发现是客户端配置文件中的persist-tun 配置项的问题。 OpenVPN 手册中的说明如下

--persist-tun
Don’t close and reopen TUN/TAP device or run up/down scripts across SIGUSR1 or --ping-restart restarts.

SIGUSR1 is a restart signal similar to SIGHUP, but which offers finer-grained control over reset options.

Windows 下面的客户端如果指定了这个配置项,会导致断线之后 (比如承载OpenVPN 的实际网络比如Wifi或者PPPoE断线)。
断线之后服务器端在一段时候内没有收到客户端的Keep-Alive 包, 认为客户端断线,中断连线。
当网络恢复的时候,客户端发现服务器端没有响应了(因为服务器关闭连接了), 重启自己的进程。 当有 persist-tun 选项时,它会重用之前的TUN/TAP 设备, 但是很奇怪它没有取重新认证,然后就一直卡在哪里,托盘图标一直时黄色的。 将persisit-tun 选项去掉之后,就能马上自动连上了。

mysql5.5.8源码安装,使用cmake,真不习惯。

mysql5.5.8源码编译安装

wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
tar -zxvf cmake-2.8.3.tar.gz
cd cmake
./configure
make
make install

mysql5.5.8源代码编译安装的选项
cmake程序提供了一个强大的配置mysql源代码的方法,典型的,你应该在cmake的命令行使用下面的选项
,cmake支持下面的选项信息,应该在mysql的源代码的顶级目录使用这些选项。
[root@localhost mysql-5.5.8]# cmake . -LH
[root@localhost mysql-5.5.8]# cmake .
你可以影响cmake的某些环境变量
下面是一些cmake的一些有用的选项。
CMAKE_INSTALL_PREFIX mysql的安装路径,默认为/usr/local/mysql5.5.8
DEFAULT_CHARSET 默认的服务器编码,设置latin1, 5.5.7
DEFAULT_COLLATION 也是关于编码的
MYSQL_DATADIR data目录
MYSQL_TCP_PORT TCP/IP端口,3306
MYSQL_UNIX_ADDR unix的socket文件,默认/tmp/mysql.sock
WITH_xxx_STORAGE_ENGINE 编译静态的存储引擎xxx
WITHOUT_xxx_STORAGE_ENGINE Exclude storage engine xxx from build
WITH_EXTRA_CHARSETS 扩展字符集
WIHT_ZLIB zlib支持
我的编译参数:
[root@localhost mysql-5.5.8]# cmake -DCMAKE_INSTALL_PREFIX=/home/system/mysql -DDEFAULT_CHARSET=utf8 -DMYSQL_DATADIR=/home/db -DMYSQL_UNIX_ADDR=/tmp/mysql.sock .

# cmake -DMYSQL_DATADIR=/home/data
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all
-DMYSQL_UNIX_ADDR=/base/MySQL/socket
-DMYSQL_TCP_PORT=3306
-DMYSQL_USER=mysql
-DCMAKE_INSTALL_PREFIX=/base/MySQL
-DINSTALL_SBINDIR=bin

CMake参数对照关系
–localstatedir=/base/MySQL/data     =========>   -DMYSQL_DATADIR=/base/MySQL/data
–with-charset=utf8    ====================>   -DDEFAULT_CHARSET=utf8
–with-collation=utf8_general_ci     ===========>   -DDEFAULT_COLLATION=utf8_general_ci
–with-extra-charsets=all      ================>   -DEXTRA_CHARSETS=all
–with-unix-socket-path=/base/MySQL/socket    ==>    -DMYSQL_UNIX_ADDR=/base/MySQL/socket
–with-tcp-port=3306      ==================>     -DMYSQL_TCP_PORT=3306
–with-mysqld-user=mysql    ===============>     -DMYSQL_USER=mysql
–prefix=/usr    ========================>     -DCMAKE_INSTALL_PREFIX=/base/MySQL
–sbindir=EPREFIX/sbin     ================>     -DINSTALL_SBINDIR=bin

    鸡鸡哥
    QQ:21428749
    https://www.hardwork.cn