Cannot open Google Chromium on my windows from Ubuntu on Mobaxterm - linux

I have Ubuntu server where Google Chrome is installed. I am able to access that server using SSH from my Windows machine via Mobaxterm. I need to open Google Chromium on my machine which will open Ubuntu web page from Apache like http://localhost:8080 on my windows Chromium. Getting below error:
ERROR:browser_main_loop.cc(261)] Gtk: cannot open display:
How can I resolve this?

Execute the following command before opening chromium browser on your mobaxterm
export DISPLAY=your_ipaddress:0.0
For Ex:-
Let us consider ip address as 192.168.0.1, then your command should be:
export DISPLAY=192.168.0.1:0.0

Related

Open WSL directly to vscode

I'm trying to open WSL directly from vscode without opening or connecting to a remote window. In the image attached, my friend was able to add WSL as a profile and open it directly in vscode without connecting to a remote window or opening a new WSL. How would I be able to do this? (https://i.stack.imgur.com/sukIe.png)
I have WSL installed and enabled and I've tried to look up tutorials, but they all use the remote window.

Error installing Chrome on AWS EC2 Linux Instance: scaling_cur_freq & scaling_max_freq not found

I am trying to install Chrome (to use with Chromedriver / selenium) on an AWS EC2 instance and getting an error I've never seen before. I am able to reproduce consistently but can't find anything on Google about what to do.
Steps to reproduce:
Start a new EC2 Instance (Amazon Linux 2, 64-bit x86, t2.Micro)
Connect to the instance and run the following commands:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo yum install -y ./google-chrome-stable_current_*.rpm
google-chrome &
And I get the following errors:
[1122/164219.101517:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1122/164219.101672:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Would really appreciate any advice on this - thank you!
Seems you hit this open bug https://bugs.chromium.org/p/chromium/issues/detail?id=1228625 (at the moment of writing this) try to use a old version http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_93.0.4577.82-1_amd64.deb which some users reported is working.
Running Chrome with default options require GUI available on the machine. In your local machine you likely have it, thus executing google-chrome & will start the browser without any problems.
But EC2 instances are not shipped with GUI out of the box. So we're coming to the case when Chrome requests some GUI-related resources from the host -> these resources are not available -> Chrome crashes.
There are two ways to solve the problem depending on your needs:
Run Chrome in headless mode
See more about headless Chrome here
If that's what you need, just execute google-chrome --headless --remote-debugging-port=9222 & in your shell. I used default port as an example, but it can be changed.
Install a virtual desktop
You may trick Chrome by letting it think that there is a GUI available on the host, so it can be launched in the same way as on your local machine. In order to achieve this you should:
Install VNC server or similar on the EC2 instance. I've found this wonderful step-by-step guide
Connect to your EC2 instance using VNC client
Start terminal and run google-chrome &
Chrome GUI in Jenkins jobs
If you have Jenkins jobs that require Chrome GUI, you should follow the second approach, but please make sure:
VNC server or similar is setup on behalf of jenkins user
Chrome is not being started with super-user privileges
Your job uses Xvnc Jenkins plugin or similar, depending on the tool installed

Open VSCode from Remotly Server to Local like WSL2

Recently i created one server (with centos) on another computer, i assigned static local ip (192.168.1.100) and i my computer has local static ip too (192.168.1.50), and i would like open the vscode from my local computer when i run "code" command on remote server (like code .) inside vscode of my computer.
Basically like WSL2 works, but, when we install the distro of WSL2, the vscode install automatically one extension for WSL2, and that works.
And another question, is about the terminal of local vscode, when i open the vscode terminal, i would like to open the remote server terminal (ssh) on the current folder. (Exactly like WSL2)
Basically i would like create a WSL2 outside from the same computer. The "SubSystem" i want to install are on another computer (my server)
I think that's what you're looking for 1
A simpler method would be to install ssh-remote plugin in VSCode and you will see Remote Explorer in your left bar. After you log in once to that server you will see the connection and with a simple click, you can connect from there.

Open Firefox on Ubuntu Server accessed via Git Bash SSH on Win7

I am currently trying to open Mozilla Firefox on a Ubuntu Server. I am accessing this server via SSH on the Windows 7 Git Bash. I have installed it and when I run firefox, it displays:
Error: no DISPLAY environment variable specified.
How can I fix this problem?

XQuartz error on ssh connection

I'm connected to a remote Linux server via ssh, and I'm trying to execute ImageMagick's display command. I know that the problem is probably not on the server side, because when I connect from different machines I don't get the same problem. And I installed XQuartz on my local machine as well as connected using the ssh tags -Y and -X (neither fix the problem) and I'm still getting the following error. My computer is a MacBook Pro running El Capitan. Any idea?
display: unable to open X server `' # error/display.c/DisplayImageCommand/426.
Thanks!
I think the trick is to start XQuartz in the background on your Mac before you do anything and allow remote machines to connect.
So, on your Mac, in Terminal, start XQuartz:
X &
Now right-click the XQuartz icon in your Dock and click:
Applications -> Terminal
and in the Terminal that appears, type:
xhost +
Later, when you have it working, tighten up the security on the xhost command by being a bit more specific with IP addresses.

Resources