eATM

win10子系统linux开发环境搭建

选择安装ubuntu 16.04

安装成功后,会提示让你输入新的用户名,此时不要管他了,关掉

这样系统将默认使用root登录

 

#此处我们使用aliyun的apt源

#执行命令:
vim /etc/apt/sources.list

#输入:%d删除全部内容
#按键i 进入编辑模式
#将下面内存复制进去


deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

#SHIFT+ZZ 两次ZZ,保存

#更新源命令:
apt-get update -y

#更新所有软件(可选):
apt-get upgrade -y

 

#安装GCC,g++,gdb,cmake
apt-get install gcc g++ gdb cmake -y


 

#执行命令
vim /etc/ssh/sshd_config

#相关说明
PermitRootLogin prohibit-password/yes
#是否允许Root用户登录

PermitEmptyPasswords yes/no
#是否允许空密码登录

PasswordAuthentication yes/no
#是否允许字符密码登录,no的情况下只能使用证书了


#修改完后重启ssh
service ssh restart

#ssh如出此类错误
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key

#执行以下命令
sudo rm -r /etc/ssh/ssh*key
dpkg-reconfigure openssh-server
service ssh restart


#linux子系统中开机自动运行一直配置不成功,不知道什么原因
#现在只能通过在linux中写sh脚本来启动一些服务,比如ssh


#如,编写sh脚本文件
vim /tmp/autorun.sh

#内容
service ssh start



#另外在windows中编写bat来开机自动运行,如下:
@each off
bash /tmp/autorun.sh
pause

#将此bat文件加入开机启动项
#如win10中将此文件建立快捷方式复制到以下目录:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

 

#编译zlib
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure --prefix=/usr/local
make && make install



#编译openssl
#如已有openssl需先卸载删除
apt-get purge openssl
rm -rf /etc/ssl #删除配置文件

#编译openssl
wget ftp://ftp.openssl.org/source/openssl-1.0.2o.tar.gz
tar -zxf openssl-1.0.2o.tar.gz
cd openssl-1.0.2o/
./config  --prefix=/usr/local --openssldir=/usr/local/ssl
make && make install

#再编译次-动态库
./config shared --prefix=/usr/local --openssldir=/usr/local/ssl
make clean
make && make install

 

 

其它说明
win10中查看已安装的linux子系统命令:

wslconfig /l

在安装有多少个子系统情况下,可使用wslconfig命令配置默认启动的子系统

 

修改debian的apt源为阿里云

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib

 

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注