Ubuntu18系统安装及初始化(SSH服务、网络配置)
1.Ubuntu18.04系统安装(物理机)
1.1 镜像下载
官方镜像下载地址:https://releases.ubuntu.com/
本次安装采用操作系统镜像为:Ubuntu 18.04.6 LTS
1.2 系统启动盘制作
U盘:8G以上U盘,格式为NTFS(FAT32文件系统能够保存的文件最大不能超过4GB)
U盘启动盘制作工具:deepin-boot-maker
deepin-boot-maker下载地址为:https://www.onlinedown.net/soft/10036325.htm
傻瓜式制作过程就省略了…
1.3 BIOS设置
进入BIOS设置主要按键有:DEL, ESC, F1, F2, F8, F9, F10, F12,不同品牌的主机进入BIOS的按键不同,可以自行百度。
将第一启动项改成U盘,保存退出
1.4 常见问题及解决方式
引导方式错误(ERROR: BIOS/LEGACY BOOT OF UEFI-ONLY MEDIA)
解决方式其实已经在界面上标明了:
方式一:在BIOS设置中,将legacy引导切换为UEFI引导。在BIOS中,UEFI和legacy support是两种不同的引导方式,UEFI是新式的BIOS,legacy是传统BIOS,二者可以切换。
方式二:将U盘分区方式改成MBR。
2.Ubuntu18系统初始化设置
1.初始化root用户密码并切换root用户
输入命令sudo passwd
即可设置密码。
设置完成后,输入su root
输入密码,即可切换用户。
2.安装并配置vim和SSH服务
1.安装vim:sudo apt install vim
2.安装SSH服务:sudo apt install openssh-server
3.修改配置文件:sudo vi /etc/ssh/ssh_config
4.允许root用户ssh连接:
修改配置文件的权限:sudo chmod 777 /etc/ssh/sshd_config
修改配置文件:sudo vim /etc/ssh/sshd_config
将PermitRootLogin字段修改为yes即可
PermitRootLogin yes
5.启动ssh服务:sudo /etc/init.d/ssh start
6.检测ssh服务是否启动:ps -e | grep ssh
7.去其他主机远程登录即可
3.解决Ubuntu18终端无法复制粘贴的问题
逐行运行以下命令并重启:
卸载已有工具:sudo apt-get autoremove open-vm-tools
安装open-vm-tools工具:sudo apt-get install open-vm-tools
安装open-vm-tools-desktop:sudo apt-get install open-vm-tools-desktop
4.网络配置
4.1网络源配置
1.备份配置文件:sudo cp /etc/apt/sources.list /etc/apt/init_sources.list
2.修改权限:chmod 777 /etc/apt/sources.list
3.修改内容:vi /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
#华为源地址
deb https://repo.huaweicloud.com/ubuntu/ focal main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal-updates main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal universe
deb https://repo.huaweicloud.com/ubuntu/ focal-updates universe
deb https://repo.huaweicloud.com/ubuntu/ focal-backports main restricted universe
deb https://repo.huaweicloud.com/ubuntu/ focal-security main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal-security universe
#中科大源地址
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
#清华源地址
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 ultiverse
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 ultiverse
4.更新系统软件源地址:apt-get update
4.2 静态ip设置(通过图形界面配置)
1.搜索网络选项
2.配置静态网络
配置完成后,点击保存即可
4.2 静态ip设置(通过命令行配置)
1.安装net-tools网络管理工具:sudo apt install net-tools
2.输入ifconfig
命令查看有ip地址的那个网卡的名称
3.查看netplan管理network的配置文件:ls /etc/netplan/
一般都是01-network-manager-all.yaml文件
4.修改ip配置信息:sudo vi /etc/netplan/01-network-manager-all.yaml
输入以下内容:
5.重启网络或主机,检查网络状态
重启网络:netplan apply
有时候重启网络生效比较慢或者无效,这时需要重启主机:sudo reboot
检查ip是否是想要的静态ip:ifconfig
检查dns配置是否可用:ping www.baidu.com
至此,Ubuntu18.04初始化配置完成。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/80082.html