Monday 11 March 2019

How To make AWS EC2 server in GUI mode(graphical view) from cli mode by Raj Gupta


In REHL ec2
[root@ip-172-31-19-243 ~]# yum grouplist
[root@ip-172-31-18-8 ~]# yum groupinstall "Server with GUI"
[root@ip-172-31-18-8 ~]# runlevel
N 3  ---- this indicate command line mode

If you want to get GUI mode only for temporary
 then run the below command once you restart, then it will not in GUI mode
[root@ip-172-31-18-8 ~]# systemctl isolate runlevel5.target

[root@ip-172-31-18-8 ~]# runlevel
3 5         here 5 indicate GUI mode
[root@ip-172-31-18-8 ~]# systemctl get-default
multi-user.target

If you want to get GUI mode permanently then run the below command once you restart, then it will in GUI mode also
[root@ip-172-31-18-8 ~]# systemctl set-default graphical.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
[root@ip-172-31-18-8 ~]# systemctl get-default
graphical.target

now run the below command So that we are able to do RDP on EC2 server

[root@ip-172-31-18-8 ~]# yum -y install xrdp tigervnc-server
[root@ip-172-31-18-8 ~]# ls /etc/yum.repos.d/
[root@ip-172-31-18-8 ~]# yum -y install xrdp tigervnc-server
[root@ip-172-31-18-8 ~]# systemctl start xrdp
[root@ip-172-31-18-8 ~]# netstat -antup | grep xrdp
tcp        0      0 127.0.0.1:3350          0.0.0.0:*               LISTEN      6324/xrdp-sesman
tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN      6325/xrdp
[root@ip-172-31-18-8 ~]# systemctl enable xrdp
[root@ip-172-31-18-8 ~]# systemctl status firewalld
[root@ip-172-31-18-8 ~]# sestatus
[root@ip-172-31-18-8 ~]# firewall-cmd --permanent --add-port=3389/tcp
[root@ip-172-31-18-8 ~]# firewall-cmd –reload
[root@ip-172-31-18-8 ~]# chcon --type=bin_t /usr/sbin/xrdp
[root@ip-172-31-18-8 ~]# chcon --type=bin_t /usr/sbin/xrdp-sesman
[root@ip-172-31-18-8 ~]# passwd    ----set the password for root

Then take the public ip if ec2 and open remote desktop connection

Click on connect

after this Now click on More choice 


 Now click on Use a different account


Then give user name as root and password of root user then click on ok

No comments:

Post a Comment