分类: Linux

国内机 DD 脚本

文本主要备份Linux DD系统脚本, 方便后续使用

引用

https://git.beta.gs/
https://www.hostloc.com/thread-779358-1-1.html
https://gist.github.com/i-sync/1fb1c3d105abda353ba688b6db3992dc

话不多说直接上

#Debian/Ubuntu:
sudo apt-get update && sudo apt-get install -y xz-utils openssl gawk file net-tools

#RedHat/CentOS:
yum update && yum install -y xz openssl gawk file net-tools


wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && chmod a+x InstallNET.sh


#使用方法
bash InstallNET.sh
-d/--debian [dist-name] #发行版本代号
-u/--ubuntu [dist-name] #发行版本代号
-c/--centos [dist-version] #发行版本代号
-v/--ver [32/i386|64/amd64] 版本号
--ip-addr/--ip-gate/--ip-mask #自定义IP、网关、掩码
-apt/-yum/--mirror
-dd/--image #使用定义镜像
-a/-m  #a是自动安装。如果不指定或者指定为 m 则需要去 VNC 手动安装


sudo bash InstallNET.sh -u 18.04 -v 64 -a --mirror 'https://mirrors.163.com/ubuntu/'
sudo bash InstallNET.sh -u 18.04 -v 64 -a --mirror 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu'

sudo bash InstallNET.sh -u 18.04 -v 64 -a --mirror 'https://mirrors.ustc.edu.cn/ubuntu'
sudo bash InstallNET.sh -u 18.04 -v 64 -a --ip-addr 10.0.8.16 --ip-gate 10.0.8.1 --ip-mask 255.255.252.0 --mirror 'https://mirrors.ustc.edu.cn/ubuntu'

继续阅读

SSHD 启用密钥登录

文本仅做简单记录

  • 首先在服务器上生成密钥和公钥, 使用ssh-keygen, 默认会在~/.ssh目录下生成两个文件 id_rsa(密钥), id_rsa.pub(公钥)
  • 复制id_rsa.pub为authorized_keys
  • 修改/etc/ssh/sshd_config配置文件
PubkeyAuthentication yes
#AuthorizedKeysFile     .ssh/authorized_keys .ssh/authorized_keys2


最后可以禁止密码登录,首先确保密钥登录成功
#PasswordAuthentication no
  • 把id_ras复制到客户端,linux 直接使用 ssh -i 参数指定密钥, windows, xshell, 选择验证方式PublishKey, 然后导入id_rsa密钥即可。

继续阅读

Viagle Blog

欢迎来到我的个人博客网站