SSH 远程访问

把密钥从本机(windows)拷贝到远程机

  1. cat ~/.ssh/id_rsa.pub | ssh dev@192.168.1.113 "cat >> ~/.ssh/authorized_keys"

Linux 或 MacOS用户直接使用 ssh-copy-id

  1. ssh-copy-id -i ~/.ssh/id_rsa.pub dev@192.168.1.113

root 远程访问

Debian系默认禁止以root用户的身份通过ssh远程访问,我们自然不需要考虑这种安全问题。

  1. sudo vim /etc/ssh/sshd_config

PermitRootLogin注释去掉,改为yes

  1. PermitRootLogin yes
  1. systemctl restart ssh

Docker

https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/

oh-my-zsh

安装

  1. 安装zsh

    1. sudo apt install zsh -y
  2. 下载oh-my-zsh GitHub安装包

    1. sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

    码云 wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh 编辑install.sh,改成 REPO=${REPO:-mirrors/oh-my-zsh} REMOTE=${REMOTE:-https://gitee.com/${REPO}.git} 编辑后保存, 运行安装即可. (运行前先给install.sh权限)

插件

  1. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  2. git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

starship

  1. curl -fsSL https://starship.rs/install.sh | bash

autojump

  1. sudo apt install autojump

修改~/.zshrc

  1. plugins=(
  2. zsh-syntax-highlighting
  3. zsh-autosuggestions
  4. git
  5. extract
  6. autojump
  7. )

启用starship文件末尾:

  1. eval "$(starship init zsh)"

卸载oh-my-zsh

执行下面命令,重启终端

  1. uninstall_oh_my_zsh

取消合盖休眠

笔记本会合盖睡眠,为了能够长期稳定运行,关闭合盖睡眠功能。
配置盖子电源设置:

  1. 打开/etc/systemd/logind.conf文件进行编辑。
  2. 将该行更改为以下所需的设置之一:

    • HandleLidSwitch=poweroff 关闭盖子时关闭计算机
    • HandleLidSwitch=hibernate 在合上盖子时到休眠计算机
    • HandleLidSwitch=suspend 关闭盖子时暂停计算机
    • HandleLidSwitch=ignore 不执行任何操作
      1. HandleLidSwitch=ignore
  3. 保存文件,然后重新启动服务应用更改

    1. systemctl restart systemd-logind

    Not Recommend

    下面这种方式会导致服务器自动在 /var/log/auth.log 写入大量日志,塞满空间,禁止使用🙅‍

    1. sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.targethibernate.target hybrid-sleep.target

    禁用Nvidia显卡

    1. sudo vim /etc/default/grub

    GRUB_CMDLINE_LINUX_DEFAULT最后添加nouveau.modeset=0

    1. GRUB_CMDLINE_LINUX_DEFAULT="nouveau.modeset=0"

    执行以下命令:

    1. sudo update-grub
    2. sudo apt-get purge nvidia*
    3. sudo reboot

    虚拟显示器

    1. sudo apt-get install xserver-xorg-core-hwe-18.04
    2. sudo apt-get install xserver-xorg-video-dummy-hwe-18.04 --fix-missing
    1. sudo vim /usr/share/X11/xorg.conf.d/xorg.conf
    1. Section "Monitor"
    2. Identifier "Monitor0"
    3. HorizSync 28.0-80.0
    4. VertRefresh 48.0-75.0
    5. # https://arachnoid.com/modelines/
    6. # 1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz
    7. Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
    8. EndSection
    9. Section "Device"
    10. Identifier "Card0"
    11. Driver "dummy"
    12. VideoRam 256000
    13. EndSection
    14. Section "Screen"
    15. DefaultDepth 24
    16. Identifier "Screen0"
    17. Device "Card0"
    18. Monitor "Monitor0"
    19. SubSection "Display"
    20. Depth 24
    21. Modes "1920x1080_60.00"
    22. EndSubSection
    23. EndSection