Yes, a CV can be 2 pages. However, your CV should be no longer than 2 pages unless you’re a senior professional or you’re preparing an academic CV (which has no page limit).
If you’ve recently graduated from university or are writing a school leaver CV and you can fit all your relevant experience and skills onto a one-page CV without it looking cramped, then you should make it one page. Otherwise, a two-page CV is fine.