Code Monkey home page Code Monkey logo

init-env's Introduction

init-env

初始化服务器,WSL 和开发环境的配置文件。

License Author

使用方法 Usage

WSL / WSL2

  • 确保安装了 sudo
# root
apt update && apt install sudo
  • 按需修改 init.sh 脚本
# 修改需要的配置
# 设置镜像
setMirrors
# 安装基础应用,在 Ubuntu Core 下大部分应用都没有预装,需要先安装才可进行下列操作
installBase
# 安装 omz,并设置 omz
installZsh
# (Only WSL2) 设置 WSL2 启动脚本,该脚本会安装并设置 systemd,配置自动设置 hosts 等功能
installSetupWsl2
# (Only WSL2) 安装 Docker
installDocker
  • 如果要安装 systemd,就必须使用非 root 用户
# 按需执行
adduser <username>
usermod -aG sudo <username>
su <username>
  • 修改部分文件

目前新的脚本采用给 WSL 的 Hyper-V 虚拟网卡添加一个静态的 IP,然后给 WSL 虚拟机添加一个虚拟网卡,相当于另外建立了一个局域网,只不过使用的是同一个虚拟网卡。

因为一些限制,你需要修改 wsl-setup/set-ip.ps1wsl-setup/setup.sh 文件,将 IP 设置为适合的 IP,默认是 192.168.50.1(Windows)、192.168.50.2(WSL),然后更改对应的分支名称,默认的是 Ubuntu2。

通过这些操作后,我们就可以利用静态的 IP 访问 WSL2 了,同时也可以设置固定的 hosts。另外脚本是动态加载的,如果已经设置了静态 IP,那么就不会再设置,节省进入终端的时间。

  • 执行
# init
./init.sh

维护者 Maintainer

init-env 由 Otstar Lin 和下列 贡献者 的帮助下撰写和维护。

Otstar Lin - Personal Website · Blog · Github

许可证 License

lincense

根据 MIT License 许可证开源。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.