器量大者,福泽必厚
全部博文(587)
分类:
2009-12-13 12:57:52
1:freenx需要用到expect和nx (其他的我们安装时应该默认都安装上了),
查询需要的软件是否存在:
[root@qht124 ~]# rpm -qa | grep expect
expect-5.42.1-1
如果expect不存在, 则需要安装tcl和tk软件, 应先安装tcl, 因为tk需要用到tcl。最好用系统盘自带的rpm包来安装。因为我下载的是二进制的freenx(解压就可以用的)。它会去默认的位置找自己需要的库的!(所以最好使用rpm或用源代码安装不要指定--prefix)
如果用源代码安装:安装过程中遇到的问题有:
安装expect出错:
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking whether the compiler (gcc) actually works... yes
checking how to run the C preprocessor... gcc -E
checking if running LynxOS... no
checking for Tcl private headers... checking for tclInt.h... no
configure: error: Can't find Tcl private headers
configure: error: /bin/sh './configure' failed for testsuite
[root@qht124 expect-
解决方法:
./configure --with-tcl=/usr/local/tcl/lib --with-tclinclude=/usr/local/tcl/include/ --with-tk=/usr/local/tk/lib --with-tkinclude=/usr/local/tk/include/ --prefix=/usr/local/expect
如果没有红色字体部分就会出上面的错误!
2: 我的nx软件没有安装, 可以通过
[root@qht124 ~]# rpm -qa | grep nx来确定nx是否已经安装(没有输出,表示没安装)
需要去网上下载, 我下载的如下,注意下载下和你的rhel的版本对应。否则rpm很难装上。
安装过程如下:
[root@qht124 ~]# cd nx/
[root@qht124 nx]# ls
nxclient-
[root@qht124 nx]# rpm -ivh nxnode-
error: Failed dependencies:
nxclient >=
[root@qht124 nx]# rpm -ivh nxclient-
Preparing... ########################################### [100%]
1:nxclient ########################################### [100%]
[root@qht124 nx]# rpm -ivh nxnode-
Preparing... ########################################### [100%]
1:nxnode ########################################### [100%]
^[[A^[[ANX> 700 Starting: install node operation at: Sat Dec 12 21:01:42 2009.
NX> 700 Autodetected system 'redhat'.
NX> 700 Install log is '/usr/NX/var/log/install'.
NX> 700 Creating configuration in /usr/NX/etc/node.cfg.
NX> 700 Inspecting local CUPS environment.
NX> 700 Generating CUPS entries in: /usr/NX/etc/node.cfg.
NX> 700 Installation of version:
NX> 700 Bye.
userdel: error removing directory /usr/local/NX4U/home/nx
[root@qht124 nx]# rpm -ivh nxserver-
Preparing... ########################################### [100%]
1:nxserver ########################################### [100%]
NX> 700 Installing: server at: Sat Dec 12 21:02:21 2009.
NX> 700 Autodetected system: redhat.
NX> 700 Install log is: /usr/NX/var/log/install.
NX> 700 Creating configuration file: /usr/NX/etc/server.cfg.
NX> 723 Cannot start NX statistics:
NX> 709 NX statistics are disabled for this server.
NX> 700 Version '
NX> 700 Showing file: /usr/NX/share/documents/server/install-notices
Server keys
NX> 700 Bye.
###红色字体部分为需要下载的软件, 这三个软件间有一种依赖关系!注意安装顺序。
3:安装freenx,我下载是二进制文件!只需要解压即可
[root@qht124 home]# cd freenx/
[root@qht124 freenx]# ls
expect-
[root@qht124 freenx]# pwd
/home/freenx
[root@qht124 freenx]# tar zxvf NX4U.tar.gz -C /usr/local/
##将freenx安装到/usr/local目录下
4:配置路径, 把/usr/local/NX4U/bin放到$PATH中去 ,需要vi ~/.bashrc,编辑后的内容如下,
[root@qht124 ~]# cat ~/.bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export PATH=$PATH:/usr/local/NX4U/bin
##红色字体为添加的部分
5:安装配置nxserver
nxsetup –install
信息如下:
[root@qht124 etc]# nxsetup --install
------> It is recommended that you use the NoMachine key for
easier setup. If you answer "y", FreeNX creates a custom
KeyPair and expects you to setup your clients manually.
"N" is default and uses the NoMachine key for installation.
Do you want to use your own custom KeyPair? [y/N] nSetting up /usr/local/NX4U/etc ...done
Setting up /usr/local/NX4U/var/db ...done
Setting up /var/log/nxserver.log ...done
Adding user "nx" to group "utmp" ...done
Setting up known_hosts and authorized_keys2 ...done
Setting up permissions ...done
Setting up cups nxipp backend ...done
----> Testing your nxserver configuration ...
Warning: Could not find nxdesktop in /usr/local/NX4U/bin. RDP sessions won't work.
Warning: Could not find nxviewer in /usr/local/NX4U/bin. VNC sessions won't work.
Warning: Invalid value "APPLICATION_LIBRARY_PRELOAD=/usr/local/NX4U/lib/libX11.so.6.2:/usr/local/NX4U/lib/libXext.so.6.4:/usr/local/NX4U/lib/libXcomp.so:/usr/local/NX4U/lib/libXcompext.so:/usr/local/NX4U/lib/libXrender.so.1.2". /usr/local/NX4U/lib/libXrender.so.1.2 could not be found. Users will not be able to run a single application in non-rootless mode.
Warning: Invalid value "COMMAND_START_CDE=cdwm"
Users will not be able to request a CDE session.
Warning: Invalid cupsd version of "/usr/sbin/cupsd". Need version 1.2.
Users will not be able to enable printing.
Warnings occured during config check.
To enable these features please correct the configuration file.
<---- done
----> Testing your nxserver connection ...
expect: spawn id exp4 not open
while executing
"expect -nobrace {Are you sure you want to continue connecting (yes/no)?} { send "yes\r" } {Permission denied*} { exit 1 } {HELLO NXSERVER - Version*} ..."
invoked from within
"expect {
"Are you sure you want to continue connecting (yes/no)?" { send "yes\r" }
"Permission denied*" { exit 1 }
"HELLO NXSERVER - Version*..."
invoked from within
"if { "$auth_method"=="test-nx" } {
set stty_init "raw icrnl -echo"
set publickey ""
catch {set publickey $env(NODE_PUBLICKEY)}
set pid [spawn -..."
(file "/usr/local/NX4U/bin/nxnode-login" line 30)
/usr/local/NX4U/bin/nxserver: line 691: /usr/local/NX4U/bin/nxserver-helper: cannot execute binary file
/usr/local/NX4U/bin/nxserver: line 691: /usr/local/NX4U/bin/nxserver-helper: Success
Fatal error: Could not connect to NX Server.
Please check your ssh setup:
The following are _examples_ of what you might need to check.
- Make sure "nx" is one of the AllowUsers in sshd_config.
(or that the line is outcommented/not there)
- Make sure "nx" is one of the AllowGroups in sshd_config.
(or that the line is outcommented/not there)
- Make sure your sshd allows public key authentication.
- Make sure your sshd is really running on port 22.
- Make sure your sshd_config AuthorizedKeysFile in sshd_config is set to authorized_keys2.
(this should be a filename not a pathname+filename)
- Make sure you allow ssh on localhost, this could come from some
restriction of:
-the tcp wrapper. Then add in /etc/hosts.allow: ALL:localhost
-the iptables. add to it:
$ iptables -A INPUT -i lo -j ACCEPT
$ iptables -A OUTPUT -o lo -j ACCEPT
安装好nx后,运行结果如下:
[root@qht124 etc]# /usr/local/NX4U/bin/nxsetup --install
------> It is recommended that you use the NoMachine key for
easier setup. If you answer "y", FreeNX creates a custom
KeyPair and expects you to setup your clients manually.
"N" is default and uses the NoMachine key for installation.
Do you want to use your own custom KeyPair? [y/N] nSetting up /usr/local/NX4U/etc ...done
Generating public/private dsa key pair.
Your identification has been saved in /usr/local/NX4U/etc/users.id_dsa.
Your public key has been saved in /usr/local/NX4U/etc/users.id_dsa.pub.
The key fingerprint is:
ef:c0:7b:97:36:77:0d:e9:a1:d5:b3:01:ca:65:49:33 root@qht124
Setting up /usr/local/NX4U/var/db ...done
Setting up /var/log/nxserver.log ...done
Adding user "nx" to group "utmp" ...done
Setting up known_hosts and authorized_keys2 ...done
Setting up permissions ...done
Setting up cups nxipp backend ...done
----> Testing your nxserver configuration ...
Warning: Could not find nxdesktop in /usr/local/NX4U/bin. RDP sessions won't work.
Warning: Could not find nxviewer in /usr/local/NX4U/bin. VNC sessions won't work.
Warning: Invalid value "APPLICATION_LIBRARY_PRELOAD=/usr/local/NX4U/lib/libX11.so.6.2:/usr/local/NX4U/lib/libXext.so.6.4:/usr/local/NX4U/lib/libXcomp.so:/usr/local/NX4U/lib/libXcompext.so:/usr/local/NX4U/lib/libXrender.so.1.2". /usr/local/NX4U/lib/libXrender.so.1.2 could not be found. Users will not be able to run a single application in non-rootless mode.
Warning: Invalid value "COMMAND_START_CDE=cdwm"
Users will not be able to request a CDE session.
Warning: Invalid cupsd version of "/usr/sbin/cupsd". Need version 1.2.
Users will not be able to enable printing.
Warnings occured during config check.
To enable these features please correct the configuration file.
<---- done
----> Testing your nxserver connection ...
HELLO NXSERVER - Version
Warning: Version mismatch. Expected
NX> 105 Quit
NX> 999 Bye.
<--- done
Ok, nxserver is ready. ###表示nxserver一切正常了。
PAM authentication enabled:
All users will be able to login with their normal passwords.
PAM authentication will be done through SSH.
Please ensure that SSHD on localhost accepts password authentication.
You can change this behaviour in the /usr/local/NX4U/etc/node.conf file.
Have Fun!
6:添加一个用户:
[root@qht124 NX4U]# cd /usr/local/NX4U/etc/
[root@qht124 etc]# ls
node.conf.sample passwords passwords.orig users.id_dsa users.id_dsa.pub
[root@qht124 etc]# mv node.conf.sample node.conf
[root@qht124 etc]# vi node.conf
将#ENABLE_PASSDB_AUTHENTICATION="0的注释去掉,并修改为,"ENABLE_PASSDB_AUTHENTICATION="1"
[root@qht124 etc]# nxserver --adduser xliu
NX> 100 NXSERVER - Version
NX> 1000 NXNODE - Version
NX> 716 Public key added to: /home/xliu/.ssh/authorized_keys2
NX> 1001 Bye.
NX> 999 Bye
[root@qht124 etc]# nxserver --passwd xliu
NX> 100 NXSERVER - Version
New password:
Password changed.
NX> 999 Bye
##到此为止xliu已经添加进去了(xliu必须为已经存在的系统用户!)
7:运行/usr/local/NX4U/bin/nxkengen 以生成密钥 ,密钥默认会在/usr/local/NX4U/home/nx/.ssh下,如下所示:
[root@qht124 ~]# cd /usr/local/NX4U/home/nx/.ssh/
[root@qht124 .ssh]# ls
authorized_keys2 client.id_dsa.key server.id_dsa.pub.key
[root@qht124 .ssh]#
8:我们需要把client.id_dsa.key 放到freenx client端。
我的freenx client(软件名为nxclient,注意:最好nxclient和freenx版本相同)安装在windows下:
显然我是用ssh secure shell client将linux下生成的client.id_dsa.key (具体位置见上面!)放到了nxclient安装目录下的share/keys目录下(见上图!)
还需要将client.id_dsa.key 导入(导入见下图!)。否则会连接不通freenx!
NX> 203 NXSSH running with pid: 3040
NX> 285 Enabling check on switch command
NX> 285 Enabling skip of SSH config files
NX> 285 Setting the preferred NX options
NX> 200 Connected to address: 192.168.1.124 on port: 22
NX> 202 Authenticating user: nx
NX> 208 Using auth method: publickey
NX> 204 Authentication failed.