centos中安装FreeNX远程桌面的方法介绍

发布时间:2020-09-04编辑:脚本学堂
本文介绍下,在centos中安装FreeNX远程桌面的方法,有需要的朋友,参考下吧。

centos中安装FreeNX远程桌面,首先,要确保 sshd 服务启动并运行在 22 端口,然后检查 expect 和 nc 两个包是否安装,这是必须要估的。
如果以上均没有问题,那么就可以进入安装过程了。

yum方式安装:
yum install freenx
很简单,很快server端安装完成。
例子:

复制代码 代码示例:

[root@mail ~]# rpm -qa | grep freenx
[root@mail ~]# yum install freenx
Setting up Install Process
Setting up repositories
update                    100% |=========================|  951 B    00:00    
base                      100% |=========================| 1.1 kB    00:00    
addons                    100% |=========================|  951 B    00:00    
extras                    100% |=========================| 1.1 kB    00:01    
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for freenx to pack into transaction set.
freenx-0.7.3-2.el4.centos 100% |=========================|  14 kB    00:01    
---> Package freenx.i386 0:0.7.3-2.el4.centos set to be updated
--> Running transaction check
--> Processing Dependency: nx >= 2.0.0 for package: freenx
--> Processing Dependency: /usr/bin/expect for package: freenx
--> Processing Dependency: expect for package: freenx
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for expect to pack into transaction set.
expect-5.42.1-1.i386.rpm  100% |=========================|  13 kB    00:03    
---> Package expect.i386 0:5.42.1-1 set to be updated
---> Downloading header for nx to pack into transaction set.
nx-3.3.0-14.el4.centos.i3 100% |=========================|  18 kB    00:01    
---> Package nx.i386 0:3.3.0-14.el4.centos set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
freenx                  i386       0.7.3-2.el4.centos  extras             92 k
Installing for dependencies:
expect                  i386       5.42.1-1         base              148 k
nx                      i386       3.3.0-14.el4.centos  extras            2.7 M

Transaction Summary
================
Install      3 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        
Total download size: 2.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): expect-5.42.1-1.i3 100% |=========================| 148 kB    00:19    
(2/3): nx-3.3.0-14.el4.ce 100% |=========================| 2.7 MB    06:49    
(3/3): freenx-0.7.3-2.el4 100% |=========================|  92 kB    00:08    
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: nx                           ######################### [1/3]
Installing: expect                       ######################### [2/3]
Installing: freenx                       ######################### [3/3]
Stopping sshd:[  OK  ]
Starting sshd:[  OK  ]
Starting freenx-server:  [  OK  ]

Installed: freenx.i386 0:0.7.3-2.el4.centos
Dependency Installed: expect.i386 0:5.42.1-1 nx.i386 0:3.3.0-14.el4.centos
Complete!
[root@mail ~]# rpm -qa | grep freenx
freenx-0.7.3-2.el4.centos

然后:

复制代码 代码示例:

[root@mail ~]# /usr/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] ySetting up /etc/nxserver ...done
Setting up /var/lib/nxserver/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/bin. RDP sessions won't work.
Warning: Could not find nxviewer in /usr/bin. VNC sessions won't work.
Warning: Invalid value
"APPLICATION_LIBRARY_PRELOAD=/usr/lib/libX11.so.6.2:/usr/lib/libXext.so.6.4:/usr/lib/libXcomp.so.2:/usr/lib/libXcompext.so:/usr/lib/libXrender.so.1.2".
/usr/lib/libX11.so.6.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.
Error: Could not find 1.5.0 or 2.[01].0 or 3.[01].0 version string in nxagent. NX 1.5.0 or 2.[01].0 or 3.[012].0 backend is needed for this version of
FreeNX.

Warnings occured during config check.
To enable these features please correct the configuration file.

<---- done

----> Testing your nxserver connection ...
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
RSA key fingerprint is 17:e1:f2:33:b4:a1:f7:8d:1f:e3:5a:ba:f8:1d:90:3a.
Are you sure you want to continue connecting (yes/no)?
Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
HELLO NXSERVER - Version 3.2.0-73 OS (GPL, using backend: not detected)
NX> 105 quit
Quit
NX> 999 Bye
<--- done

Ok, nxserver is ready.

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 /etc/nxserver/node.conf file.
Have Fun!

添加ENABLE_PASSDB_AUTHENTICATION="1" 到 /etc/nxserver/node.conf。

复制代码 代码示例:

[root@mail ~]# nxserver --adduser kevin
NX> 100 NXSERVER - Version 3.2.0-73 OS (GPL, using backend: not detected)
NX> 1000 NXNODE - Version 3.2.0-73 OS (GPL, using backend: not detected)
NX> 716 Public key added to: /home/kevin/.ssh/authorized_keys2
NX> 1001 Bye.
NX> 999 Bye
[root@mail ~]# nxserver --passwd kevin
NX> 100 NXSERVER - Version 3.2.0-73 OS (GPL, using backend: not detected)
New password:
Password changed.
NX> 999 Bye
[root@mail ~]# nxsetup --install --setup-nomachine-key
Setting up /etc/nxserver ...done
Setting up /var/lib/nxserver/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/bin. RDP sessions won't work.
Warning: Could not find nxviewer in /usr/bin. VNC sessions won't work.
Warning: Invalid value
"APPLICATION_LIBRARY_PRELOAD=/usr/lib/libX11.so.6.2:/usr/lib/libXext.so.6.4:/usr/lib/libXcomp.so.2:/usr/lib/libXcompext.so:/usr/lib/libXrender.so.1.2".
/usr/lib/libX11.so.6.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.
Error: Could not find 1.5.0 or 2.[01].0 or 3.[01].0 version string in nxagent. NX 1.5.0 or 2.[01].0 or 3.[012].0 backend is needed for this version of
FreeNX.

Warnings occured during config check.
To enable these features please correct the configuration file.

<---- done

----> Testing your nxserver connection ...
HELLO NXSERVER - Version 3.2.0-73 OS (GPL, using backend: not detected)
NX> 105 quit
Quit
NX> 999 Bye
<--- done

Ok, nxserver is ready.

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 /etc/nxserver/node.conf file.
Have Fun!

启动、查看、停止nx命令

复制代码 代码示例:
# nxserver --start: 启动NX服务器
# nxserver --stop: 停止NX服务器
# nxserver --status: 查看NX服务器
# nxserver --restart: 重新启动NX服务器
# nxserver --help: 查看帮助信息 如果在使用 iptables防火墙,必需打开相应端口:
# iptables -A INPUT -i lo -s 127.0.0.1 -j ACCEPT #iptables -A INPUT -p tcp --dport 22 -j ACCEPT #iptables -A OUTPUT -p udp --sport 22 -j ACCEPT
# iptables -A INPUT -p tcp --dport 5000 -j ACCEPT #iptables -A OUTPUT -p udp --sport 5000 -j ACCEPT

说明:NxFree服务器完全依赖于SSH进行工作,请先确保linux服务器的Openssh配置无误。

如果按以上操作后还是无法使用,提示:
the nx service is not available or the nx access was disabled on host  xxx.xxx.xxx.xxx

可以参照如下的解决方法:
在 NX server上把 /var/lib/nxserver/home/.ssh/client.id_dsa.key 文件拷贝到客户端后,用 NX 客户端工具导入。
这样就可以正常运行了。good luck。