美文网首页
Ubuntu16.04 Server 安装后的基本设置

Ubuntu16.04 Server 安装后的基本设置

作者: asfuyao | 来源:发表于2018-10-07 21:11 被阅读0次

    一、修改网卡名

    1. 编辑接口配置文件,添加参数

    sudo vi /etc/default/grub
    

    修改前

    GRUB_CMDLINE_LINUX=""
    

    修改后

    GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
    

    2. 更新grub

    sudo update-grub
    

    若提示没有此命令,请先输入安装命令

    sudo apt-get install grub2-common
    

    3. 修改网卡名称并设置固定IP地址

    修改网卡接口配置文件

    sudo vi /etc/network/interfaces
    

    修改前(网卡名不同机器会不一样,请根据实际情况修改)

    # The primary network interface
    auto eno13
    iface eno13 inet dhcp
    

    修改后

    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 192.168.91.11
    netmask 255.255.255.0
    gateway 192.168.91.1
    dns-nameservers 192.168.91.1
    

    4.更换源为阿里源

    备份源文件

    sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
    

    新建配置文件

     sudo vi /etc/apt/sources.list
    

    添加如下内容

    deb-src http://archive.ubuntu.com/ubuntu xenial main restricted
    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    deb http://archive.canonical.com/ubuntu xenial partner
    deb-src http://archive.canonical.com/ubuntu xenial partner
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
    

    5. 搞定,重启系统后生效

    相关文章

      网友评论

          本文标题:Ubuntu16.04 Server 安装后的基本设置

          本文链接:https://www.haomeiwen.com/subject/qsrraftx.html