How to install Centos-6. 5 Desktop with Xrdp in Amazon AWS

Today I came across a very simple but good for writing task. My Manager asked me to create a instance of  «CentOS Desktop Version 6. 5». So I searched for it After a long search I found that there are no CentOS Desktop Ami in Amazon Repository, So I searched in Community Amis «I as stunt to see that Free CentOS Iso are being sold «Cost per hr 0. 08$»  What the Crap!!!  As being a linux Bornhead I took a different way around.

This blog is about how we ll install and create desktop version of CentOS Ami with no GUI Installed.

Perquisites:
Create and install «ami-0396cd69» Centos 6. 5 with at least 4gm ram which ll be t2. medium.
Open port 3389, 22 will be by default.
Now after you have installed Centos 6. 5, Login to the machine using ssh or putty (windows). Lets begin installation of Desktop.
NOTE:  Desktop Environment is not necessary for Server usage But Sometimes installation or using an application requires Desktop Environment can come handy for testing software or app building.

Step 1: Install GNOME Desktop Environment.
[[email protected] ~]# yum –y update
[[email protected] ~]# yum -y groupinstall”X Window System”
[[email protected] ~]# yum -y groupinstall”Desktop”
[[email protected] ~]# yum -y groupinstall”General Purpose Desktop”
[ root @ linuxgeekstuffs ~ ] # yum –y update
[ root @ linuxgeekstuffs ~ ] # yum -y groupinstall”X Window System”
[ root @ linuxgeekstuffs ~ ] # yum -y groupinstall”Desktop”
[ root @ linuxgeekstuffs ~ ] # yum -y groupinstall”General Purpose Desktop”

That is its done now you machine is ready to server with Desktop version of Centos for free just getting changed of instance not OS.
Now you might be thinking how we will take Remote Session as its not possible with CLi or SSH session, So we ll install xrdp and vnc server just for that…

What is XRDP?
xrdp  is an Open Source Remote desktop Protocol server, which allows you to take Remote Desktop Session to your Centos or and linux server from any machine using Microsoft Remote Desktop or CoRD. it is capable of accepting connections from rdesktop, freerdp, and remote desktop clients.

Step 2: Install Xrdp and vncserver for taking remote Desktop Session.
[[email protected] ~]# rpm –Uvh
[[email protected] ~]# yum -y install xrdp tigervnc-server
[ root @ linuxgeekstuffs ~ ] # rpm –Uvh
[ root @ linuxgeekstuffs ~ ] # yum -y install xrdp tigervnc-server
you ll get some out put like below..
Running Transaction
Installing: xorg-x11-fonts-misc-7. 2-11. el6. noarch 1/3
Installing: tigervnc-server-1. 1. 0-24. el6. x86_64 2/3
Installing: xrdp-0. 6. 1-4. el6. x86_64. rpm 3/3
Verifying : xorg-x11-fonts-misc-7. 2-11. el6. noarch 1/3
Verifying : tigervnc-server-1. 1. 0-24. el6. x86_64 2/3
Verifying : xrdp-0. 6. 1-4. el6. x86_64. rpm 3/3
Installed:
tigervnc-server. x86_64 0: 1. 1. 0-24. el6
xrdp-0. 6. 1-4. el6. x86_64. rpm
Dependency Installed:
xorg-x11-fonts-misc. noarch 0: 7. 2-11. el6
Complete!
Running Transaction
Installing : xorg – x11 – fonts – misc – 7. 2 – 11. el6. noarch                                                                        1 / 3
Installing : tigervnc – server – 1. 1. 0 – 24. el6. x86_64                                                                          2 / 3
Installing : xrdp – 0. 6. 1 – 4. el6. x86_64. rpm      3 / 3
Verifying   : xorg – x11 – fonts – misc – 7. 2 – 11. el6. noarch                                                                        1 / 3
Verifying   : tigervnc – server – 1. 1. 0 – 24. el6. x86_64                                                                          2 / 3
Verifying   : xrdp – 0. 6. 1 – 4. el6. x86_64. rpm    3 / 3
Installed:
tigervnc – server. x86_64 0: 1. 1. 0 – 24. el6
xrdp – 0. 6. 1 – 4. el6. x86_64. rpm
Dependency Installed:
xorg – x11 – fonts – misc. noarch 0: 7. 2 – 11. el6
Now lets start xrdp service…
[[email protected] ~]# service xrdp start
[ root @ linuxgeekstuffs ~ ] # service xrdp start
Check xrdp will listen on 3389, lets confirm this by issuing following command.
[[email protected] ~]# netstat -antup | grep xrdp
tcp 0 0 127. 0. 0. 1: 3350 0. 0. 0. 0: * LISTEN 11299/xrdp-sesman
tcp 0 0 0. 0. 0. 0: 3389 0. 0. 0. 0: * LISTEN 11295/xrdp
[ root @ linuxgeekstuffs ~ ] # netstat -antup | grep xrdp
tcp         0       0 127. 0. 0. 1: 3350               0. 0. 0. 0: *                    LISTEN       11299 / xrdp – sesman
tcp         0       0 0. 0. 0. 0: 3389                 0. 0. 0. 0: *                    LISTEN       11295 / xrdp

By default, services wont auto start after system reboot. Issue the following command to enable the service at system start up..
[[email protected] ~]# chkconfig xrdp on
[[email protected] ~]# chkconfig vncserver on
[ root @ linuxgeekstuffs ~ ] # chkconfig xrdp on
[ root @ linuxgeekstuffs ~ ] # chkconfig vncserver on

Now as your machine is ready with xrdp and desktop you might have tried login with MRD(Microsoft Remote Desktop). But there ll be blank screen that’s because still your machine is not started in desktop mode.
Lets give final touch.

Open «inittab» file like below and modify…
[[email protected] ~]# vim /etc/inittab
[ root @ linuxgeekstuffs ~ ] # vim /etc/inittab
you ll see file like this..
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS. conf
#
# Individual runlevels are started by /etc/init/rc. conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete. conf
#
# Terminal gettys are handled by /etc/init/tty. conf and /etc/init/serial. conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
# 0 – halt (Do NOT set initdefault to this)
# 1 – Single user mode
# 2 – Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 – Full multiuser mode
# 4 – unused
# 5 – X11
# 6 – reboot (Do NOT set initdefault to this)
#
id: 3: initdefault:
~
# inittab is only used by upstart for the default runlevel.
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
# System initialization is started by /etc/init/rcS. conf
# Individual runlevels are started by /etc/init/rc. conf
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete. conf
# Terminal gettys are handled by /etc/init/tty. conf and /etc/init/serial. conf,
# with configuration in /etc/sysconfig/init.
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
# Default runlevel. The runlevels used are:
#   0 – halt (Do NOT set initdefault to this)
#   1 – Single user mode
#   2 – Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 – Full multiuser mode
#   4 – unused
#   5 – X11
#   6 – reboot (Do NOT set initdefault to this)
id: 3: initdefault:

Change 3 to 5 like this write and quite the file…
id: 5: initdefault:
id: 5: initdefault:

Now you will need a user to login by default amazon don’t give any password to root so lets give our root some password…
[[email protected] ~]# passwd root

Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[ root @ linuxgeekstuffs ~ ] # passwd root
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

Now reboot the machine and Enjoy  you machine is ready with Free Version of Desktop of CentOS.

Trouble Shooting:

you can get some error while connecting via XRDP its a bug in new version of tigervnc-server. If you get Error like below..
connecting to sesman ip 127. 0. 0. 1 port 3350
sesman connect ok
sending login info to session manager, please wait…
xrdp_mm_process_login_reponse: login successful for display
started connecting
connecting to 127. 0. 0. 1 5910
error – problem connecting
connecting to sesman ip 127. 0. 0. 1 port 3350
sesman connect ok
sending login info to session manager, please wait. . .
xrdp_mm_process_login_reponse: login successful for display
started connecting
connecting to 127. 0. 0. 1 5910
error – problem connecting
That is Because of the font errors, vnc-server did not start. This is why xrdp is failing to connect. xrdp is not able to interpret this specific error and throws the generic ERROR another Xserver is already active on display 10 error in /var/log/xrdp-sesman. log.
After Google searching for tigervnc-server fonts, I came across Bug 917717 – Tiger VNC server is broken in latest RHEL 6. 4 which clearly states there is a bug in tigervnc-server version 1. 1. 0-5. el6. x86_64 and newer.
Ultimately, downgrading to tigervnc-server-1. 0. 90-0. 17. 20110314svn4359. el6. x86_64 allowed the vncserver -geometry 1024×768: 10 command to run, and xrdp began working properly.

Please comment below if you find any problem or Error.. Happy to help…
Hope this information would be helpful to you. Sometime small things can be pain in A… Enjoy…

Leave a Reply

Your email address will not be published. Required fields are marked *