---
# System prepended metadata

title: Build a simple ozone environment
tags: [cloud-native]

---

# Build a simple ozone environment

:::info
:bulb: This is a Tutorial for us to install a self-hosted OM on Single Node.
:::

## Steps
### :small_blue_diamond: Basic Enviroment
- OS: (recommend)Linux,Mac
- Basic Program Language: Python(3.10+),Java(jdk11+)
- docker-compose(for generate your configuration file ```ozone-site.xml```)
- find the Ozone version YOU NEED

:::success
We use Ubuntu22.04. Moreover,we only use cli to complete this tutorial. Ozone Version is 1.4.1.
:::

### :small_blue_diamond: First, Get Ozone Binary File
- wget for download our file
```=bash
wget https://dlcdn.apache.org/ozone/1.4.1/ozone-1.4.1.tar.gz
```
- Unzip
```=bash
tar -xzf ozone-1.4.1.tar.gz
```
- Check. Use ```ls```. You should see like this:
```=bash
ozone-1.4.1
```
---
### :small_blue_diamond: Generate Configuration File
- Use Docker Compose,In ozone-1.4.1 folder
```=bash
docker compose -f compose/ozone/docker-compose.yaml up
```
- We have a ```ozone-site.xml``` now. Check it out, in```./ozone-1.4.1/etc```.
```
cd etc 
ls
```
- You should see like this:
```
hadoop  ozone-site.xml
```
---
### :small_blue_diamond: Write First ```ozone-site.xml```
- use nano or vim
```=bash
vim ozone-site.xml
```
- You should see four default preperties
    - **ozone.om.address:** This is the address of the Ozone Manager 
    - **ozone.metadata.dirs:** This parameter specifies the directories where the Ozone Manager stores metadata. ＝＝> we need CHOOSE a disk(SSD better).
    - **ozone.scm.client.address:** This parameter specifies the address of the SCM (Storage Container Manager) client.
    - **ozone.scm.names:** This parameter is used to configure the names of SCM nodes. These names identify the SCM nodes in the Ozone cluster, and typically list all the SCM nodes for high availability configuration.
    read this document for more https://ozone.apache.org/docs/1.0.0/start/onprem.html
:::success
Cuz we will set OM on Single Node, All values can be localhost or 127.0.0.1 ,except for ozone.metadata.dirs 
:::
- Choose Disk by Yourself 
```
lsblk
df -h
```
- Create a folder for OM like this(sda2 is the disk you coose):
```
sudo mkdir -p /sda2/ozone/meta
``` 
- Set your disk route ozone.metadata.dirs
```
<name>ozone.metadata.dirs</name>
<value>/sda3/ozone/meta</value>
```        
- Confirm values of ozone.om.address , ozone.scm.names and ozone.scm.client.address are ```localhost``` or ```127.0.0.1```
---
### :small_blue_diamond: Init and Start
- move ```ozone-site.xml``` to hadoop folder (excute in ```etc``` folder)
```=bash
cp ozone-site.xml ./hadoop/
```
- Authorize
```
sudo chown -R user:user /sda3/ozone/meta
sudo chmod -R 755 /sda3/ozone/meta
```
- let we can use Ozone Command
```
nano ~/.bashrc
```
- Add Your PATH in the last of the file like:
```
export PATH=$PATH:/home/user/ozone-install/ozone-1.4.1/bin
```
- Init SCM
```
ozone scm --init
```
- Start SCM
```
ozone --daemon start scm
```
- Init OM
```
ozone om --init
```
- Start OM
```
ozone --daemon start om
```
---
:::success
Congraguations! Well Done! You build up your own OM and SCM :fire: 
:::

My ozone-site.xml
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
    <!-- Ozone Manager Configuration -->
    <property>
        <name>ozone.enabled</name>
        <value>true</value>
        <description>Enable Ozone service explicitly</description>
    </property>
    <property>
        <name>ozone.om.service.ids</name>
        <value>omService</value>
        <description>Unique service ID for Ozone Manager</description>
    </property>
    <property>
        <name>ozone.om.nodes.omService</name>
        <value>om1</value>
        <description>List of Ozone Manager nodes for omService</description>
    </property>
    <property>
        <name>ozone.om.address.omService.om1</name>
        <value>localhost:9862</value>
        <description>Address of om1 in omService</description>
    </property>
    <property>
        <name>ozone.om.http-address.omService.om1</name>
        <value>localhost:9874</value>
        <description>HTTP address for OM Web UI and client connections</description>
    </property>
    <property>
        <name>ozone.om.ratis.enable</name>
        <value>false</value>
        <description>Disable Ratis for single-node deployment</description>
    </property>

    <!-- SCM Configuration -->
    <property>
        <name>ozone.scm.names</name>
        <value>localhost</value>
        <description>SCM addresses for datanodes and OM</description>
    </property>
    <property>
        <name>ozone.scm.client.address</name>
        <value>localhost:9860</value>
        <description>Address of the Ozone SCM client service</description>
    </property>
    <property>
        <name>ozone.scm.primordial.node.id</name>
        <value>localhost</value>
        <description>Primary SCM node for single-node deployment</description>
    </property>
    <property>
        <name>ozone.scm.node.id</name>
        <value>localhost</value>
        <description>Explicit SCM node ID for this instance</description>
    </property>
    <property>
        <name>ozone.scm.db.dirs</name>
        <value>/sda3/ozone/meta/scm</value>
        <description>SCM-specific metadata directory</description>
    </property>

    <!-- Metadata and Storage -->
    <property>
        <name>ozone.metadata.dirs</name>
        <value>/sda3/ozone/meta</value>
        <description>Fallback location for SCM, OM, and Datanode metadata storage</description>
    </property>
    <property>
        <name>hdds.datanode.dir</name>
        <value>/sda3/ozone/data</value>
        <description>Storage directory for Datanode</description>
    </property>

    <!-- Security -->
    <property>
        <name>ozone.security.enabled</name>
        <value>false</value>
        <description>Disable security for simplicity</description>
    </property>
</configuration>
```