For humble && garden version
mkdir -p ~/gazebo_ws/src && cd ~/gazebo_ws/src
git clone https://github.com/leledeyuan00/gazebo_ros.git
Configure your rosdep first rosdep wiki.
sudo rosdep init
rosdep update
cd ~/gazebo_ws
rosdep install --from-paths src --ignore-src -r -y
export GZ_VERSION=garden
colcon build
echo "source ~/gazebo_ws/install/setup.bash" >> ~/.bashrc