He wrote it in 1864 and 1865, and it was published in monthly installments from May 1864 to November 1865.