Avatar

Organizations

README.md
  • 15年移动互联网产研经验,10年团队管理经验。
  • 精通产品全生命周期管理,擅长从0到1构建产品体系。
  • 擅长平台级、技术型产品,数据驱动产品决策,具备商务谈判能力。
  • 熟练使用 Office, Project, Visio, Axure, JsutinMind 等产品管理工具。
  • 熟练使用 Linux, Docker, Podman 等系统工具。
  • 熟练使用 Python, HTML5, Javascript, Playwright, MySQL, PostgreSQL 等开发工具。
  • 熟悉网络架构,拥有CCNA证书。

Popular posts

  1. Windows X-Lite 优化的 Windows 版本旨在提升性能、隐私性、稳定性和可控制性,同时降低资源占用、提高响应速度,并且几乎能在任何 PC 上运行——无论新旧强弱。 但官网上各版本与镜像的展示逻辑,是交叉且毫无条理的,容易给人看懵,特在些说明如下:

    可下载的内容分11个部分

    1. Windows 10 Builds
    2. Windows 11 Builds
    3. Special Edition Builds
    4. Ultralight
    5. Barebone Builds
    6. x86 Builds
    7. Windows Update Packs
    8. Software
    9. Registry Tweaks
    10. Windows Subsystem For Android
    11. Wallpaper

    各版本之间的差异

    版本
    Ultralight 超精简版
    概述超精简版保留了运行大多数第三方应用和游戏所需的核心组件
    不支持
    • Windows Mail、Windows Calendar(邮件/日历)
    • BitLocker、Smart Card(加密/智能卡)
    • OneDrive、Defender(云存储/杀毒)
    • 备份与还原、语音、诊断、疑难解答
    • Windows 更新、可选功能(如 Hyper‑V、WSA、WSL2)
    • 此外,安装额外语言时可能遇到问题。
    支持
    • 台式机、笔记本、平板电脑
    • WLAN、蓝牙
    • 微软商店、UWP 应用
    • Xbox Game Pass、Xbox 手柄
    • 打印功能
    • 以及绝大多数第三方应用和游戏。
    包含镜像
    • ‘Micro 10’
    • ‘Neon Gamer’
    • ‘Micro 11 24H2’
    • ‘Micro 11 23H2’
    • ‘Micro 11 22H2’ SE
    • ‘Micro 11 22H2’
    • ‘Atomic 11’

    版本内部镜像差异

    Micro 10

    镜像
    ‘Micro 10’
    ‘Micro 10’ SE [x86]
    ‘Micro 10’ SE [x64]
    基础版本
    Windows 10 22H2 Pro (Build 19045.3324) AMD64
    Windows 10 22H2 Pro (Build 19045.3757) x86
    Windows 10 22H2 Pro (Build 19045.3757) x64
    版本说明
    • 这是我们首个基于 Windows 10 22H2 的超精简版!
    • 极致性能之选! 此版本基于 Windows 10 22H2,精简至核心,但仍保留了大多数用户需要的功能。它在隐私、性能、操控性、稳定性和外观风格方面为 Windows 带来了革新。
    • 默认启用按流量计费的连接。 我们强烈建议保持此设置开启。这意味着 Windows 不会自动为你的电脑下载驱动程序,因此,我们建议你直接从电脑制造商的官网下载驱动程序。
    • Windows 更新服务和 Windows 防火墙默认均为禁用状态,但你可以在“开始菜单” - “X-Lite 工具”文件夹中轻松启用它们。你需要启用 Windows 更新服务才能使用 Microsoft Store 和安装额外的语言包。
    • 我们的首个 Windows 10 22H2 x86 版本!
    • 极致性能之选!基于 Windows 10 22H2,此版本精简至核心,但仍保留了大多数用户需要的功能!并在隐私、性能、操控性、稳定性和风格方面为 Windows 带来革新。
    • 此版本基于原始的 Micro 10 版本,因此我们依赖 Micro 10 的原始演示视频来让你了解此版本的能力和所提供的体验。它之所以是一个特别版,是因为在主题、鼠标指针和壁纸方面进行了令人兴奋的全新改动,呈现出焕然一新的外观,如本页底部的截图所示。
    • Windows 更新服务和 Windows 防火墙默认禁用,但可以通过开始菜单 - X-Lite 工具文件夹轻松启用。你需要启用 Windows 更新服务才能使用 Microsoft Store 和安装额外的语言包。
    • 要在添加额外语言时获得完整的 Windows 设置翻译支持,请先开启 Windows 更新服务,确保按流量计费的连接已关闭,然后安装你需要的语言包,最后重启电脑以完成更改!
    • 此版本未预装 .NET Framework 3.5,且无法添加。它完全支持 .NET 4.8,并完全支持安装 .NET 桌面运行时 5、6、7、8 等。
    • 极致性能之选!基于 Windows 10 22H2,此版本精简至核心,但仍保留了大多数用户需要的功能!并在隐私、性能、操控性、稳定性和风格方面为 Windows 带来革新。
    • 此版本基于原始的 Micro 10 版本,因此我们依赖 Micro 10 的原始演示视频来让你了解此版本的能力和所提供的体验。它之所以是一个特别版,是因为在主题、鼠标指针和壁纸方面进行了令人兴奋的全新改动,呈现出焕然一新的外观,如本页底部的截图所示。
    • Windows 更新服务和 Windows 防火墙默认禁用,但可以通过开始菜单 - X-Lite 工具文件夹轻松启用。你需要启用 Windows 更新服务才能使用 Microsoft Store 和安装额外的语言包。
    • 要在添加额外语言时获得完整的 Windows 设置翻译支持,请先开启 Windows 更新服务,确保按流量计费的连接已关闭,然后安装你需要的语言包,最后重启电脑以完成更改!
    • 此版本未预装 .NET Framework 3.5,且无法添加。它完全支持 .NET 4.8,并完全支持安装 .NET 桌面运行时 5、6、7、8 等。
    亮点速览
    • 1.3GB ISO!
    • 2.5GB 安装后大小!
    • 虚拟内存默认启用!
    • 稳定性和性能提升!
    • 包含可选系统透明效果!
    • 为您的应用和游戏带来极致性能!
    • 已将 Intel RST 和 Serial IO 驱动集成到 Windows 安装程序中!
    • 完全支持 UWP 应用、Xbox、Microsoft Store 等!
    • 更新了框架、运行时库和桌面应用安装器!
    • 包含自定义主题、图标、壁纸等!
    • 包含 HEVC 解码器!(非 Windows 10 原生)
    • 额外的改进和优化!
    • 无预装 UWP 应用!
    • 包含 Microsoft Store 安装器!
    • 完全支持旧式 PC
    • 完全支持台式机、笔记本电脑和平板电脑
    • 完全支持额外语言包
    • 旨在为您的电脑注入新活力
    💥 旨在适用于所有电脑,无论新旧强弱,台式机还是笔记本电脑。
    • 869 MB ISO!
    • 1.5 GB 安装后大小!
    • 虚拟内存默认启用!
    • 稳定性和性能提升!
    • 包含可选系统透明效果!
    • 为您的应用和游戏带来极致性能!
    • 完全支持 UWP 应用、Microsoft Store 等!
    • 包含自定义主题、图标、壁纸、鼠标指针等!
    • 额外的改进和优化!
    • 包含 Microsoft Store 和截图工具!
    • 完全支持台式机、笔记本电脑和平板电脑
    • 完全支持额外语言包
    • 旨在为您的电脑注入新活力
    💥 旨在适用于所有电脑,无论新旧强弱,台式机还是笔记本电脑。
    • 1.2 GB ISO!
    • 2 GB 安装后大小!
    • 虚拟内存默认启用!
    • 稳定性和性能提升!
    • 包含可选系统透明效果!
    • 为您的应用和游戏带来极致性能!
    • 完全支持 UWP 应用、Microsoft Store 等!
    • 包含自定义主题、图标、壁纸、鼠标指针等!
    • 额外的改进和优化!
    • 包含 Microsoft Store 和截图工具!
    • 完全支持台式机、笔记本电脑和平板电脑
    • 完全支持额外语言包
    • 旨在为您的电脑注入新活力
    💥 旨在适用于所有电脑,无论新旧强弱,台式机还是笔记本电脑。
    已移除Cortana(小娜)、Smart Screen(智能屏幕筛选)、Edge 浏览器、UWP 应用、BitLocker(磁盘加密)、Hyper‑V、WSL2(Linux 子系统)、OneDrive、智能卡、Windows Defender、Windows 邮件、备份与还原、遥测、诊断、疑难解答、地图、可选功能支持(WSL2、Hyper‑V、沙盒等)、更新支持、组件存储、语音功能、语音唤醒、部分字体。Cortana、Smart Screen、Edge、UWP 应用、BitLocker、Hyper-V、WSL2、One Drive、智能卡、Windows Defender、Windows 邮件、备份和还原、遥测、诊断、疑难解答、地图、可选功能支持(WSL2、Hyper-V、沙盒等)、更新支持、组件存储、语音、语音唤醒、部分字体。Cortana、Smart Screen、Edge、UWP 应用、BitLocker、Hyper-V、WSL2、One Drive、智能卡、Windows Defender、Windows 邮件、备份和还原、遥测、诊断、疑难解答、地图、可选功能支持(WSL2、Hyper-V、沙盒等)、更新支持、组件存储、语音、语音唤醒、部分字体。
    已禁用错误报告、索引、UAC、广告、休眠、电源节流。错误报告、索引、UAC、广告、休眠、电源节流。错误报告、索引、UAC、广告、休眠、电源节流。
    已启用DirectPlay、.NET Framework 3.5、SMB1。DirectPlay、SMB1。DirectPlay、SMB1。
    性能优先——此版本旨在最大化性能、响应速度和资源节省。此版本旨在最大化性能、响应速度和资源节省。此版本旨在最大化性能、响应速度和资源节省。

    Windows x-lite

  2. PostgreSQL 频繁读写数据库的定期维护

    是的,频繁读写的 PostgreSQL 数据库绝对需要定期维护。这是保证数据库长期稳定运行、维持高性能和避免数据损坏的关键措施。

    🔧 必须的定期维护任务

    1. VACUUM 维护(最重要)

    -- 常规VACUUM(推荐每日执行)
    VACUUM ANALYZE;
    
    -- 针对特定表的VACUUM
    VACUUM ANALYZE your_busiest_table;
    
    -- 彻底的VACUUM(建议每周或每月)
    VACUUM FULL VERBOSE;
    

    2. ANALYZE 统计信息更新

    -- 更新统计信息(查询优化器需要)
    ANALYZE VERBOSE;
    
    -- 针对特定表
    ANALYZE VERBOSE your_busiest_table;
    

    3. 索引维护

    -- 重建碎片化严重的索引
    REINDEX INDEX your_index_name;
    REINDEX TABLE your_table_name;
    
    -- 并发重建(PostgreSQL 12+)
    REINDEX INDEX CONCURRENTLY your_index_name;
    

    📅 推荐维护计划

    每日维护

    -- 自动VACUUM通常足够,但可以补充
    VACUUM ANALYZE;
    

    每周维护

    -- 更彻底的维护
    VACUUM FULL ANALYZE;
    CHECKPOINT;
    

    每月维护

    -- 全面维护
    REINDEX DATABASE your_database;
    VACUUM FULL VERBOSE;
    ANALYZE VERBOSE;
    

    ⚙️ 自动化维护配置

    1. 调整 autovacuum 设置(postgresql.conf)

    # 针对频繁读写数据库的优化设置
    autovacuum = on
    autovacuum_vacuum_scale_factor = 0.1
    autovacuum_analyze_scale_factor = 0.05
    autovacuum_vacuum_cost_delay = 10ms
    autovacuum_vacuum_cost_limit = 1000
    

    2. 使用 pg_cron 扩展定时任务

    -- 安装pg_cron
    CREATE EXTENSION pg_cron;
    
    -- 每天凌晨3点执行VACUUM
    SELECT cron.schedule('0 3 * * *', 'VACUUM ANALYZE');
    
    -- 每周日凌晨2点执行维护
    SELECT cron.schedule('0 2 * * 0', 'VACUUM FULL ANALYZE');
    

    3. 操作系统定时任务(crontab)

    # 每天执行维护
    0 2 * * * psql -d your_db -c "VACUUM ANALYZE"
    
    # 每周执行全面维护
    0 3 * * 0 psql -d your_db -c "VACUUM FULL ANALYZE; REINDEX DATABASE your_db"
    

    📊 监控和维护检查

    1. 监控数据库状态

    -- 检查表膨胀情况
    SELECT schemaname, tablename, 
           n_dead_tup, n_live_tup,
           round(n_dead_tup::numeric/n_live_tup::numeric*100, 2) as dead_ratio
    FROM pg_stat_user_tables
    ORDER BY dead_ratio DESC;
    
    -- 检查索引状态
    SELECT schemaname, tablename, indexname,
           idx_scan, idx_tup_read, idx_tup_fetch
    FROM pg_stat_user_indexes;
    

    2. 检查 autovacuum 效果

    -- 查看autovacuum统计信息
    SELECT relname, last_vacuum, last_autovacuum, 
           last_analyze, last_autoanalyze
    FROM pg_stat_user_tables;
    

    🚨 维护注意事项

    1. 维护时间窗口:选择业务低峰期进行
    2. VACUUM FULL 谨慎使用:会锁表,影响业务
    3. 监控维护影响:使用 VERBOSE 选项查看详细情况
    4. 备份优先:重要维护前先备份数据

    🎯 针对频繁读写数据库的特殊维护

    -- 针对热点表增加维护频率
    ALTER TABLE your_busy_table SET (
        autovacuum_vacuum_scale_factor = 0.05,
        autovacuum_analyze_scale_factor = 0.02
    );
    
    -- 监控长事务和锁
    SELECT * FROM pg_locks WHERE granted = false;
    SELECT * FROM pg_stat_activity WHERE state <> 'idle';
    

    💡 维护最佳实践

    1. 定期检查:每周检查数据库状态
    2. 自动化:尽可能自动化维护任务
    3. 文档化:记录维护历史和问题
    4. 测试:在测试环境验证维护脚本
    5. 容量规划:定期评估存储增长趋势

    总结:对于频繁读写的 PostgreSQL 数据库,定期维护不是可选项,而是必需品。通过合理的维护计划,可以确保数据库的性能稳定性和数据完整性。

    postgresql database

  3. Debian 12 只安装VNC及i3桌面,就可以低成本的实现远程桌面环境

    安装

    # 安装通用工具
    apt-get install -y nano net-tools bzip2 procps apt-utils iputils-ping netcat-openbsd
    # 安装中文字体
    apt-get install -y locales fonts-wqy-microhei fonts-wqy-zenhei xfonts-wqy && \
        sed -i -e "s/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/" /etc/locale.gen && \
        locale-gen zh_CN.UTF-8 &&\
        update-locale LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh LC_ALL=zh_CN.UTF-8
    # 安装VNC
    apt-get install -y tigervnc-standalone-server
    # 安装i3桌面
    apt-get install -y i3-wm i3status i3blocks dmenu xfonts-base terminator dbus-x11 libdbus-glib-1-2 ; apt-get purge -y pm-utils *screensaver*
    
    apt-get clean
    

    配置i3桌面

    ~/.config/i3/config

    # This file has been auto-generated by i3-config-wizard(1).
    # It will not be overwritten, so edit it as you like.
    #
    # Should you change your keyboard layout some time, delete
    # this file and re-run i3-config-wizard(1).
    #
    
    # i3 config file (v4)
    #
    # Please see https://i3wm.org/docs/userguide.html for a complete reference!
    
    set $mod Mod1
    
    # Font for window titles. Will also be used by the bar unless a different font
    # is used in the bar {} block below.
    
    # This font is widely installed, provides lots of unicode glyphs, right-to-left
    # text rendering and scalability on retina/hidpi displays (thanks to pango).
    #font pango:DejaVu Sans Mono 8
    font pango:monospace 8
    
    # Start XDG autostart .desktop files using dex. See also
    # https://wiki.archlinux.org/index.php/XDG_Autostart
    # exec --no-startup-id dex --autostart --environment i3
    
    # The combination of xss-lock, nm-applet and pactl is a popular choice, so
    # they are included here as an example. Modify as you see fit.
    
    # xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
    # screen before suspend. Use loginctl lock-session to lock your screen.
    # exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
    
    # NetworkManager is the most popular way to manage wireless networks on Linux,
    # and nm-applet is a desktop environment-independent system tray GUI for it.
    # exec --no-startup-id nm-applet
    
    # Use pactl to adjust volume in PulseAudio.
    # set $refresh_i3status killall -SIGUSR1 i3status
    # bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
    # bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
    # bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
    # bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
    
    # Use Mouse+$mod to drag floating windows to their wanted position
    floating_modifier $mod
    
    # move tiling windows via drag & drop by left-clicking into the title bar,
    # or left-clicking anywhere into the window while holding the floating modifier.
    tiling_drag modifier titlebar
    
    # start a terminal
    bindsym $mod+Return exec i3-sensible-terminal
    
    # kill focused window
    bindsym $mod+Shift+q kill
    
    # start dmenu (a program launcher)
    bindsym $mod+d exec --no-startup-id dmenu_run
    # A more modern dmenu replacement is rofi:
    # bindcode $mod+40 exec "rofi -modi drun,run -show drun"
    # There also is i3-dmenu-desktop which only displays applications shipping a
    # .desktop file. It is a wrapper around dmenu, so you need that installed.
    # bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop
    
    # change focus
    bindsym $mod+j focus left
    bindsym $mod+k focus down
    bindsym $mod+l focus up
    bindsym $mod+semicolon focus right
    
    # alternatively, you can use the cursor keys:
    bindsym $mod+Left focus left
    bindsym $mod+Down focus down
    bindsym $mod+Up focus up
    bindsym $mod+Right focus right
    
    # move focused window
    bindsym $mod+Shift+j move left
    bindsym $mod+Shift+k move down
    bindsym $mod+Shift+l move up
    bindsym $mod+Shift+semicolon move right
    
    # alternatively, you can use the cursor keys:
    bindsym $mod+Shift+Left move left
    bindsym $mod+Shift+Down move down
    bindsym $mod+Shift+Up move up
    bindsym $mod+Shift+Right move right
    
    # split in horizontal orientation
    bindsym $mod+h split h
    
    # split in vertical orientation
    bindsym $mod+v split v
    
    # enter fullscreen mode for the focused container
    bindsym $mod+f fullscreen toggle
    
    # change container layout (stacked, tabbed, toggle split)
    bindsym $mod+s layout stacking
    bindsym $mod+w layout tabbed
    bindsym $mod+e layout toggle split
    
    # toggle tiling / floating
    bindsym $mod+Shift+space floating toggle
    
    # change focus between tiling / floating windows
    bindsym $mod+space focus mode_toggle
    
    # focus the parent container
    bindsym $mod+a focus parent
    
    # focus the child container
    #bindsym $mod+d focus child
    
    # Define names for default workspaces for which we configure key bindings later on.
    # We use variables to avoid repeating the names in multiple places.
    set $ws1 "1"
    set $ws2 "2"
    set $ws3 "3"
    set $ws4 "4"
    set $ws5 "5"
    set $ws6 "6"
    set $ws7 "7"
    set $ws8 "8"
    set $ws9 "9"
    set $ws10 "10"
    
    # switch to workspace
    bindsym $mod+1 workspace number $ws1
    bindsym $mod+2 workspace number $ws2
    bindsym $mod+3 workspace number $ws3
    bindsym $mod+4 workspace number $ws4
    bindsym $mod+5 workspace number $ws5
    bindsym $mod+6 workspace number $ws6
    bindsym $mod+7 workspace number $ws7
    bindsym $mod+8 workspace number $ws8
    bindsym $mod+9 workspace number $ws9
    bindsym $mod+0 workspace number $ws10
    
    # move focused container to workspace
    bindsym $mod+Shift+1 move container to workspace number $ws1
    bindsym $mod+Shift+2 move container to workspace number $ws2
    bindsym $mod+Shift+3 move container to workspace number $ws3
    bindsym $mod+Shift+4 move container to workspace number $ws4
    bindsym $mod+Shift+5 move container to workspace number $ws5
    bindsym $mod+Shift+6 move container to workspace number $ws6
    bindsym $mod+Shift+7 move container to workspace number $ws7
    bindsym $mod+Shift+8 move container to workspace number $ws8
    bindsym $mod+Shift+9 move container to workspace number $ws9
    bindsym $mod+Shift+0 move container to workspace number $ws10
    
    # reload the configuration file
    bindsym $mod+Shift+c reload
    # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
    bindsym $mod+Shift+r restart
    # exit i3 (logs you out of your X session)
    bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
    
    # resize window (you can also use the mouse for that)
    mode "resize" {
            # These bindings trigger as soon as you enter the resize mode
    
            # Pressing left will shrink the window’s width.
            # Pressing right will grow the window’s width.
            # Pressing up will shrink the window’s height.
            # Pressing down will grow the window’s height.
            bindsym j resize shrink width 10 px or 10 ppt
            bindsym k resize grow height 10 px or 10 ppt
            bindsym l resize shrink height 10 px or 10 ppt
            bindsym semicolon resize grow width 10 px or 10 ppt
    
            # same bindings, but for the arrow keys
            bindsym Left resize shrink width 10 px or 10 ppt
            bindsym Down resize grow height 10 px or 10 ppt
            bindsym Up resize shrink height 10 px or 10 ppt
            bindsym Right resize grow width 10 px or 10 ppt
    
            # back to normal: Enter or Escape or $mod+r
            bindsym Return mode "default"
            bindsym Escape mode "default"
            bindsym $mod+r mode "default"
    }
    
    bindsym $mod+r mode "resize"
    
    # Start i3bar to display a workspace bar (plus the system information i3status
    # finds out, if available)
    bar {
            status_command i3status -c $HOME/.config/i3/status.conf
    }
    
    # exec_always $HOME/chrome-startup
    

    ~/.config/i3/status.conf

    linux vnc tigerVNC i3 debian

  4. 安装

    apt update
    # 安装 Podman & podman-compose
    apt install -y podman podman-compose iptables # iptables必须安装,否则netavark无法运行
    
    # 验证安装
    podman version ; podman-compose version
    # 防火墙一定要加这条,否则容器之间的名称解析无法工作
    iptables -A INPUT -p udp -m udp --dport 53 -j ACCEPT
    # 测试podman是否安装成功
    podman run --rm hello-world
    

    配置

    # 配置国内镜像源
    sed -E -i.bak \
        -e 's/^# (unqualified-search-registries = ).+$/\1["docker.io"]/' \
        -e 's/^# (\[\[registry\]\])$/\1/' \
        -e 's/^# (prefix = ).+"$/\1"docker.io"/' \
        -e '0,\/^# (location = ).+"$/s//\1"docker.1ms.run"/' \
        -e '0,\/^# (\[\[registry.mirror\]\])$/s//\1/' \
        -e '0,\/^# (location = ).*"$/s//\1"registry.cn-hangzhou.aliyuncs.com"/' \
        /etc/containers/registries.conf
    
    # nano /etc/containers/registries.conf
    unqualified-search-registries = ["docker.io"]
    
    [[registry]]
    prefix = "docker.io"
    location = "docker.1ms.run"
    
    [[registry.mirror]]
    location = "registry.cn-hangzhou.aliyuncs.com"  # 可选备用
    

    其实命令与Docker一致,非常方便好用。

    linux podman container

    1. 安装 OpenSSH 客户端
    # 检查是否已安装 OpenSSH 客户端
    > Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Client*'
    
    # 安装 OpenSSH 客户端
    > Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
    
    # 验证安装
    > ssh -V
    
    1. 安装 OpenSSH 服务器
    # 检查是否已安装 OpenSSH 服务器
    > Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server*'
    
    # 安装 OpenSSH 服务器
    > Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
    
    # 启动 SSH 服务并设置为自动启动
    > Start-Service sshd
    > Set-Service -Name sshd -StartupType Automatic
    
    # 检查服务状态
    > Get-Service sshd
    # 重启服务
    > Restart-Service sshd
    
    1. 配置防火墙(允许 SSH 端口 22)
    # 允许入站 SSH 连接
    > New-NetFirewallRule -Name "OpenSSH-Server" -DisplayName "OpenSSH Server (sshd)" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
    

    windows openssh

  5. 安装

    Windows

    1. 下载

    推荐使用 PowerShell1

    # 下载并安装 VC++ Redistributable,需要管理员模式
    Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile "$env:TEMP\vc_redist.x64.exe"
    Start-Process -Wait -FilePath "$env:TEMP\vc_redist.x64.exe" -ArgumentList "/install", "/quiet", "/norestart"
    # 下载micromamba
    Invoke-Webrequest -URI https://micro.mamba.pm/api/micromamba/win-64/latest -OutFile micromamba.tar.bz2
    # 使用7z解压
    & "C:\Program Files\7-Zip\7z.exe" x "micromamba.tar.bz2" -o"tmp"
    # 使用tar解压,系统内置不用安装
    mkdir micromamba
    tar -xvf .\tmp\micromamba.tar -C .\micromamba\
    .\micromamba\Library\bin\micromamba.exe --help
    # 查看输出
    

    2. 安装2

    .\micromamba\Library\bin\micromamba.exe shell init -s powershell -r C:\Your\Root\Prefix
    

    默认位置为 $HOME/micromamba,也就是 C:\Users\username\micromamba 。

    同时会在 PowerShell 的 Profile 文件中(相当于 Bash 的 .bashrc)添加以下代码,保证每次启动 PowerShell 时,都会自动初始化 Micromamba 。

    $HOME/Documents/WindowsPowerShell/profile.ps1

    #region mamba initialize
    # !! Contents within this block are managed by 'mamba shell init' !!
    $Env:MAMBA_ROOT_PREFIX = "C:\Users\username\micromamba"
    $Env:MAMBA_EXE = "C:\Users\username\micromamba\Library\bin\micromamba.exe"
    (& $Env:MAMBA_EXE 'shell' 'hook' -s 'powershell' -p $Env:MAMBA_ROOT_PREFIX) | Out-String | Invoke-Expression
    #endregion
    

    加入设置 micromamba 别名的命令。 设置别名后,即方便使用,也可配合 VSCode 的配置,实现自动启动开发环境。

    micromamba python windows

    Post activity