vi pve-init.sh

    1. #!/bin/bash
    2. # proxmox安装后的初始化操作脚本
    3. # 时间同步服务和镜像仓库地址
    4. address=192.100.3.221
    5. # 修改vi配置文件
    6. sed -ri "/^set compatible$/a""set backspace=2" /etc/vim/vimrc.tiny
    7. sed -ri "s/^set compatible$/set nocompatible/g" /etc/vim/vimrc.tiny
    8. # 配置ls命令别名
    9. sed -ri "s/^# (export LS_OP*)/\1/g" /root/.bashrc
    10. sed -ri "s/^# (alias ls=*)/\1/g" /root/.bashrc
    11. sed -ri "s/^# (alias ll=*)/\1/g" /root/.bashrc
    12. # 配置镜像仓库
    13. sed -ri "s/^(deb*)/#\1/g" /etc/apt/sources.list
    14. sed -ri 1a"deb http://${address}/debian buster main contrib" /etc/apt/sources.list
    15. sed -ri "s/^(deb*)/#\1/g" /etc/apt/sources.list.d/pve-enterprise.list
    16. sed -ri 1a"deb http://${address}/proxmox/debian buster pve-no-subscription" /etc/apt/sources.list.d/pve-enterprise.list
    17. # 配置hosts
    18. sed -ri "$"a"${address} download.proxmox.com" /etc/hosts
    19. # 配置时间同步服务器
    20. sed -ri "s/^#NTP*/NTP=${address}/g" /etc/systemd/timesyncd.conf
    21. systemctl restart systemd-timesyncd
    22. # 安装vim
    23. apt update
    24. apt install vim -y