Win10, how to install Ubuntu support natively
https://docs.microsoft.com/en-us/windows/wsl/install-win10
Enable this feature support first,
-
open the setup, this window should pops up, clicks [開啟或關閉WINDOWS功能]
-
select this feature to proceed with, [windows 子系統 LINUX 版], then press [確定]
just be patient and waiting.... upon finish, Win10 will be asked to reboot.
now PC has been rebooted, open Microsoft Store, the app store by Microsoft. just like play store of Google or App store of Apple.
find Ubuntu and install, maybe hour is required,
the system will asks you to select user name and password at the first time,
for example,
user name : xiao
password : 0000
easy for development platform and internally used;
sudo apt-get update
do not forget to hits [Enter]
required hour depends on speed of your network
where to see those files of linux working environment, usually,
%userprofile%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc
and roots
%userprofile%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs
and home folder, wsl 1
%userprofile%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home
and home folder, wsl 2,
you may uses win10 editor to edit those files, no more constraint as wsl updated and coverted wsl 2,
\\wsl.localhost\Ubuntu-20.04\home
job done, something like this,
copy the following, invoke Ubuntun, right click the mouse button, those commands will be done
clear
mkdir hello
cd hello
## build hello.c
cat <<EOT >> hello.c
/*C program to get current system date and time in Linux.*/
#include <stdio.h>
#include <time.h>
int main()
{
time_t T= time(NULL);
struct tm tm = *localtime(&T);
printf("System Date is: %02d/%02d/%04d\n",tm.tm_mday, tm.tm_mon+1, tm.tm_year+1900);
printf("System Time is: %02d:%02d:%02d\n",tm.tm_hour, tm.tm_min, tm.tm_sec);
return 0;
}
EOT
## show content hello.c
#cat hello.c
## compile hello.c
gcc -o hello hello.c
## run program
./hello
ls
if you see something like this, the program build is successful,
run this ubutnu, it prompts need to update wsl2, update done and the icon has been changed
open cmd,
wsl -- list --online
wsl --update
ubutnu 的小 icon 被換成了小企鵝.
這只企鵝很古怪, 說甚麼的呢, 不支援主控台設定 ??
先解決小問題, 不然打開閃屏就關不能用,
難道是這樣幹掉它?!
原來就是它搞怪 解決方法 2023-02-10_wsl_update
企鵝終於跑起來了
hello test, remove the hello build last time first
rm -r hello
click here to see & build hello_world program again
done,
ref : https://sh-tsang.medium.com/tutorial-docker-installation-in-wsl-2-of-windows-f4471fc3e1d4
download, https://docs.docker.com/desktop/windows/wsl/
installation done, logout & login
https://learn.microsoft.com/zh-tw/windows/wsl/connect-usb download, https://github.com/dorssel/usbipd-win/releases
wsl --list --verbose
wsl --set-version Ubuntu-20.04 2
wsl --set-default-version 2
wsl --list --verbose