ubuntu1804系统设置在哪里_Ubuntu1804(Server版)安装及使用

1 系统安装操作步骤

OS Version:1804

镜像下载:http://cdimage.ubuntu.com/releases/

1.1 选择安装语言:

1.2 安装界面选择第一项进行系统安装

1.3 选择安装过程中使用的语言,也是系统安装完后使用的默认语言

1.4 选择地区,这里先选择最后一项other,然后回车再选择Asia,最后选择China

1.5 选择语言环境

1.6 键盘布局检查,选择NO

1.7 选择美式键盘

1.8 确认使用美式键盘

1.9 配置主机名

1.10 创建一个普通用户和为其设置密码

1.11 确认时区

1.12 选择磁盘分区的方法,这里选手动分区

1.13 选择磁盘

1.14 确认对磁盘分区

1.15 对磁盘分区

1.16 创建新分区

1.17 指定分区大小,这里将磁盘的全部大小划分给该分区

1.18 选择分区类型,这里选主分区

1.19 分区完成

1.20 完成分区并写入数据

1.21 确认写入磁盘

1.22 是否使用代理,这里不填

1.23 是否自动更新,这里选择默认,不自动更新

1.24 选择安装组件,选择对应需要安装的组件,然后按空格键,这里选择OpenSSH Server

1.25 将GRUB引导加载程序安装到主引导记录

1.26 完成安装,确认重启服务器

1.27 登录系统

2 系统基础配置

官方文档:https://help.ubuntu.com/

2.1 更改主机名

# cat /etc/hostname

hechunping

2.2 更改网卡名称为eth*

# sed -i '/GRUB_CMDLINE_LINUX=/s/"$/net.ifnames=0 biosdevname=0"/' /etc/default/grub

# update-grub

Sourcing file `/etc/default/grub'

Generating grub configuration file ...

Found linux image: /boot/vmlinuz-4.15.0-55-generic

Found initrd image: /boot/initrd.img-4.15.0-55-generic

done

# reboot

# sed -i 's/ens33/eth0/' /etc/netplan/01-netcfg.yaml

2.3 配置root远程登录

# 默认情况下,ubuntu不允许root⽤⼾远程ssh,如果有实际场景需要允许root⽤⼾远程ssh,则需要设置root密码,并且编辑/etc/ssh/sshd_config⽂件修改如下:

~$ sudo vim /etc/ssh/sshd_config

32 #PermitRootLogin prohibit-password #默认为禁⽌登录

33 PermitRootLogin yes #改为允许登录

57 #PasswordAuthentication yes

58 PasswordAuthentication yes #打开密码认证,其实默认就是允许通过密码认证登录

~$ sudo su - root #切换到root⽤⼾环境

~# passwd #设置密码

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

~# systemctl restart sshd #重启ssh服务并测试root⽤⼾远程ssh连接

2.4 网络配置

官方文档:https://netplan.io/

Ubuntu 从 17.10 开始,已放弃在 /etc/network/interfaces ⾥固定IP的配置,⽽是改成 netplan ⽅式,配置⽂件是:/etc/netplan/01-netcfg.yaml

# ubuntu 17.04及之前的静态IP配置⽅式:

~# cat /etc/network/interfaces

root@hechunping:~# cat /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo

iface lo inet loopback

auto eth0 #⽹卡⾃启动,写⾃⼰要配置IP的实际⽹卡名称

iface eth0 inet static #配置静态IP,写⾃⼰要配置IP的实际⽹卡名称

address 172.18.3.12 #IP地址

netmask 255.255.0.0 #掩码

gateway 172.18.0.1 #⽹关

dns-nameservers 223.6.6.6 #DNS

dns-nameservers 223.5.5.5

#重启⽹络服务

~# /etc/init.d/networking restart

~# systemctl restart networking.service

2.4.1 单网卡静态IP地址

root@hechunping:~# 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:

eth0:

dhcp4: no

addresses: [192.168.7.132/24]

gateway4: 192.168.7.2

nameservers:

addresses: [223.6.6.6]

root@hechunping:~# netplan apply

2.4.2 配置多网卡静态IP

# 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:

eth0:

dhcp4: no

addresses: [172.20.7.34/16]

gateway4: 172.20.0.1

nameservers:

addresses: [223.6.6.6]

eth1:

dhcp4: no

addresses: [192.168.7.34/24]

routes:

- to: 172.20.0.0/16

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值