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
相关推荐
IvorySQL几秒前
打造下一代 AI Agent 的统一多模智能数据底座——PostgreSQL 与 AI 的融合演进
数据库·人工智能·postgresql
ShineWinsu1 分钟前
对于MySQL:内置函数的解析
linux·数据库·c++·mysql·面试·函数·查询
isNotNullX7 分钟前
智能问数为什么答不准?数据、语义、模型、SQL四层拆解
数据库
万物智能信息科技11 分钟前
RK3568 的多路显示移植—【万物智能之开源鸿蒙OpenHarmony系统实战开发系列教程】
linux·开发语言·华为·开源·harmonyos
IT菜鸟程26 分钟前
Ubuntu 下 apt 版 Nginx 升级为源码编译版本完整操作指南(1.24.0 → 1.30.4 实战)
linux·nginx·ubuntu
新时代牛马31 分钟前
Linux 磁盘管理:分区、文件系统、挂载与扩容
linux·运维·服务器
weixin_402486341 小时前
VS Code Codex/Claude Extension 无法安装 / 无法正常打开
linux·服务器·vscode
奋斗的阿狸_19861 小时前
ch32v003j4m6+ws2812b方案2:规划引脚定义
linux
烂蜻蜓1 小时前
Django入门教程(三):django-admin与manage.py命令完全指南
数据库·django·sqlite
Mr-Apple2 小时前
系统找不到指定的文件-CreateInstance/CreateVm/HCS/ERROR_FILE_NOT_FOUND
linux·windows·ubuntu·wsl