wsl(windows subsystem linux)
阿新 • • 發佈:2019-01-30
1.win10設定為開發人員模式,並安裝subsystem for linux(命令列輸入bash就可以安裝)
2.登入並su到root,然後修改/etc/sudoers,在最後一行加(一定要在最後一行):
youname1 ALL=(ALL) NOPASSWD:ALL
3.修改/etc/apt/sources.list,註釋掉原來的源,新增:
deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
修改後apt-get update
4.安裝相關開發軟體
sudo apt install -y build-essential
sudo apt install -y gdbserver
sudo apt install -y openssh-server
修改/etc/ssh/sshd_config,把PasswordAuthentication改為yes
sudo ssh-keygen -A
sudo service ssh start 每次啟動控制檯都需要執行,因為控制檯會關掉WSL的所有程式
5.修改ssh埠,預設的22被windows佔用了
vi /etc/ssh/sshd_config
如果要使用vs2017除錯linux程式,參考:
https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/
2.登入並su到root,然後修改/etc/sudoers,在最後一行加(一定要在最後一行):
youname1 ALL=(ALL) NOPASSWD:ALL
3.修改/etc/apt/sources.list,註釋掉原來的源,新增:
deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
修改後apt-get update
4.安裝相關開發軟體
sudo apt install -y build-essential
sudo apt install -y gdbserver
sudo apt install -y openssh-server
修改/etc/ssh/sshd_config,把PasswordAuthentication改為yes
sudo ssh-keygen -A
sudo service ssh start 每次啟動控制檯都需要執行,因為控制檯會關掉WSL的所有程式
5.修改ssh埠,預設的22被windows佔用了
vi /etc/ssh/sshd_config
如果要使用vs2017除錯linux程式,參考:
https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/