#!/bin/bash
# 启用root登录
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
systemctl restart sshd
# 个性化设置
echo "alias ll='ls -l'" >> /root/.bashrc && source /root/.bashrc
# 静态ip
cat > /etc/network/interfaces << EOF
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug ens18
iface ens18 inet static
address 192.168.2.100
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameservers 8.8.8.8 114.114.114.114
chmod +x /usr/local/bin/docker-compose
# 替换清华源
cat > /etc/apt/sources.list<< EOF
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware
# deb-src https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.aliyun.com/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://mirrors.aliyun.com/debian-security bookworm-security main contrib non-free non-free-firmware
# deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# # deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
EOF
# 更新包列表和升级已安装的软件包
apt update -y && apt upgrade -y
# 安装常用软件
apt install -y vim sudo net-tools curl unzip zip tmux wget zsh lrzsz
# 安装docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# 安装docker-compose
wget https://github.com/docker/compose/releases/latest/download/docker-compose-Linux-x86_64
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
echo "alias dc='docker-compose'" >> /root/.bashrc && source /root/.bashrc
网卡配置文件路径 /etc/network/interfaces
动态ip配置
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug ens18
iface ens18 inet dhcp
静态ip配置
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug ens18
iface ens18 inet static
address 192.168.2.100
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameservers 8.8.8.8 114.114.114.114
```a
标签:network,bashrc,interfaces,etc,debian12,root,ens18
From: https://www.cnblogs.com/ppmdz/p/18258635