Hello. I tried to build a Linux environment using Windows Subsystem for Linux (WSL) of Windows 10 (I also installed Linuxbrew). The procedure is [^ 1].
[^ 1]: I'm sorry that there are many existing articles and it seems to build a rooftop.
** 1 ** Start Powershell with administrator privileges
Then set ExecutionPolicy
to `` `RemoteSigned```.
PS> Set-ExecutionPolicy RemoteSigned
Next, this time, Install Chocolatey and use it to Windows Terminal. / windows / terminal /) (terminal environment) installed (also vscode):
PS> set ChocolateyInstall=C:\ProgramData\chocolatey
PS> Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
PS> choco list -lo
PS> choco install -y microsoft-windows-terminal vscode
Then, in order to enable Windows Subsystem for Linux (WSL), execute the following command and reboot [^ 2].
PS> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
[^ 2]: Or, enable it in "Control Panel> Programs and Features>" Enable or Disable Windows Features ""
** 2 ** Obtaining and installing a Linux distribution Start the Microsoft Store, enter "WSL" in the search field, find Ubuntu 18.04 LTS (Linux) [^ 3], get it, install it, and start it [^ 4]. You can skip signing in to your Microsoft account. The installation will start, and you will be asked to enter the username and password for sudo.
Enter new UNIX username:
Enter new UNIX password:
Retype new UNIX password:
[^ 3]: Ubuntu 20.04 LTS (Linux) may also be good. [^ 4]: Reference articles are "Windows Subsystem for Linux (WSL) setting procedure", "Windows 10 Install WSL to make Linux programs available on (version 1803 or later) "," [[ Introduction to WSL] Part 1 Windows 10 standard Linux environment Let's start WSL "etc.
** 3 ** Confirm that the Linux terminal can be started Start the Linux terminal environment (Windows Terminal or the default one installed at the same time as the distribution) and check that the command is executed:
$ uname -a
Linux ...
$ cat /etc/os-release
:
:
Next, make various settings:
$ echo 'umask 002' >> ~/.bashrc
$ echo 'export VISUAL="vim"\nexport EDITOR="vim"' >> ~/.bashrc
$ echo 'export PATH="/home/linuxbrew/.linuxbrew/sbin:/home/linuxbrew/.linuxbrew/bin:$PATH"' >> ~/.bashrc
** 4 ** Restart the Linux terminal environment and update etc .:
$ sudo apt update
$ sudo apt upgrade -y
$ sudo apt install git curl file build-essential
I also installed Linuxbrew this time.
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
$ brew doctor
$ brew update
$ brew install gcc zlib
** 5 ** Check services on Linux Check the status of cron and ssh
$ sudo service cron status
* cron is not running
$ sudo ssh-keygen -A
$ sudo service ssh start
$ sudo service ssh status
* sshd is running
Recommended Posts