设置domain,设置root密码,新建个人用户密码,选择磁盘分区
https://baijiahao.baidu.com/s?id=1708807586627855693&wfr=spider&for=pc
初始化机器
1、允许root远程登录
方法1、修改sshd配置文件,使root可以远程登录 vim /etc/ssh/sshd_config 找到并用#注释掉这行:PermitRootLogin prohibit-password 新建一行 添加:PermitRootLogin yes
方法2、脚本操作 echo "PermitRootLogin yes" >> /etc/ssh/sshd_config systemctl restart sshd
2、修改网卡名称(重启动作可以和下一步可以合并执行)
将/etc/default/grub文件里面 初始值 GRUB_CMDLINE_LINUX="" 修改后 GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0" 修改/dev/network/interfaces,将网卡名称ens18改为eth0 sed -i 's/ens18/eth0/g' /etc/network/interfaces 更新grub,重新生成/boot/grub/grub.cfg update-grub 重启,查看是否生效 reboot ip a
3、修改内核启动信息(重启动作可以和上一步可以合并执行)
echo 'GRUB_CMDLINE_LINUX_DEFAULT="systemd.unified_cgroup_hierarchy=0"' >> /etc/default/grub grub-mkconfig -o /boot/grub/grub.cfg 重启,查看是否生效 reboot
4、ip地址dhcp修改为静态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/* auto eth0 iface lo inet loopback allow-hotplug eth0 iface eth0 inet static address 192.167.1.107 netmask 255.255.255.0 gateway 192.168.1.1 EOF
5、修改dns
cat >> /etc/resolv.conf <<EOF nameserver 119.29.29.29 nameserver 223.5.5.5 EOF
三、安装常用软件(注意这里是debian11的源,需要对应修改为Debian10的源)
cat > /etc/apt/sources.list <<EOF deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main deb http://security.debian.org/debian-security bullseye-securitymain deb-src http://securitu.debian.org/debian-security bullseye-securitymain deb htto://mirrors.tuna.tsinghua.edu.cr/debian/ bullseue-undatesmain deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/bullseue-updates main EOF
cat > /etc/apt/sources.list <<EOF deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main deb http://security.debian.org/debian-security bullseye-securitymain deb-src http://securitu.debian.org/debian-security bullseye-securitymain deb htto://mirrors.tuna.tsinghua.edu.cr/debian/ bullseue-undatesmain deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/bullseue-updates main EOF
apt-get udpate apt-get install -y procps vim procps net-tools gcc screen lrzsz wget curl unzip zip dos2unix \ lvm2 rsync git telnet tree nmap nfs-common bash-completion ntpdate iptables ipvsadm
3、修改时区
apt-get reinstall tzdata ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
4、添加定时任务同步时间
*/10 * * * * /usr/sbin/ntpdate ntp1.aliyun.com
也可以开启时间同步服务器
5、关闭swap
swapoff -a
注释/etc/fstab 相关swap
6、修改主机名
hostnamectl --static set-hostname debian-template
7、重启机器
reboot
-
« 上一篇:
升级指定内核版本
-
deiban11安装kubernetes
:下一篇 »