This article is a continuation of: WSL2 ~ Linux on Windows ~ (Part 1: Introduction)
In the first part, we introduced Ubuntu 20.04 with WSL2. The following environment will be prepared on Ubuntu-20.04.
Set the proxy as needed. Looking at the github community, there seem to be two types of setting methods. https://github.com/microsoft/WSL/issues/1570
--Setting by environment variables --Settings for apt
Tools such as curl and wget also use proxies, so I decided to use environment variables.
Command execution
cd ~/
vi .bashrc
~/.bashrc
export http_proxy=http://proxy-server:PortNumber
export https_proxy=http://proxy-server:PortNumber
Log out
exit
Re-login
wsl -d Ubuntu-20.04
sudo vi /etc/apt/apt.conf.d/proxy.conf
Acquire::http::Proxy "http://proxy-server:PortNumber";
Acquire::https::Proxy "http://proxy-server:PortNumber";
Package update
sudo -E apt-get -y update
"-E" is for inheriting and executing environment variables.
Installation
sudo -E apt -y install openssh-server
Execution result
Abbreviation
0 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.
It's already in!
/etc/ssh/sshd_Edit config
$sudo -E vi /etc/ssh/sshd_config
Turn on password authentication
- PasswordAuthentication no
+ PasswordAuthentication yes
Security is loose because it is a local environment.
Key creation command
$ sudo ssh-keygen -A
result
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
Service start command
$sudo service ssh restart
Execution result
* Restarting OpenBSD Secure Shell server sshd [ OK ]
Windows command prompt
C:\>ssh -l [Ubuntu username] [Ubuntu IP address]
[A user]@[IP address]'s password:●●●●●● <=====Login password
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 4.19.128-microsoft-standard x86_64)
***Omitted***
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
[User]@[PC-NAME]:~$
In the early days, we didn't have the following basic commands that we were used to.
I think that the above command does not exist because it has moved to the ip command, but I will introduce it because I want a familiar command.
command
sudo -E apt -y install net-tools <==== arp,ifconfig,netstat,rarp,route
sudo -E apt -y install bridge-utils <==== brctl
sudo -E apt -y install inetutils-traceroute <=== traceroute
In order to create a comfortable usage environment, we will investigate and add the following. --Set SSH to start automatically --Make the proxy settings smarter (take over the proxy from the Windows side?)
Recommended Posts