-People who only have a Windows 10
machine but need a Linux
environment.
・ People who have recently started studying servers.
・ University students who are about to start programming classes.
Abstract
Build an environment on Windows10
that allows you to use Ubuntu
terminals and Linux
commands ( bash
, ssh
, git
, apt
, etc.). Then, install gnuplot
in Ubuntu
so that the output result can be displayed on Windows 10
.
18.04 https://www.microsoft.com/store/productId/9N9TNGVNDL3Q
20.04 https://www.microsoft.com/store/productId/9N6SVWS3RX71
For example, when moving to a file on drive C
python
$ cd /mnt/C/...
You can access it by doing.
This time, by introducing X Window System
, the result of execution on Linux (Ubuntu) (for example, the graph output by gnuplot
) can be displayed on Windows. Install x11
on Linux (Ubuntu) and Xming
on Windows.
Start Ubuntu downloaded earlier and enter the following command.
python
#apt update
$ sudo apt update
$ sudo apt upgrade
#x11 installation
$ sudo apt install x11-apps
Here, make sure that x11
is installed normally on the Limux side and that the GUI does not exist on the Windows side. Now, when I try to display something with x11
, I should get an error. Execute the following command.
python
$ xeyes &
Then
python
Error: Can't open display
Is displayed, OK.
Download and install the following files from Xming X Server for Windows. Be sure to reboot after installation.
-[Xming-6-9-0-31-setup.exe] (https://ja.osdn.net/projects/sfnet_xming/downloads/Xming/6.9.0.31/Xming-6-9-0-31-setup.exe/)
-[Xming-fonts-7-7-0-10-setup.exe] (https://ja.osdn.net/projects/sfnet_xming/downloads/Xming-fonts/7.7.0.10/Xming-fonts-7-7-0-10-setup.exe/)
If you execute the following command and the eye window appears, it is successful.
python
$ xeyes &
When you run xeyes &
,
python
Error: Can’t open display:
Or
python
Error: Unable to initialize GTK+, is DISPLAY set properly?
You may get an error like this. This time,
python
$ export DISPLAY=:0
Or
python
$ export DISPLAY=:0.0
And run ``` xeyes &` `` again and it works.
If you add the above command to ~/.bashrc
, you will not have to enter it from the next time. Below is an example command for editing `~/.bashrc``` with
Vi```. You can add ``
export DISPLAY =: 0 or `` `export DISPLAY =: 0.0
to
~/.bashrc``` just by executing from above.
First, open `~/.bashrc``` with
`Vi```.
python
$ vi ~/.bashrc
Next, enter the following line by line in Vi
.
python
#Jump to the last line
Shift + g
#Insert mode
i
#Move to the end of line
Fn + ->
#new line
Enter
#Input of magic
export DISPLAY=:0 or export DISPLAY=:0.0
#Exit insert mode
Esc
#Save and exit Vi
:wq
Finally, reflect the changes in ~/.bashrc
.
python
$ source ~/.bashrc
First, create a lock
file in Ubuntu.
python
$ sudo touch /var/lib/dpkg/lock
$ sudo chmod 640 /var/lib/dpkg/lock
$ sudo chown root:root /var/lib/dpkg/lock
Then update apt
. (Not necessary if you did it in 2.)
python
$ sudo apt update
$ sudo apt upgrade
Finally, install `` `gnuplot```.
python
$ sudo apt install gnuplot
Start by typing gnuplot
on the terminal.
Enter the following command and if the graph of $ y = \ sin (x) $ appears, it is successful.
gnuplot> set terminal x11
gnuplot> plot sin(x)
here
python
Error: Can’t open display:
Or
python
Error: Unable to initialize GTK+, is DISPLAY set properly?
When an error like this appears, execute `` `export DISPLAY =: 0``` etc., or execute Magic again.
-Vim (included in Ubuntu as standard)
・ VScode (https://code.visualstudio.com/) ・ Installation method, etc. https://qiita.com/Shi-nakaya/items/c43fb6c1e638d51bf1c8
・ Atom (https://atom.io/) ・ Installation method, etc. https://qiita.com/purini-to/items/caca2a0c56e984b2f9d8
https://qiita.com/makky0620/items/e31edc90f22340d791ff
Recommended Posts