ubuntu系统安装以及设置

系统安装

默认选中「Try or Install Ubuntu Server」安装选项,回车(或等待 30 秒后),等待系统镜像自检并进行安装初始化。

  1. 选择语言:English

    2)默认选项,不进行修改

    3)默认选项不进行修改

    4)根具自身需求选择

    5)配置网络:选中【enp1s0】回车选择【Edit IPv4】

    选择【manual】,根据下图设置静态ip

    ip设置完成后,选中【save】回车
    6)配置代理,默认即可

    7)配置存档镜像

这里建议改成清华的源:https://mirrors.tuna.tsinghua.edu.cn/ubuntu/

否则安装中有一步kernel下载会很久。
8) 引导式存储布局配置

根据自己需求选择默认(直接回车即可)还是手动分配(选中Custom storage layout),这里我选择手动分配。

回车选中【Custom storage layout】,tab选中【done】回车

创建swap分区

创建/目录

选择【Done】回车,选择【Contiune】回车

  1. 个人信息设置

依次设置姓名、服务器名称、用户名、用户密码以及确认用户密码。

10) SSH 配置

勾选【Install OpenSSH Server】

11)可选的服务器软件包,根据需求选择

12)开始安装

配置完成,开始安装系统。

13)安装完成,重启服务器

系统设置

设置ssh

bash 复制代码
# 设置root密码
sudo passwd  root   
#user@demo:~$ sudo passwd  root                  
#New password: 
#Retype new password: 
#passwd: password updated successfully
# 切换用户为root
su -
#user@demo:~$ su -
#Password:
# 设置ssh允许root远程
 echo PermitRootLogin yes >>/etc/ssh/sshd_config
 systemctl restart sshd

修改vim为非兼容模式

bash 复制代码
cp /etc/vim/vimrc.tiny /etc/vim/vimrc.tiny.bak
#备份配置文件

 sudo sed -i 11s/compatible/nocompatible/ /etc/vim/vimrc.tiny
#将"compatible"改成"nocompatible"(非兼容模式)
echo set backspace=2 >> /etc/vim/vimrc.tiny

设置apt源

bash 复制代码
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo cat >> /etc/apt/sources.list <<EOF
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
EOF

源配置文件更新后,需要更新apt缓存

bash 复制代码
sudo apt update
sudo apt upgrade -y

docker 安装

安装依赖

bash 复制代码
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

添加 Docker 官方 GPG 密钥

bash 复制代码
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

配置Docker软件源

bash 复制代码
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

更新软件源

bash 复制代码
sudo apt update

安装Docker引擎

bash 复制代码
sudo apt install -y docker-ce docker-ce-cli containerd.io

配置镜像加速

bash 复制代码
 cat > /etc/docker/daemon.json <<EOF
{"registry-mirrors":["https://docker.1ms.run","https://proxy.1panel.live","https://docker.ketches.cn","https://hub1.nat.tf","https://get.docker.com","https://registry-1.docker.io","https://vip.1panel.top","https://status.1panel.top","https://hub.rat.dev","https://docker.amingg.com","https://docker.anye.in","https://docker.1ms.run"]}
EOF

启动Docker服务

bash 复制代码
systemctl enable docker --now
相关推荐
ltl1 小时前
数据库作为 LLM 记忆体:语义缓存、RAG 与一致性
数据库
ltl1 小时前
WAL 与崩溃恢复:ARIES 协议怎么跑通
数据库
ltl2 小时前
实时 OS 巡礼:VxWorks、QNX、Zephyr 与 PREEMPT_RT
linux
ltl2 小时前
TEE 数据库:EnclaveDB、Oblivious 原语与机密 SQL
数据库
我是谁??2 小时前
Ubuntu22.04更换清华源
linux·运维·服务器
Shell运维手记3 小时前
Linux 常用基础命令学习笔记
linux·运维·笔记·学习·算法·github
麻瓜code3 小时前
【Mysql】重新学一遍 SQL 执行顺序
数据库·sql
这个DBA有点耶3 小时前
数据库一体机架构演进:从硬件堆叠到软硬深度耦合
服务器·网络·数据库·硬件架构·运维开发·database·数据库架构
测试运维日常笔记4 小时前
Linux系统安装配置TigerVNC服务器完整指南
linux·运维·服务器
安_4 小时前
RAG的向量数据库:为LLM提供语义搜索能力
数据库