We determine the electric potential using that electric field of infinite line of charge which is \(E = k\frac{{2\lambda }}{r}\) with distance \(r\). And \(\lambda \) is the linear charge density which is the charge per unit length.
Now consider a point \(a\) at distance \(r_1\) where the potential is \(V_a\) and another point \(b\) at distance \(r_2\) where the potential is \(V_b\) as shown in Figure 1. The potential difference between these points is
\[\begin{align*} {V_a} - {V_b} &= \int_{{r_1}}^{{r_2}} {\vec E \cdot d\vec r } = \int_{{r_1}}^{{r_2}} {E{\mkern 1mu} dr} \\ &= 2k\lambda \int_{{r_1}}^{{r_2}} {\frac{1}{r}dr} = 2k\lambda \left( {\ln {r_2} - \ln {r_1}} \right)\\ {\rm{or,}}\quad {V_{ab}} &= 2k\lambda \ln \frac{{{r_2}}}{{{r_1}}} \end{align*}\]
Note that the dot product \(\vec{E}\cdot d\vec{r}\) has value \(E\,dr\) because the displacement is perpendicularly outward from the line of charge. For convenience you can put the point \(b\) at infinity and the potential at that point is zero. In this way you can get the value of the potential at the point \(a\):
\[{V_a} = 2k\lambda \ln \frac{\infty }{{{r_1}}} = \infty \]
You may not have guessed that the result would be \(\infty \) at the point \(a\). Now what we do to remove this error is we take the point \(b\) at a finite distance, say \(r_0\) and make the potential zero at that distance. It's because you can make any point a zero potential. For example, take an example of gravitational potential energy. When you are at the bottom of a hill, you think the surface where you are standing to be at zero potential energy and apply \(mgy\) to get the potential energy of a body of mass \(m\) at height \(y\) from the ground. Now you climb the hill and still you think the surface where you are standing to be at zero potential energy and again apply \(mgy\) to get the potential energy. Now you just recently made the two different points (at the bottom and at the top of the hill) to be at zero potential energy.
All this means is we can take any point to be in zero potential and get the potential of another point with respect to that point. Now the above equation for the potential at the point \(a\) with respect to the zero potential at \(b\) is:
\[{V_a} = 2k\lambda \ln \frac{{{r_0}}}{{{r_1}}}\]
So the electric potential at any point \(a\) at a perpendicular distance \(r\) from the infinite line of charge can be obtained by taking any other point such as \(b\) at a finite distance \({{r}_{0}}\) to be in zero electric potential, \(V = {V_a} = 2k\lambda \ln \frac{{{r_0}}}{r}\). The same result is obtained for the infinite charged conducting cylinder. We use Gaussian surface to enclose the cylinder and all the charge on the cylinder is the same as the charge concentrated along its axis, the same as the infinite line of charge.