安装Ubuntu服务器版 + 远程连接ssh +更换阿里云源

时间:2024-02-17 16:23:35

安装Ubuntu服务器版

  1、点击 “开启此虚拟机”,开始安装。

  

  2、默认选择English,英文版安装,直接按Enter键即可。

  

  3、默认选择“Install Ubuntu Server”,安装ubuntu服务器版。

  

  4、继续默认项“English”

  

  5、国家或地区我们选择  “Other”--> "Asia" --> "China"

  

  

  

  6、继续默认项

  

  7、是否检测键盘布局,我们选择“No”

   

  8、键盘布局所属国家:English  ;键盘布局:English  。两项都是默认即可。

  

  

  9、设置主机名字,根据自己的需要来,然后按“↓”选择“Continue”,继续。

   

  10、创建新用户:输入新用户全名(注意:不是登录账号,相当于描述)

  

  11、设置账户名(该账户名是用来登录的),我默认和上一项一致。

  

  12、设置密码和再次填入密码

  

  

  13、是否使用强度弱的密码,我选择“Yes”

  

  14、是否加密主目录,选择“No”

  

  15、时区是否正确,这里显示的事哈尔滨,我们先选择“Yes”。系统安装好之后我们可以更改为上海。

  

  16、磁盘分区,默认为第二个选项,但为了简单省事,我选择了第一个

  

  17、选择分区,这里只有一个,我们选择默认即可。

  

  18、是否将变更写入硬盘,我们选择“Yes”

  

  19、“如果您需要用HTTP代理来链接外部网咯,请在这里输入代理的信息。否则,请置空。”

          这里我置空,然后继续。

  

  20、稍等片刻之后,出现下面界面,选择更新方式,我们选择不自动更新

  

  21、我选择把OpenSSH server安装上,按空格选中,然后按“Enter”键确认继续

  

  22、将GRUB安装至硬盘?我们默认选择“Yes”

  

  23、默认继续,系统会自动重启,然后进入登录界面。

   

  24、登录界面,至此,Ubuntu服务器版基本安装完成。

  

 

更换阿里云的源  下载会快一些:

  

修改阿里源为Ubuntu 18.04默认的源

备份/etc/apt/sources.list
#备份
cp /etc/apt/sources.list /etc/apt/sources.list.bak

在/etc/apt/sources.list文件前面添加如下条目
#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb 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 main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

最后执行如下命令更新源
##更新
sudo apt-get update
sudo apt-get upgrade

另外其他几个国内源如下:
中科大源
##中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

163源
##163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

清华源
##清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

 

Ubuntu 默认不提供ssh服务:

    也就是说无法用 Xshell 连接

1、安装ssh服务
sudo apt-get install openssh-server

2、修改配置文件
sudo vi /etc/ssh/sshd_config
#PermitRootLogin without-password #注释掉这行
PermitRootLogin yes #增加这行

#重启服务
/etc/init.d/ssh restart