Install xrdp on RHEL 7 时遇到的问题

xrdp 是一个开源远程桌面协议服务器,它允许我们从 Windows 计算机到 Linux 服务器进行 RDP;它能够接受来自 rdesktop、freerdp 和远程桌面客户端的连接。

1.安装Redhat扩展更新源,软件为epel-relase

rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm

2.接着安装nux-dextop

rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm

3.想要安装xrdp,就要新建一个安装源

[root@localhost ~]# vi /etc/yum.repos.d/xrdp.repo
[root@localhost ~]# tail /etc/yum.repos.d/xrdp.repo
[xrdp]
name=xrdp
baseurl=http://li.nux.ro/download/nux/dextop/el7/x86_64/
enabled=1
gpgcheck=0
  • 遇到的问题1:新建本地安装源后执行yum makecache时报错

[root@localhost yum.repos.d]# yum makecache
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Existing lock /var/run/yum.pid: another copy is running as pid 18858.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  34 M RSS (565 MB VSZ)
    Started: Thu Nov  7 21:02:23 2019 - 13:22 ago
    State  : Sleeping, pid: 18858

——报错显示yum在锁定状态中。 /var/run/yum.pid打开看了,只是一个数,也可能是系统自动升级正在运行,所以yum被锁定了。


less /var/run/yum.pid

——问题1解决方法·:强行关掉yum进程

m -rf 18858
rm -rf /var/run/yum.pid
  • 再次yum makecache又出现了问题2:报错显示没有挂载光驱

[root@localhost run]# yum makecache
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Existing lock /var/run/yum.pid: another copy is running as pid 19578.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  42 M RSS (498 MB VSZ)
    Started: Thu Nov  7 21:31:57 2019 - 00:08 ago
    State  : Sleeping, pid: 19578
epel/x86_64/metalink                                                                                                         | 4.8 kB  00:00:00
file:///media/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /media/repodata/repomd.xml"
Trying other mirror.


 One of the configured repositories failed (local),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=local ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable local
        or
            subscription-manager repos --disable=local

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=local.skip_if_unavailable=true

failure: repodata/repomd.xml from local: [Errno 256] No more mirrors to try.
file:///media/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /media/repodata/repomd.xml"

——问题2解决方法·:配置本地yum文件,重新挂载

[root@localhost etc]# cd yum.repos.d/
[root@localhost yum.repos.d]# ls
epel.repo  epel-testing.repo  local.repo  nux-dextop.repo  packagekit-media.repo  redhat.repo  xrdp.repo
[root@localhost yum.repos.d]# vi local.repo
[root@localhost yum.repos.d]# mount /dev/cdrom /media
mount: /dev/sr0 is write-protected, mounting read-only

4.执行yum makecache,就是把服务器的包信息下载到本地电脑缓存起来

yum makecache

5.安装xrdp成功

[root@localhost yum.repos.d]# yum install xrdp
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package xrdp.x86_64 1:0.9.11-5.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================
 Package                         Arch                              Version                                    Repository                       Size
====================================================================================================================================================
Installing:
 xrdp                            x86_64                            1:0.9.11-5.el7                             epel                            426 k

Transaction Summary
====================================================================================================================================================
Install  1 Package

Total download size: 426 k
Installed size: 2.1 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/epel/packages/xrdp-0.9.11-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY:00:00 ETA
Public key for xrdp-0.9.11-5.el7.x86_64.rpm is not installed
xrdp-0.9.11-5.el7.x86_64.rpm                                                                                                 | 426 kB  00:00:26
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) "
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-12.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : 1:xrdp-0.9.11-5.el7.x86_64                                                                                                       1/1
  Verifying  : 1:xrdp-0.9.11-5.el7.x86_64                                                                                                       1/1

Installed:
  xrdp.x86_64 1:0.9.11-5.el7

Complete!

6.把端口3389加入到防火墙规则

这一步在图形界面下操作容易一些


3389

修改配置后,需要用systemctl重启一下firewalld服务

systemctl stop firewalld
systemctl start firewalld

7.启动xrdp服务,可以在Windows上远程登录到虚拟机了

[root@localhost ~]# systemctl enable xrdp.service
Created symlink from /etc/systemd/system/multi-user.target.wants/xrdp.service to /usr/lib/systemd/system/xrdp.service.
[root@localhost ~]# systemctl start xrdp
[root@localhost ~]# 

在windows运行中输入mstsc


mstsc

输入用户名和密码就可以登入


登录界面

完成

你可能感兴趣的:(Install xrdp on RHEL 7 时遇到的问题)