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