Ubantu19.04的安装过程以及基本配置
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.安装Ubantu详细过程
1>.选择默认的英文安装,回车即可
2>.选择第一个,回车即可
3>.默认使用英语,回车即可
4>.选择国家(ubantu有点恶心,竟然没有把我们中华人民共和国列在上面,咱们选择其它)
5>.选择亚洲
6>.选择中国
7>.选择字符集为"uft-8",回车即可
8>.不要做键盘检查,浪费时间,选择"no",直接回车即可
9>.继续使用英语
10>.键盘布局咱们也选择英语,默认即可
11>.等待他自动安装一些服务
12>.自定义主机名
13>.自定义用户全名
14>.自定义系统用户
15>.输入上一步创建用户的口令
16>.再次输入创建用户的口令
17>.使用默认时区即可,反正这个后期也方便改动
18>.选择手动创建分区,不使用逻辑卷进行分区
19>.选择咱们虚拟机的硬盘
20>.会提示咱们是否要创建一个新的分区,我们选择"yes"
21>.选中咱们上一步创建的分区,按回车即可
22>.创建一个新的分区
23>.自定义一个分区大小
24>.创建主分区
25>.默认即可,从头开始分配咱们创建的分区
26>.确认分配
27>.如下图所示,还有剩余573GB的空间,咱们可以继续分区
28>.继续创建一个新的分区
29>.创建一个1GB的分区来分配给boot使用
30>.继续选择主分区
31>.继续选择从头开始使用分区
32>.将第二个分区分配给"/boot"
33>.重复上述操作,分配出"/data"分区和“swap”分区,如下图所示
34>.分区完成后选择最后一项完成分区,会将咱们的分配信息写入到磁盘
35>.确认写入
36>.如果你的网络需要代理服务器才能上网就直接输入代理地址即可,如果无需代理就能上网那么直接选择继续即可
37>.选择第二个选择自动升级(也可以选择手动打补丁升级,那就选择第一个)
38>.建议安装ssh服务便于远程管理,默认ubantu是不安装的哟
39>.安装boot加载器,选择默认的"yes"即可。
40>.安装完毕
41>.安装完成后会自动重启ubantu系统
二.切换到root用户并修改ssh服务可以使用root用户登录
1>.查看IP地址
2>.使用jason用户登录,并切换到root身份
3>.修改sshd服务的参数,重启虚拟机即可
root@ubuntu1904:~# echo "PermitRootLogin yes" >> /etc/ssh/sshd_config root@ubuntu1904:~# root@ubuntu1904:~# reboot Connection closed by foreign host. Disconnected from remote host(172.30.1.104:22) at 19:59:04. Type `help' to learn how to use Xshell prompt. [c:\~]$
4>.再次使用root用户登录即可登录成功啦
三.为ubantu配置IP地址
1>.使用子网划分工具来划分子网(http://www.ab126.com/web/3552.html)
2>.对nat的地址进行子网划分
3>.设置DHCP地址池
4>.启动虚拟机,观察到虚拟机会自动分配咱们规划的IP地址
5>.编辑网卡的配置地址
root@ubuntu1904:~# cat /etc/netplan/01-netcfg.yaml # This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: ens33: dhcp4: yes #默认是DHCP获取地址的 root@ubuntu1904:~# root@ubuntu1904:~# vim /etc/netplan/01-netcfg.yaml root@ubuntu1904:~# root@ubuntu1904:~# cat /etc/netplan/01-netcfg.yaml # This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: ens33: dhcp4: no #咱们得禁用DHCP功能,下面就分别配置了IP地址,网关地址以及DNS信息等。 addresses: [192.168.7.100/21] gateway4: 192.168.7.254 nameservers: addresses: [192.168.7.254] root@ubuntu1904:~# root@ubuntu1904:~# root@ubuntu1904:~# ifconfig ens33: flags=4163mtu 1500 inet 192.168.7.1 netmask 255.255.248.0 broadcast 192.168.7.255 inet6 fe80::20c:29ff:fe84:d091 prefixlen 64 scopeid 0x20 ether 00:0c:29:84:d0:91 txqueuelen 1000 (Ethernet) RX packets 572 bytes 48889 (48.8 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 381 bytes 77433 (77.4 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 84 bytes 6324 (6.3 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 84 bytes 6324 (6.3 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 root@ubuntu1904:~# root@ubuntu1904:~# netplan apply #在Ubantu没有像CentOS操作系统那样有network服务,因此我们直接执行"netplan apply"指令后就会立即生效。 root@ubuntu1904:~#
6>.将阿里镜像地址配置为ubantu的源
root@ubuntu1904:~# vim /etc/apt/sources.list root@ubuntu1904:~# root@ubuntu1904:~# cat /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 root@ubuntu1904:~# root@ubuntu1904:~#
7>.更新ubantu的镜像源
root@ubuntu1904:~# apt-get update Get:1 http://mirrors.aliyun.com/ubuntu bionic InRelease [242 kB] Get:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB] Get:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB] Get:4 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB] Get:5 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease [74.6 kB] Get:6 http://mirrors.aliyun.com/ubuntu bionic/main Sources [829 kB] Get:7 http://mirrors.aliyun.com/ubuntu bionic/restricted Sources [5,324 B] Get:8 http://mirrors.aliyun.com/ubuntu bionic/multiverse Sources [181 kB] Get:9 http://mirrors.aliyun.com/ubuntu bionic/universe Sources [9,051 kB] Get:10 http://mirrors.aliyun.com/ubuntu bionic/main amd64 Packages [1,019 kB] Get:11 http://mirrors.aliyun.com/ubuntu bionic/main i386 Packages [1,007 kB] Get:12 http://mirrors.aliyun.com/ubuntu bionic/main Translation-en [516 kB] Get:13 http://mirrors.aliyun.com/ubuntu bionic/restricted i386 Packages [9,156 B] Get:14 http://mirrors.aliyun.com/ubuntu bionic/restricted amd64 Packages [9,184 B] Get:15 http://mirrors.aliyun.com/ubuntu bionic/restricted Translation-en [3,584 B] Get:16 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 Packages [8,570 kB] Get:17 http://mirrors.aliyun.com/ubuntu bionic/universe i386 Packages [8,531 kB] Get:18 http://mirrors.aliyun.com/ubuntu bionic/universe Translation-en [4,941 kB] Get:19 http://mirrors.aliyun.com/ubuntu bionic/multiverse amd64 Packages [151 kB] Get:20 http://mirrors.aliyun.com/ubuntu bionic/multiverse i386 Packages [144 kB] Get:21 http://mirrors.aliyun.com/ubuntu bionic/multiverse Translation-en [108 kB] Get:22 http://mirrors.aliyun.com/ubuntu bionic-security/main Sources [134 kB] Get:23 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse Sources [3,184 B] Get:24 http://mirrors.aliyun.com/ubuntu bionic-security/restricted Sources [4,220 B] Get:25 http://mirrors.aliyun.com/ubuntu bionic-security/universe Sources [163 kB] Get:26 http://mirrors.aliyun.com/ubuntu bionic-security/main i386 Packages [417 kB] Get:27 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 Packages [606 kB] Get:28 http://mirrors.aliyun.com/ubuntu bionic-security/main Translation-en [196 kB] Get:29 http://mirrors.aliyun.com/ubuntu bionic-security/restricted i386 Packages [4,280 B] Get:30 http://mirrors.aliyun.com/ubuntu bionic-security/restricted amd64 Packages [17.0 kB] Get:31 http://mirrors.aliyun.com/ubuntu bionic-security/restricted Translation-en [5,032 B] Get:32 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 Packages [633 kB] Get:33 http://mirrors.aliyun.com/ubuntu bionic-security/universe i386 Packages [606 kB] Get:34 http://mirrors.aliyun.com/ubuntu bionic-security/universe Translation-en [213 kB] Get:35 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse i386 Packages [4,288 B] Get:36 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse amd64 Packages [6,120 B] Get:37 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse Translation-en [2,600 B] Get:38 http://mirrors.aliyun.com/ubuntu bionic-updates/restricted Sources [6,216 B] Get:39 http://mirrors.aliyun.com/ubuntu bionic-updates/universe Sources [271 kB] Get:40 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse Sources [5,848 B] Get:41 http://mirrors.aliyun.com/ubuntu bionic-updates/main Sources [301 kB] Get:42 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 Packages [830 kB] Get:43 http://mirrors.aliyun.com/ubuntu bionic-updates/main i386 Packages [629 kB] Get:44 http://mirrors.aliyun.com/ubuntu bionic-updates/main Translation-en [290 kB] Get:45 http://mirrors.aliyun.com/ubuntu bionic-updates/restricted i386 Packages [9,584 B] Get:46 http://mirrors.aliyun.com/ubuntu bionic-updates/restricted amd64 Packages [26.0 kB] Get:47 http://mirrors.aliyun.com/ubuntu bionic-updates/restricted Translation-en [6,976 B] Get:48 http://mirrors.aliyun.com/ubuntu bionic-updates/universe i386 Packages [997 kB] Get:49 http://mirrors.aliyun.com/ubuntu bionic-updates/universe amd64 Packages [1,035 kB] Get:50 http://mirrors.aliyun.com/ubuntu bionic-updates/universe Translation-en [320 kB] Get:51 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse amd64 Packages [9,500 B] Get:52 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse i386 Packages [7,484 B] Get:53 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse Translation-en [4,540 B] Get:54 http://mirrors.aliyun.com/ubuntu bionic-proposed/main Sources [31.6 kB] Get:55 http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted Sources [1,440 B] Get:56 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe Sources [12.7 kB] Get:57 http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse Sources [804 B] Get:58 http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 Packages [69.0 kB] Get:59 http://mirrors.aliyun.com/ubuntu bionic-proposed/main i386 Packages [61.4 kB] Get:60 http://mirrors.aliyun.com/ubuntu bionic-proposed/main Translation-en [32.7 kB] Get:61 http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted amd64 Packages [3,644 B] Get:62 http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted Translation-en [1,232 B] Get:63 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe i386 Packages [41.9 kB] Get:64 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe amd64 Packages [46.8 kB] Get:65 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe Translation-en [24.6 kB] Get:66 http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse amd64 Packages [1,316 B] Get:67 http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse Translation-en [568 B] Get:68 http://mirrors.aliyun.com/ubuntu bionic-backports/universe Sources [2,492 B] Get:69 http://mirrors.aliyun.com/ubuntu bionic-backports/main Sources [2,532 B] Get:70 http://mirrors.aliyun.com/ubuntu bionic-backports/main i386 Packages [2,516 B] Get:71 http://mirrors.aliyun.com/ubuntu bionic-backports/main amd64 Packages [2,512 B] Get:72 http://mirrors.aliyun.com/ubuntu bionic-backports/main Translation-en [1,644 B] Get:73 http://mirrors.aliyun.com/ubuntu bionic-backports/universe amd64 Packages [4,044 B] Get:74 http://mirrors.aliyun.com/ubuntu bionic-backports/universe i386 Packages [4,036 B] Get:75 http://mirrors.aliyun.com/ubuntu bionic-backports/universe Translation-en [1,900 B] Fetched 43.9 MB in 16s (2,748 kB/s) Reading package lists... Done root@ubuntu1904:~