技术圈开发者交流群:

WSL设置root为默认登录用户

安装好WSL后,默认的用为自己设置的,每次执行命令都要sodu以下,毕竟是自己开发环境用的,没必要这么麻烦,索性直接改默认用户为root,这里以Ubuntu为例:

首先以管理员身份打开cmd命令行,查看用法:

C:\WINDOWS\system32> ubuntu /?
Launches or configures a Linux distribution.

Usage:
    <no args>
        Launches the user's default shell in the user's home directory.

    install [--root]
        Install the distribuiton and do not launch the shell when complete.
          --root
              Do not create a user account and leave the default user set to root.

    run <command line>
        Run the provided command line in the current working directory. If no
        command line is provided, the default shell is launched.

    config [setting [value]]
        Configure settings for this distribution.
        Settings:
          --default-user <username>
              Sets the default user to <username>. This must be an existing user.

    help
        Print usage information.
windows 2019年10月24日 8617

Linux下快速安装Node.js笔记

Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境。 Node.js 使用了一个事件驱动、非阻塞式 I/O 的模型,使其轻量又高效。

Linux下安装Node.js主要有两种方法,一种是源码编译安装,一种是编译后的文件。源码编译安装比较麻烦,这里介绍通过编译好的文件安装。

首先去官网下载 https://nodejs.org/en/download/ ,这里用的是Linux Binaries (x64)

Node.js 2019年09月24日 28826

WSL里Nginx+PHP,反映慢,卡住等问题

在wsl里搭建lnmp环境时,

访问简单的PHP 文件 (例如Hello world)没有问题,

但访问多数 PHP 文件卡死,

有的(例如phpinfo()),虽然可以加载出来但浏览器显示网页仍未加载完全或者巨慢。

windows 2021年10月26日 33240

Linux环境下给PHP安装fileinfo扩展及其作用

fileinfo模块中的函数通过在文件的给定位置查找特定的 魔术 字节序列 来猜测文件的内容类型以及编码。 虽然不是百分百的精确, 但是通常情况下能够很好的工作。

这里以php7.2为例,本文php的安装目录为/usr/local/php/

首先进入php的源码包fileinfo目录,如果没有源码先下载解压:

cd php-7.2.6/ext/fileinfo/
Linux 2019年03月10日 5820

修改ubuntu默认Nano编辑器为vim

爱折腾的我,最近安装了Windows子系统ubuntu,系统默认的是nana,不会用啊。

怎么办,因此修改下默认的编辑器为vim,网上找了两个方法:

选择编号3 /usr/bin/vim.basic:

# update-alternatives --config editor 
There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    15        manual mode

Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode
Linux 2019年03月10日 689

在GIT中创建一个空分支

工作中有个项目需要个单独非分支放文档,该分支不继承任何提交,没有父节点,完全是一个干净的分支,使用git checkout命令创建的分支是有父节点的,包含了历史提交的,网站找了一下,所有就记录下来备用。

使用git checkout--orphan参数:

git checkout --orphan document
工具 2019年03月07日 567

WSL开机启动ssh、nginx、mysql等服务

进入windows开机启动目录C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

新建vbs文件start-wsl.vbs:

Set ws = WScript.CreateObject("WScript.Shell")
cmd = "C:\Windows\System32\bash.exe -c ""bash /home/init.sh"""
' 运行命令不显示cmd窗口
ws.Run cmd, 0, false
Set ws = Nothing
WScript.quit
windows 2019年03月05日 796

WSL(Windows Subsystem for Linux) 适用于Linux的Windows子系统初体验

Windows Subsystem for Linux(简称WSL)是一个为在Windows 10上能够原生运行Linux二进制可执行文件(ELF格式)的兼容层。它是由微软与Canonical公司合作开发,目标是使纯正的Ubuntu 14.04 "Trusty Tahr"映像能下载和解压到用户的本地计算机,并且映像内的工具和实用工具能在此子系统上原生运行。

记得上学的时候就开始用Vmware workstation,搭建过各种网络架构,期间也用过VirtualBoxDocker,后来用了一段时间Hyper-V,最终还是回到Vmware workstation怀抱。

最近,一时兴起,决定折腾一下,体验一下WSL...

Linux 2019年03月05日 36910
鄂ICP备19028750号-1 @copyright 2024 tech1024.com