Ubuntu18.04系统优化

Posted Jeffry Jiang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu18.04系统优化相关的知识,希望对你有一定的参考价值。

一、YUM源优化

更新yum源,提高软件下载速度,参考以下国内yum源:

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ #清华源
http://mirrors.aliyun.com/ubuntu #阿里源

配置yum源,在做配置之前先做备份:

root@jzyue:~# cp /etc/apt/sources.list /etc/apt/sources.listbak
cat >>/etc/apt/sources.list<<EOF
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
EOF
root@jzyue:~# sudo apt-get update

二、安装常用软件

sudo apt install -y git openssh-server net-tools vim lrzsz wget tree screen lsof tcpdump sysstat net-tools bash-completion

三、允许root登录

root@jzyue:~# sudo vi /etc/ssh/sshd_config
将PermitRootLogin prohibit-password修改为:
PermitRootLogin yes
默认为22端口,可以在Port 22这里修改远程登录端口号
root@jzyue:~# systemctl restart sshd
root@jzyue:~# passwd root  #设置root登录密码
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

四、关闭防火墙

sudo ufw disable   # 关闭防火墙
sudo ufw enable     # 开启防火墙
sudo ufw status     # 查看防火墙当前状态

五、配置IP地址

sudo vim /etc/netplan/00-installer-config.yaml
network:
  ethernets:
    ens33:              
      addresses:
      - 192.168.1.10/24
      gateway4: 192.168.1.254
      nameservers:
        addresses:
        - 223.5.5.5
        search:
        - 223.6.6.6
    ens34:
      addresses:
      - 172.16.1.10/24   
      nameservers:
        addresses:
        - 223.5.5.5
        search: []
  version: 2
  sudo netplan apply   #配置生效

以上是关于Ubuntu18.04系统优化的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu18.04系统优化

Ubuntu18.04系统优化

史上最良心的 Ubuntu desktop 美化优化指导(2)

ubuntu18.04使用前的优化事项

Ubuntu18.04安装教程

ubuntu20.04优化指南