Ubuntu简述及部署系统

1.什么是Ubuntu

1.1概述

Ubuntu属于Debian系列,Debian是社区类Linux的典范,是迄今为止最遵循GNU规范的Linux系统。

Debain最早由lan Murdock于1993年创建,分为三个版本分支(branch):stable,testing和unstable。

Ubuntu Server 是Ubuntu操作系统的一个版本,是Ubuntu家族的一员,被工程设计作为互联网的骨干系统,Ubuntu Server为公有或私有数据中心带来经济和技术上的可扩展性。

1.2Ubuntu版本下载

服务器版本下载:

服务器版本用于托管网络服务器和数据库等应用程序,是专业人员使用的服务器操作系统

注意:

一般选择LTS长期更新版,LTS为"长期支持"版本每两年在4月份发布一次。LTS版本是Ubuntu的"企业级"版本,使用得最多。估计95%的Ubuntu安装都是LTS版

可以在开源镜像站点下载,如阿里开源镜像

2.部署系统

2.1新建虚拟机

2.2安装系统

2.2.1选择安装语言,默认(English),直接回车

2.2.2选择键盘,默认回车

2.2.3安装的服务器版本,如需精简版本选择(Minimized)最小安装,此处根据需求自行选择,本次安装选择(Ubuntu Server)

2.2.4网络设置,此处默认使用DHCP,回车即可

2.2.5Proxy(代理配置),用于访问安装程序环境和已安装环境中的包存储库和snap存储库,不用配置,回车即可

2.2.6配置软件源,建议更改为国内镜像源提高下载速度,也可以直接回车,以后在更改

2.2.7系统分区,选择安装磁盘,直接回车默认自动分配,需要手动分区的话选择(custom storage layout)。此次安装选择(Custom storage layout)进行手动分区,按Tab进行选择,按空格键选中选项后回车

2.2.8新建第一个分区:/boot,容量1GB

2.2.9添加第二个分区:/根分区,剩余容量,不填即可

2.2.10设置计算机名,用户名及密码

your server name : 主机名

pick a username:账户名

注意:ubuntu默认不能设置root密码,可以安装完毕后,使用命令更改root密码

2.2.11安装OpenSSH Server服务,空格键选中

2.2.12选择安装其他服务,直接跳过

2.2.13开始系统安装

2.2.14安装完成后选择(Reboot Now)重启系统

注意:出现下列报错,表示未找到光驱,回车即可

2.2.15使用之前创建的普通账户登录

3.部署后的设置

3.1设置root密码

由于默认的root用户没有固定密码,则可以通过下列方法更改并切换账户

bash 复制代码
andy@server:~$ sudo  passwd  root   # 以普通账户登录后执行此命令修改root初始密码
[sudo] password for andy:     # 普通账户的密码
New password:                 # 新的root密码 
Retype new password:          # 在输入一遍
passwd: password updated successfully
andy@server:~$ su - root      # 切换到root账户
Password: 
root@server:~# 

3.2关闭防火墙

bash 复制代码
root@server:~# systemctl status  ufw    # 查看ufw防火墙状态
● ufw.service - Uncomplicated firewall
     Loaded: loaded (/lib/systemd/system/ufw.service; enabled; preset: enabled)
     Active: active (exited) since Sat 2023-12-02 07:55:04 UTC; 13min ago
       Docs: man:ufw(8)
   Main PID: 624 (code=exited, status=0/SUCCESS)
        CPU: 1ms


root@server:~# systemctl  stop  ufw
root@server:~# systemctl  disable  ufw

3.3启用允许root进行ssh

bash 复制代码
root@server:~# vim  /etc/ssh/sshd_config
PermitRootLogin 的参数设为yes

root@server:~# systemctl  restart  ssh   # 注意服务接口为ssh

3.4安装所需软件

bash 复制代码
root@server:~# apt  install  tree  gcc  make  net-tools  openvswitch-switch -y

3.5制作快照