安装Ubuntu18.04并配置ssh服务
- 打开终端界面
- 切换到root用户
- 提示:输入密码是隐藏的,并不会显示,实际是输入了的
运行以下代码切换到root:
sudo su
一.解决Ubuntu终端无法复制粘贴的问题
- 卸载已有工具
- 安装工具open-vm-tools
- 安装open-vm-tools-desktop
- 重启
逐行运行以下命令并重启:
sudo apt-get autoremove open-vm-tools
sudo apt-get install open-vm-tools
sudo apt-get install open-vm-tools-desktop
二.更新国内源
- 备份原来的源,文件名改为init_sources.list
- 更换新的源
逐行运行以下命令:
sudo cp /etc/apt/sources.list /etc/apt/init_sources.list
sudo gedit /etc/apt/sources.list
- 将原来的内容全部删除,将以下内容复制粘贴进去(阿里源18.04)
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 update
sudo apt-get -f install
sudo apt-get upgrade
三.安装vim和ssh服务
- 安装vim
- 安装ssh服务器
- 配置ssh客户端,去掉PasswordAuthentication yes前面的#号,保存退出
- 提示:有关vim操作命令可以自行查阅
逐行运行以下命令:
sudo apt install vim
sudo apt install openssh-server
sudo vi /etc/ssh/ssh_config
操作如图:
- 启动ssh服务:
sudo /etc/init.d/ssh start
如图:
四.查看本机地址并通过Xshell远程连接
- 安装ifconfig
- 查看本机地址
逐行运行以下命令:
sudo apt install net-tools
ifconfig
- Xshell远程连接:
输入主机地址(上面查到的):
用户名和密码:(用root会连接不上)
连接成功:
标签:universe,安装,sudo,apt,ssh,aliyun,ubuntu,Ubuntu18.04,multiverse From: https://www.cnblogs.com/tuaisen/p/16973607.html