Ubuntu18.04手册学习笔记第1篇-更换源、安装ssh服务、root密码初始化

1.安装ssh服务

sudo apt-get install ssh

2.更换源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo rm -Rf /etc/apt/sources.list
sudo vi /etc/apt/sources.list

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-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed 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

sudo apt-get -y install update
sudo apt-get -y install upgrade

3.root密码初始化

刚安装的ubuntu系统默认是无法使用root用户登录的,只能使用安装系统时设置的普通用户登录,虽然该普通用户结合sudo命令具有了root的大部分权限,但是有些时候我们需要root用户来执行一些操作,那么就需要切换至root用户的,但刚安装的系统root是无密码的,我们需要为其设置密码
sudo passwd root设置密码
su root切换到root
su tengwang切换至普通用户
最后强烈建议使用普通用户进行操作