I am playing with ROS recently. Actually using it is not hard. But I don’t understand why there is not even a reasonable tutorial regarding package managing. I went through an entire online course not even realizing that managing tools such as wstool and rosinstall_generator exist. (I initially git clone one package at a time into my src folder.)
Long story short. Assuming that you have already created a workspace. To install the package ros_tutorials and its dependency (assuming you are running kinetic),
roscd; cd .. rosinstall_generator ros_tutorials --rosdistro kinetic --deps --wet-only > tmp.rosinstall wstool init -j4 src/ tmp.rosinstall rosdep check --from-paths . --ignore-src --rosdistro kinetic catkin_make -j 4
To install additional packages, say tutlebot3_gazebo,
roscd; cd .. rosinstall_generator turtlebot3_gazebo --rosdistro kinetic --deps --wet-only > kk.rosinstall wstool merge -t src kk.rosinstall wstool update -t src catkin_make -j 4