This paper presents a soft robot which can imitate the crawling locomotion of an earthworm. Locomotion of the robot can be achieved by expanding and contracting the body that is made of flexible material. A link of the earthworm-like robot is combined with three modules, and a multi-cavity earthworm-like soft robot is combined with multiple links. The multiple links of the earthworm-like soft robot are fabricated by silicone in the three-dimensional printed customized molds. Experiments on a single module, two-links, and three-links show that the soft robot can move and bend on condition of modules extension and contraction in a specified gait. The development of the earthworm-like soft robot shows a great prospect in many complicated environments such as pipeline detection.