Ubuntu新装机后需要做的几件事情


如果新装了一个Ubuntu系统,记录下一些配置项有必要弄得。

首先确保网络是通的。可以ping www.baidu.com试试看

默认的root是没有设置密码,需要我们设置。

sudo passwd root
直接设置即可。
修改普通用户密码
sudo passwd 用户名
修改完重启登录即可。

更换源镜像

懒可以直接备份然后替换/etc/apt/sources.list

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/  bionic universe
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic universe
deb http://mirrors.aliyun.com/ubuntu/  bionic-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/  bionic multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic multiverse
deb http://mirrors.aliyun.com/ubuntu/  bionic-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/  bionic-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://mirrors.aliyun.com/ubuntu/  bionic-security main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu/  bionic-security universe
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic-security universe
deb http://mirrors.aliyun.com/ubuntu/  bionic-security multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic-security multiverse

 更新源数据

 apt update

一、升级本机所有已安装的软件包

 apt upgrade

二、安装必要的插件

apt-get install iproute2  ntpdate  tcpdump telnet traceroute nfs-kernel-server nfs-common  
lrzsz tree  openssl libssl-dev libpcre3 libpcre3-dev zlib1g-dev gcc openssh-server iotop unzip zip ipmitool -y

三、开启远程连接并允许root账户直接登录

需要注意的是必须安装上面的插件openssl-server才可以使用远程控制

vim /etc/ssh/sshd_config 
修改下面的选项为yes

PermitRootLogin yes

修改完之后重启服务就可以了。

systemctl restart sshd