RDP into Linux Instance AWS - amazon-web-services

I am new to AWS.
I created a Linux free tier instance and its up and running as i am able to access it via ssh putty as i am a windows user.
Now, I wanted to RDP the Linux Instance to see the interface but i am unable to do so. I am unable to find any option for that.
As per my understanding by reading online forms, it is not possible to RDP LinuxInstance on AWS.
If anyone can give there expert opinion if it is possible to RDP the Linux Instance? If not then Is there any way I can access the graphical interface for Linux Instance in AWS or I just have to work with command line interface from my local machine?

Amazon had a page that described how to do this with various linux versions but they took it down. Here are the steps for Linux 16.04. I just did this on a new ubuntu ec2 instance and it worked fine.
sudo apt update && sudo apt upgrade
sudo sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
sudo /etc/init.d/ssh restart
sudo passwd ubuntu
sudo apt install xrdp xfce4 xfce4-goodies tightvncserver -y
echo xfce4-session> /home/ubuntu/.xsession
sudo cp /home/ubuntu/.xsession /etc/skel
sudo sed -i '0,/-1/s//ask-1/' /etc/xrdp/xrdp.ini
sudo service xrdp restart

RDP is a proprietary protocol developed by Microsoft, Linux servers do not come in with GUI, you need to SSH into Linux box and then install packages to enable desktop GUI functionality
Here is an article from AWS
https://aws.amazon.com/premiumsupport/knowledge-center/connect-ec2-centos-windows/
Note: Amazon Linux does not provide any desktop GUI functionality

try install GNOME packages i.e.,
$sudo yum -y groupinstall "Server with GUI"
$sudo systemctl enable xrdp; systemctl start xrdp
now try login from your windows machine using "windows remote desktop or any vnc client

Related

Which is more preferable? Try to downgrade Ubuntu version of an EC2 server or create a new instance altogether?

I have a dilemma, I am trying to set up the Microsoft slqsrv drivers for PHP and a laravel project so that it can connect to an RDS service and do my migrations, however, the Microsoft page dictates that the supported versions for the Ubuntu Server are 18, 20 and 21. The following snippet is the exact commands for an Ubuntu server from the official Microsoft page.
if ! [[ "18.04 20.04 21.04" == *"$(lsb_release -rs)"* ]];
then
echo "Ubuntu $(lsb_release -rs) is not currently supported.";
exit;
fi
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list >
/etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
Trying to run the commands without the if statement installs "something" but it ends up with errors, moreover, the pdo_sqlsrv and sqlsrv extensions do show up in the extensions list of PHP, running the command "php -m" shows that they are indeed loaded, but if I try to run the migration it shows the alert that the OBDC driver is missing.
What makes me think this is not working is that my EC2 instance has the Ubuntu 22 version, which would make sense since the drivers are not supported at the moment and are not installed properly. The options I concluded are that either somehow downgrade my Ubuntu version from my EC2 server or create a new instance with a version that supports the sqlsrv drivers. I don't know if there's a third option for the installation to work properly in this version, but I assume the previous two are the more sensible.
My question is, is it possible or recommended to downgrade the Ubuntu version of the EC2 server? or should I create a new instance with a compatible version?
One of the main benefits of the cloud is resource provisioning speed.
It takes seconds to create a new EC2 instance, it's much easier & quicker to just create a new instance with the Ubuntu 20.04 LTS or Ubuntu 18.04 LTS AMIs available.

Permission denied (publickey,gssapi-keyex,gssapi-with-mic). GCP

I launched a VM with CentOS 7. I configured a GUI and a xrdp with the next .sh file:
#!/bin/sh
#Install​ EPEL and nux Desktop repository rpms
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
#Install​ xfce desktop to get the graphical user interface
yum groupinstall -y "Xfce"
#command​ to change the reboot from CLI to GUI
ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
#create xfce clients
echo "xfce4-session" > ~/.Xclients
chmod a+x ~/.Xclients
#Install​ the xrdp
yum -y install xrdp tigervnc-server
#start​ the xrdp service
systemctl start xrdp.service
#enable​ the xrdp service
systemctl enable xrdp.service
Everything works fine, i can reach that VM via rdp from my computer, but when i'm in the vm and i try to acces to another vm's in the same project this error appear:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
But it only happens when i try with the vm terminal, if i access from the google ssh client i can access to the other virtual machines without problem.
Another thing: I access to the VM rdp with root user, this could be the problem?
Any ideas?

How to: Connecting a Instance (Virtual Machine from Google Cloud Service) with local runtime from Google Colab

I just struggled for 3 days to get this to work but many of the sources that explain it are somehow misleading. Therefore I share that now.
I was using windows and used the Windows 10 Subsystem for Linux to operate from there:
(instruction on how to activate you can find here https://learn.microsoft.com/en-us/windows/wsl/install-win10)
I first created a virtual machine on google cloud called colav-vm in the geographic zone us-east4-c
Start the VM in google cloud
Opened Ubuntu Linux Terminal:
Type:
gcloud compute ssh colav-vm --zone=us-east4-c -- -L 8888:locahost:8888
Enter Password to connect to it
Install pip:
(found it here: https://askubuntu.com/questions/672808/sudo-apt-get-install-python-pip-is-failing)
(In the connected terminal from the VM)
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python-pip
- Install jupyter_http_over_ws
sudo -i pip install jupyter_http_over_ws
- Run the jupyter-server still on the connected VM:
jupyter serverextension enable --py jupyter_http_over_ws
jupyter notebook \
--NotebookApp.allow_origin='https://colab.research.google.com' \
--port=8888 \
--NotebookApp.port_retries=0
(this should be also a code cell - but the formatting doesn't let me)
Then go to the browser on your local computer and type in " http://localhost:8888/ " to open a Jupyter environment if you have it installed - or go to google Colab and connect to runtime on the top right and type it in there and connect (there you need to add the full line including the token like that:
http://localhost:8888/?token=bd391421b3ec5c08f35ef28e2eb9d01fab6501e341c82e35)
I hope this saves some people some time.
The original sources are from here:
https://research.google.com/colaboratory/local-runtimes.html
https://medium.com/#yufengg/how-to-upgrade-colab-with-more-compute-64d53a9b05dc
(but somehow it confused me and it didn't work for me at least)

Unable to start VM - Minikube

I am trying to start the minikube using the minikube start command and this is the error i am getting. Even installed the latest version of virtual box but still it gives me this error.
Can someone please tell me why this is happening?
Follow the advice of the error message. Did you try installing virtualbox-dkms and the linux headers?
$ sudo apt update
$ sudo apt install virtualbox-dkms linux-headers-generic
Follow the instructions in the docs, if you aren't already: https://kubernetes.io/docs/tasks/tools/install-minikube/
First of all I would recomend you to install newest version of Minikbue (currently it is 1.5.2) and Kubectl.
Second thing check if your machine is supporting virtualization. It can bo done via command egrep -q 'vmx|svm' /proc/cpuinfo && echo yes || echo no.
If it is no you have to:
If you are running within a VM, your hypervisor does not allow nested virtualization. You will need to use the None (bare-metal) driver.
If you are running on a physical machine, ensure that your BIOS has hardware virtualization enabled.
Minikube set VirtualBox as default driver, but you can use other. Here under Hypervisor Setup you might find that you can also use KVM or None as driver for Linux OS.
Solutions:
1. As Minikube output advised, try to install
- $ sudo apt-get install virtualbox-dkms linux-headers-generic
- run $ sudo modprobe vboxdrv
- reinstall VirtualBox
2. If there is no virtualization option on your Laptop you can use Minikube with --vm-driver=none flag.
$ sudo minikube start --vm-driver=none
If you would use this option, you might need to specify --cpus=X and --memory=XXXX as default is requesting less resources.
Another think is that none driver provides limited isolation and may reduce system security and reliability. More info can be found here.
$ minikube start
😄 minikube v1.5.2 on Ubuntu 18.04
🔥 Creating virtualbox VM (CPUs=2, Memory=2000MB, Disk=20000MB)
...
$ sudo minikube start --vm-driver=none
😄 minikube v1.5.2 on Ubuntu 18.04
🤹 Running on localhost (CPUs=2, Memory=7470MB, Disk=9749MB) ...
After successfull installation, don't forget to execute mentioned commands.
▪ sudo mv /home/<your_user>/.kube /home/<your_user>/.minikube $HOME
▪ sudo chown -R $USER $HOME/.kube $HOME/.minikube

Install debian package using cloud-init

I'm trying to install netcat using cloud-init.
As soon as I SSH'd to my vm, with all my keys configured correctly via cloud-init (meaning, it's executing), I try to run netcat and it doesn't work;
I'm using Container-Optimized OS (cos) as they refer to use it for cloud-init, and as of research I found cos is based on ChromiumOS kernel;
All I add to my cloud-init file is
packages:
- nano
- netcat
And none of them work.
Is there anything I'm missing to be able to add these packages?
Assuming you want to run tools like nano and netcat interactively in that session, you can use the CoreOS toolbox in Container-Optimized OS to install and run these tools.
$ toolbox apt-get install -y nano netcat
$ toolbox nano