(Windows10) Install Linux environment and gnuplot.

Who is the target of this article

-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.

Build a Linux environment on Windows 10.

Install "Ubuntu 18.04 LTS" or "Ubuntu 20.04 LTS" from the Microsoft Store.

18.04 https://www.microsoft.com/store/productId/9N9TNGVNDL3Q

20.04 https://www.microsoft.com/store/productId/9N6SVWS3RX71 ubuntu

To refer to Windows files, add the `` `/ mnt/``` directory to the beginning as shown below.

For example, when moving to a file on drive C

python


$ cd /mnt/C/...

You can access it by doing.

Introduction of X Window System

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.

x11 installation

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.

Xming installation

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/)

Check if it is installed

If you execute the following command and the eye window appears, it is successful.

python


$ xeyes &
eyes

Note

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.

Magic

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

Install gnuplot

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

Operation check of 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)

Note

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.

Bonus: Install your favorite editor.

-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

Referenced sites, etc.

GUI with Bash on Ubuntu on Windows + Xming

https://qiita.com/makky0620/items/e31edc90f22340d791ff

Error installing gnuplot

4 of this (https://forums.ubuntulinux.jp/viewtopic.php?pid=32854)

Recommended Posts

(Windows10) Install Linux environment and gnuplot.
Install wsl2 and master linux on windows
Build Linux on a Windows environment. Steps to install Laradock and migrate
Install Python and Flask (Windows 10)
Install LAMP on Amazon Linux 2 and build a WordPress environment.
Pip install (Windows) under Proxy environment
Install python2.7 on windows 32bit environment
Build and install OpenCV on Windows
Create a Linux environment on Windows 10
Install Python development environment on Windows 10
Install easy_install and pip on windows
[UE4] Build DedicatedServer on Windows and Linux
Install and launch k3s on Manjaro Linux
Install and Configure TigerVNC server on Linux
How to install Windows Subsystem For Linux
Install rJava on Linux in R3.6 environment.
Let's install box2d-py with Windows 10 environment pip
Linux environment construction
python windows environment
Install easy_install (Windows)
Install Windows 10 from a Linux server with PXE
[Samba] File sharing between Linux and Windows machines
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
Install Python 3.5.1 + numpy + scipy + α in Windows environment
Install gensim in conda environment (and also install mecab)
Linux (Bash) and Windows (PowerShell) command correspondence table
Install ZIP version Python and pip on Windows 10
Clean install and work environment update for macOS Catalina
OS and Linux distribution
Install pyenv and pyenv-virtualenv
Install Python3 on Mac and build environment [Definitive Edition]
python windows environment construction
Linux (WSL) on Windows
Linux, Windows proxy settings
Install and configure KVM
[Windows] [Python3] Install python3 and Jupyter Notebook (formerly ipython notebook) on Windows
Install Anaconda on Windows 10
virtualenvwrapper in windows environment
Install python on windows
Linux PATH environment variable
Install pycuda on Windows10
Compile and install MySQL-python for python2.7 on amazon linux
Install Docker on Arch Linux and run it remotely
Install procs, an alternative tool for ps, on Linux (also available on Mac and Windows)
Comparison of Windows Server and Free Linux to Commercial Linux
Linux: files and directories
Install Ubuntu 20.04 with GUI and prepare the development environment
Install pygraphviz on Windows 10
Install Chainer 1.5.0 on Windows
Until you install TensorFlow-GPU with pip in Windows environment
Create a decent shell and python environment on Windows
Install OpenCV 3 (core + contrib) in Windows & Python 3 environment & Difference between OpenCV 2 and OpenCV 3 & Easy operation check
Linux (Bash) and Windows (Powershell) key binding correspondence table
Cross development environment (developing programs for windows on linux)
Install Python (for Windows)
How to set up WSL2 on Windows 10 and create a study environment for Linux commands
Install Jupiter Notebook on Windows with pip in proxy environment
Install python and Visual Studio Code on windows10 (April 2020 version)
Build Docker environment (Linux 8) and start Apache HTTP Server container
A rough summary of the differences between Windows and Linux
Comfortable LaTeX with Windows Subsystem for Linux and VS Code