坚持
  • 微信

当前位置:首页 > 应用服务 > LINUX系统 >

debian安装后的配置

作者:管理员 时间:2022-12-09 阅读数: 1652人阅读

    2020年12月08日,CentOS官方宣布了停止维护CentOS Linux的计划,并推出了CentOS Stream项目。截止目前Centos 8已经停止更新并停止维护,Centos 7也将于2024年6月30日停止维护。CentOS Stream是一个滚动升级的版本,而不是Red Hat Enterprise Linux的复刻版本,无法保障系统稳定性与兼容性,而如果应用于生产环境,则对于系统的稳定性有很高的要求,故使用CentOS Stream在生产环境替换Centos不可取。debian是比较好的一个替代品。

    debian安装教程网上很多,这里略。

    debian安装后配置:

    1.root远程登录禁止(一般默认禁止,但是一些服务器厂商默认安装的系统会开启)

    nano /etc/ssh/sshd_config

        修改配置内容

    PermitRootLogin no
    ······
    PasswordAuthentication yes

        之后,重启 service sshd restart

    2.更换apt源,这个方案就是直接在sources.list文件里边改,打开sources.list文件(这里使用清华大学的,网上源很多,自行选择)。

    nano /etc/apt/sources.list

    1.png

    将红圈下方的内容拷贝到sources.list中,之后 apt update 更新下。

    3.安装vim和bash-completion,没有vim真的好不习惯。

    apt install vim bash-completion

    4.安装自动对时

    安装chrony

    apt install -y chrony

    编辑chrongy.config

 vim /etc/chrony/chrony.con

    更换为阿里云源

    # Use Debian vendor zone.
    pool ntp.alivun.com iburst

    设置开机引导

    systemctl enable chrony

    重启服务

    systemctl restart chrony

    设置对时

    timedatectl set-ntp true

    5.设置ip及DNS

    vim /etc/network/interfaces

    设置静态ip

    auto ens32
    allow-hotplug ens32 //ens32网卡名称
    iface ens32 inet static
    address 192.168.213.130
    netmask 255.255.255.0
    gateway 192.168.213.254

    设置DNS

    vim /etc/resolv.conf

    配置文件

    domain localdomain
    search localdomain
    nameserver 8.8.8.8 # 设置默认dns
    nameserver 114.114.114.114 # 设置备用dns

    重启网络

    systemctl restart networking && reboot

    6.更新系统

    apt upgrade