---
title: "安装 obd | OceanBase 文档中心"
description: 安装 obd 本文介绍三种安装 obd 的方法——通过 OceanBase All in One 安装、使用 RPM 安装以及使用源码安装。 环境准备 您所用机器的系统需要满足要求，目前支持的操作系统可参见官网《OceanBase 数据库》文档 软硬件要求 中 硬件资源准备 介绍。 安装 obd （推荐）通过 Oce…
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*Qq8pT6yBPTcAAAAAAAAAAAAADiGDAQ/original) 安装部署工具 OBDV 3.2.0 社区版

# 安装 obd

更新时间：2026-04-14 17:55:42

[编辑](https://github.com/oceanbase/obd-doc/edit/V3.2.0/zh-CN/200.quick-start/100.install-obd.md)  

本文介绍三种安装 obd 的方法——通过 OceanBase All in One 安装、使用 RPM 安装以及使用源码安装。

## 环境准备

您所用机器的系统需要满足要求，目前支持的操作系统可参见官网《OceanBase 数据库》文档 [软硬件要求](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000001429338) 中 **硬件资源准备** 介绍。

## 安装 obd

    （推荐）通过 OceanBase All in One 安装 obd   使用 RPM 包安装   使用源码安装

OceanBase 从 V4.0.0 开始提供统一的安装包 OceanBase All in One。目前包括 OceanBase 数据库软件和 OCP、obd、OBProxy（又称为 ODP）、OBClient、OCP Express（自 V4.1.0 起支持）、Prometheus、Grafana，以及诊断和测试工具。

#### 说明

- OceanBase All in One 不同系列安装包中包含的产品不同，V4.3.x 系列中自 V4.3.3 起包含 OCP、V4.2.x 系列中自 V4.2.5 起包含 OCP、V4.2.1 系列中自 V4.2.1_CE_BP9_HF1 起包含 OCP。
 - 建议通过下载 OceanBase All in One 进行安装，OceanBase All in One 目前提供部署所需要的全部组件（除 obbinlog 组件），且组件已经经过相互适配测试，为官方推荐版本。

     在线安装   离线安装

若您的机器可以连接网络，可执行如下命令在线安装。安装成功后，`/tmp` 目录下会新增 tmp.xxx 文件夹作为安装目录，如 `tmp.jvzpVREAs9`。

```shell
[admin@test001 ~]$ bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/installer.sh)"
[admin@test001 ~]$ source ~/.oceanbase-all-in-one/bin/env.sh

```

若您的机器无法连接网络，可参考如下步骤离线安装。

1. 从 [OceanBase 软件下载中心](https://www.oceanbase.com/softwarecenter) 下载最新的 OceanBase All in One，并将其复制到中控机中。推荐使用最新版本的安装包。
 2. 在安装包所在目录下执行如下命令解压安装包并安装。

   ```shell
   [admin@test001 ~]$ tar -xzf oceanbase-all-in-one-*.tar.gz
   [admin@test001 ~]$ cd oceanbase-all-in-one/bin/
   [admin@test001 bin]$ ./install.sh
   [admin@test001 bin]$ source ~/.oceanbase-all-in-one/bin/env.sh

   ```

#### 说明

通过 OceanBase All in One 安装 obd 时，`install.sh` 脚本默认会尝试以管理员权限安装，若当前用户无 sudo 权限，可在输入密码处输入当前用户密码或单击三次键盘 `Enter` 键，之后输入 `n` 选择使用当前用户进行安装。根据使用用户和权限的不同，有如下两种情况。

- 若您使用 root 用户或者使用普通用户以管理员权限（`sudo`）进行安装，安装后 obd 可执行文件的目录为 `/usr/bin/obd`。
 - 若您使用普通用户进行安装，安装后 obd 可执行文件目录为 `~/.oceanbase-all-in-one/obd/usr/bin/obd`。

根据所用机器是否可以连接外部网络，分为如下 **在线安装** 和 **离线安装** 两种安装方法。需要注意的是，通过 RPM 包安装时仅安装 obd，当机器可以连接外部网络时，obd 会访问远程镜像源获取部署集群所需安装包；当机器无法连接网络时，成功安装 obd 后，您还需手动配置 obd 的本地镜像库。

    在线安装   离线安装

若您的机器可以连接网络，在 CentOS 或 RedHat 系统上，您可执行以下命令在线安装 obd。

```shell
[admin@test001 ~]$ sudo yum install -y yum-utils
[admin@test001 ~]$ sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
[admin@test001 ~]$ sudo yum install -y ob-deploy
[admin@test001 ~]$ source /etc/profile.d/obd.sh

```

#### 说明

YUM 命令默认安装最新版本，您可通过声明版本号安装指定版本，如使用 `yum install -y ob-deploy-1.6.2` 命令安装 obd V1.6.2，推荐安装最新版本。

若您的机器无法连接网络，您可访问 [OceanBase 软件下载中心](https://www.oceanbase.com/softwarecenter) 下载 obd 安装包以及部署集群所需组件的安装包，推荐您下载最新版本的安装包。下载完成后，将安装包复制到您所用机器上。

在 CentOS 或 RedHat 系统上，执行如下命令安装 obd：

```shell
sudo yum install ob-deploy-*.rpm

```

在 Ubuntu 或 Debian 系统上，执行如下命令安装 obd：

```shell
sudo alien --scripts -i ob-deploy-*.rpm

```

成功安装 obd 且已访问官网 [OceanBase 软件下载中心](https://www.oceanbase.com/softwarecenter) 提前下载好所需组件的安装包后，可参照如下操作将安装包添加到 obd 的本地镜像库。

您可在部署运行 obd 的操作系统用户下按照如下步骤操作，示例中使用的是用户 admin。

1. 执行如下命令禁用远程仓库

   ```shell
   obd  mirror disable remote

   ```

   禁用后可通过 `obd mirror list` 命令进行确认，查看 Type=remote 对应行的 `Enabled` 列变成了 `False`，说明已关闭远程镜像源。
 2. 在安装包所在目录执行如下命令将下载好的安装包上传到本地仓库

   ```shell
   obd mirror clone *.rpm

   ```
 3. 查看本地仓库的安装包列表

   ```shell
   obd mirror list local

   ```

   在输出的列表中查看到部署所需安装包即表示上传成功。

在使用源码安装 obd 之前，请您确认已安装以下依赖：

- gcc
 - wget
 - python-devel
 - openssl-devel
 - xz-devel
 - mysql-devel

源码编译安装 obd 需要使用到 Python 2.7 环境和 Python 3.8 环境。安装步骤如下：

1. 在 Python 2.7 环境下执行以下命令。

   ```shell
   sh rpm/build.sh executer

   ```

   #### 说明

   上述命令是为了编译 OceanBase 数据库升级所需的解释器，如果不使用升级功能可以跳过该命令。
 2. 在 Python3.8 环境下执行以下命令。

   ```shell
   sh rpm/build.sh build_obd
   source /etc/profile.d/obd.sh

   ```

#### 说明

obd 自 V2.0.0 开始不支持在 Python2 环境下使用源码安装。

## 相关操作

### 卸载 OceanBase All in One

您可参考如下步骤卸载已安装的 OceanBase All in One。

1. 卸载安装包

   您需进入 OceanBase All in One 的安装目录执行 `uninstall.sh` 脚本。在线安装时，默认安装目录为 `/tmp/tmp.xxxx/oceanbase-all-in-one`；离线安装时，默认安装目录为 `~/oceanbase-all-in-one`。

   ```shell
   [admin@test001 ~]$ cd oceanbase-all-in-one/bin/
   [admin@test001 bin]$ ./uninstall.sh

   ```
 2. 删除环境变量

   ```shell
   [admin@test001 bin]$ vim ~/.bash_profile
   # 删除该文件中的 source /home/admin/.oceanbase-all-in-one/bin/env.sh

   ```
 3. 使修改生效

   删除环境变量后，您需重新登录终端，或者执行 source 命令使修改生效，可参考如下命令。

   ```shell
   [admin@test001 ~]$ source ~/.bash_profile

   ```

### 升级 OceanBase All in One

如需使用新版本 OceanBase All in One，您可参考如下步骤升级 OceanBase All in One。

    在线升级   离线升级

1. 卸载原 OceanBase All in One

   ```
 2. 安装新 OceanBase All in One

   ```shell
   [admin@test001 ~]$ bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/installer.sh)"

   ```

   该命令默认安装最新版本 OceanBase All in One，若您对 OceanBase All in One 版本有要求，可参见 **离线升级** 操作升级 OceanBase All in One。

1. 获取新安装包

   访问 [OceanBase 软件下载中心](https://www.oceanbase.com/softwarecenter)，搜索 **OceanBase社区版一键安装包**，根据实际情况下载所需安装包，并将其复制到中控机任一目录下。
 2. 卸载原 OceanBase All in One

   ```shell
   [admin@test001 ~]$ cd oceanbase-all-in-one/bin/ && bash uninstall.sh

   ```
 3. 清除原 OceanBase All in One 安装目录

   仅离线安装的 OceanBase All in One 需执行本步骤，清除原 OceanBase All in One 安装目录是为了避免解压新安装包时出现冲突。

   ```shell
   [admin@test001 ~]$ rm -rf ~/oceanbase-all-in-one

   ```
 4. 解压新安装包

   ```shell
   [admin@test001 ~]$ tar -xzf oceanbase-all-in-one-*.tar.gz

   ```
 5. 安装新 OceanBase All in One

   在 OceanBase All in One 的安装目录下执行 install.sh 脚本启动安装程序。

   ```shell
   [admin@test001 bin]$ cd oceanbase-all-in-one/bin/ && bash install.sh

   ```

## 相关文档

若通过 RPM 包安装 obd，安装后升级 obd 的操作可参见 [升级 obd](https://www.oceanbase.com/docs/community-obd-cn-1000000002883397)。

 上一篇 下一篇 ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
