[LINUX] [CentOS 7.7] From desktop environment installation to remote desktop connection possible (from minimum installation)

Introduction

I had the opportunity to set up a RDP connection for business from Windows to the GUI environment of CentOS. This time, I would like to leave this as knowledge.

environment

Terminal: Windows 10 Pro OS: CentOS7.7

[root@tspshell01 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
[root@tspshell01 ~]#

OS installation with "minimal installation"

Prerequisites

--The following settings have been completed **-Host name / IP address setting ** ** ・ DNS settings **

--The initial state is directly under "/etc/yum.repos.d"

[root@tspshell01 ~]# ll /etc/yum.repos.d/
32 in total
-rw-r--r--.1 root root 1664 September 5 2019 CentOS-Base.repo
-rw-r--r--.1 root root 1309 September 5 2019 CentOS-CR.repo
-rw-r--r--.1 root root 649 September 5 2019 CentOS-Debuginfo.repo
-rw-r--r--.1 root root 630 September 5 2019 CentOS-Media.repo
-rw-r--r--.1 root root 1331 September 5 2019 CentOS-Sources.repo
-rw-r--r--.1 root root 6639 September 5 2019 CentOS-Vault.repo
-rw-r--r--.1 root root 314 September 5 2019 CentOS-fasttrack.repo
[root@tspshell01 ~]#

--You must be able to connect to the Internet

procedure

Click here for the procedure.

** ① Disable the firewall (or open the port) ** ** ② Read repository file ** ** ③ Install GNOME desktop ** ** ④ Install epel repository ** ** ⑤ Install required packages for remote desktop ** ** ⑥ Operation check **

Then, I will explain.

① Disable the firewall (or open the port)

--Firewall disabled / auto-start disabled

・ Firewall stop
systemctl status firewalld
systemctl stop firewalld
systemctl status firewalld

-Disable firewall
systemctl is-enabled firewalld
systemctl disable firewalld
systemctl is-enabled firewalld

--3389 Port open (when firewall is not stopped)

firewall-cmd --permanent --zone=public --add-port=3389/tcp
firewall-cmd --reload
firewall-cmd --list-all

② Read repository file

--Clear yum cache

yum clean all

--Reading the file directly under "/etc/yum.repos.d"

yum repolist all

→ Confirm that "base / 7 / x86_64" is valid

③ Install GNOME desktop

yum groupinstall "GNOME Desktop"

** * You will be asked "yes" or "no" just before installation, so execute "y" **

④ Install epel repository

The "epel repository" is used to install "xrdp".

--Install the epel repository directly under "/etc/yum.repos.d"

yum install epel

--Confirm that "epel.repo" is directly under "/etc/yum.repos.d"

[root@tspshell01 yum.repos.d]# ll /etc/yum.repos.d/
36 in total
-rw-r--r--.1 root root 1664 September 5 2019 CentOS-Base.repo
-rw-r--r--.1 root root 649 September 5 2019 CentOS-Debuginfo.repo
-rw-r--r--.1 root root 630 September 5 2019 CentOS-Media.repo
-rw-r--r--.1 root root 1331 September 5 2019 CentOS-Sources.repo
-rw-r--r--.1 root root 6639 September 5 2019 CentOS-Vault.repo
-rw-r--r--.1 root root 314 September 5 2019 CentOS-fasttrack.repo
-rw-r--r--1 root root 1050 October 3 2017 epel-testing.repo
-rw-r--r--1 root root 951 October 3 2017 epel.repo
[root@tspshell01 yum.repos.d]#

--Clear yum cache

yum clean all

--Reading the file directly under "/etc/yum.repos.d"

yum repolist all

⑤ Install required packages for remote desktop

--Package installation

yum install tigervnc-server
yum install xrdp

--xrdp service start / automatic start

・ Start xrdp service
systemctl status xrdp
systemctl start xrdp
systemctl status xrdp
・ Xrdp automatic start
systemctl is-enabled xrdp
systemctl enable xrdp
systemctl is-enabled xrdp

⑥ Operation check

--After starting Remote Desktop, enter the IP address and connect (Can be started with "mstsc")

7.JPG

--If the connection is successful, the login screen will be displayed. Enter server username / password

8.JPG

--If you log in successfully, you will see a screen like this. 9.JPG

If you can't remote desktop (or can't log in)

--Session change --Screen color depth setting

Change session

「Xvnc」→「Xorg」

--Configuration file backup

cp -p /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini_`date "+%Y%m%d_%H%M%S"`

--Check file backup

[root@tspshell01 yum.repos.d]# ll /etc/xrdp | grep xrdp
-rw-r--r--1 root root 5427 March 11 19:53 xrdp.ini
-rw-r--r--1 root root 5427 March 11 19:53 xrdp.ini_20200518_223104
-rw-r--r--1 root root 3570 March 11 19:53 xrdp_keyboard.ini
[root@tspshell01 yum.repos.d]#

--File content change

vi /etc/xrdp/xrdp.ini

Before correction

#[Xorg]
#name=Xorg
#lib=libxup.so
#username=ask
#password=ask
#ip=127.0.0.1
#port=-1
#code=20

[Xvnc]
name=Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1
#xserverbpp=24
#delay_ms=2000

Revised

[Xorg]
name=Xorg
lib=libxup.so
username=ask
password=ask
ip=127.0.0.1
port=-1
code=20

#[Xvnc]
#name=Xvnc
#lib=libvnc.so
#username=ask
#password=ask
#ip=127.0.0.1
#port=-1
#xserverbpp=24
#delay_ms=2000

→ Setting to display only "Xorg" on the login screen

--Compare with backup file

diff /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini_20200518_223104

Execution result

[root@tspshell01 yum.repos.d]# diff /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini_20200518_223104
181,192c181,183
< [Xorg]
< name=Xorg
< lib=libxup.so
< username=ask
< password=ask
< ip=127.0.0.1
< port=-1
< code=20
<
< #[Xvnc]
< #name=Xvnc
< #lib=libvnc.so
---
> #[Xorg]
> #name=Xorg
> #lib=libxup.so
196a188,196
> #code=20
>
> [Xvnc]
> name=Xvnc
> lib=libvnc.so
> username=ask
> password=ask
> ip=127.0.0.1
> port=-1
[root@tspshell01 yum.repos.d]#

→ There is a difference only in the edited part

--Restart the "xrdp" service

systemctl status xrdp
systemctl restart xrdp
systemctl status xrdp

--Remote desktop implementation

Confirm that you can connect (session has been changed to "Xorg")

10.JPG

Screen color depth setting

-Configuration file backup

cp -p /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini_`date "+%Y%m%d_%H%M%S"`

--File backup confirmation

[root@tspshell01 yum.repos.d]# ll /etc/xrdp | grep xrdp
-rw-r--r--1 root root 5426 May 18 22:37 xrdp.ini
-rw-r--r--1 root root 5427 March 11 19:53 xrdp.ini_20200518_223104
-rw-r--r--1 root root 5426 May 18 22:37 xrdp.ini_20200518_224629
-rw-r--r--1 root root 5426 May 18 22:37 xrdp.ini_20200518_224633
-rw-r--r--1 root root 3570 March 11 19:53 xrdp_keyboard.ini
[root@tspshell01 yum.repos.d]#

--Change configuration file

vi /etc/xrdp/xrdp.ini

Before correction

max_bpp=32

Revised

max_bpp=24

--Compare with backup file

[root@tspshell01 yum.repos.d]# diff /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini_202005
18_224633
73c73
< max_bpp=24
---
> max_bpp=32
[root@tspshell01 yum.repos.d]#

→ There is a difference only in the edited part

--Restart the "xrdp" service

systemctl status xrdp
systemctl restart xrdp
systemctl status xrdp

--Remote desktop implementation

Confirm that you can connect

9.JPG

Reference page

Install xrdp on CentOS7 and connect with remote desktop from Windows https://qiita.com/shinoere/items/35793d9c6155145cb37c

xrdp https://qiita.com/n-yamanaka/items/653af5cdac63721ff074

Twitter I mainly mutter about career hacks of infrastructure engineers. ** ** https://twitter.com/satton6987

Recommended Posts

[CentOS 7.7] From desktop environment installation to remote desktop connection possible (from minimum installation)
Python development environment construction 2020 [From Python installation to poetry introduction]
[Linux Mint 20] Remote desktop connection / connection
Switch from python2.7 to python3.6 (centos7)
Connect to centos6 on virtualbox with ssh connection from Mac
How to debug Dash (Flask) in Docker + VSCode + remote connection environment
From Elasticsearch installation to data entry
OpenMPI installation from download to pass-through
From Ubuntu 20.04 introduction to environment construction
Connect to Packetix VPN from CentOS 7 minimal.
[Note] [PyTorch] From installation to easy usage
Connecting from python to MySQL on CentOS 6.4
Connect to GNU / Linux with Remote Desktop
Flask tutorial (from installation to hello world)
Introduction to Scapy ① (From installation to execution of Scapy)