Entanglement of two distant qubits driven by thermal environments