If the GM allows it, your friend could now use the alternative to the Beast Master ranger which appears in Tasha's Cauldron of Everything (TCoE, p.61):
Primal Companion, 3rd-level Beast Master feature, which replaces the Ranger's Companion freature.
This option has more synergy with class development - possibly mult-classing, too.
This alternative to the ranger sub-class does not rely on CR; it says:
You magically summon a primal beast, which draws strength from your bone with nature. [...] When you finish a long rest, you can summon a different primal beast. The new beast appears in an onoccupied space within 5 feet of you.
The Primal Companion alternative also provides three options to choose from for your companion, a beast of the land, of the sea or of the sky. Your ranger's companion will also evolve as your PC increases in ranger levels, proficiency bonus modifier and spell attack modifier - hence the synergy.
- Ranger Levels increases: Hit Points
- PB increases: AC, damage
- Spell attack modifier increases: to Hit bonus (attack modifier)
Not only that, you also get a way of returning the beast back to life:
If the beast has died within the last hour, you can use your action to touch it and expend a spell slot of 1st level or higher. The beast returns to life after 1 minute with all its hit points restored.
If your friend wishes to multi-class with a Rogue, it might be worth considering the sub-class of Mastermind (XGtE) at level 3, as he'd be able to use Master of Tactics and use the Help option as a bonus action to give his Primal Companion (beast) an advantage on attack rolls. This would mean that the Ranger would need to use one of its Attack actions so that the companion attacks. Still, it's a fair synergy. I would not multi-class until the ranger reaches 5th level though, as the Ranger will need the Extra Attack to increase their damage output and versatility.
As you say, the last paragraph of the ranger's companion text mentions needing 8 hours to magically bond with another non-hostile beast if when the previous one dies. It is probably the same for the first time around.
As for how to get the beast I haven't found specific ruling, so it's probably up to the player to find a beast to his liking (any plausible method should work unless the DM requires anything specific), ensure its friendliness and then bond with it.
A survival or perception check to find one in the wilderness and a handle animal check to calm it should do the trick, and the ranger spell list includes some spells that could help, like "locate plans and animals", "animal friendship", "speak with animals" or "conjure animals".
The beast selection is limited by what kind of beasts exist in his environment, which is something the DM decides.
Best Answer
No, you can not choose a swarm as an animal companion
The simplest argument is that the Ranger must choose a beast, singular, not a swarm of beasts, plural. Rules designer Jeremy Crawford even supports this interpretation in an unofficial tweet from January 2016 (although the tweet is responding to a question to the druid's Wild Shape feature).
In addition to Jeremy Crawford's tweet, there is now an official ruling in the Sage Advice Compendium (as of October 2020) that says a swarm is not an option for the conjure animals spell:
The spell conjure animals refers to being able to summon a specified number of beasts, and the Wild Shape feature lets a druid turn into a single beast, just as a Beast Master gains a single beast as an animal companion. As such, the similar logic would suggest that the same restrictions apply.
Natural vs. unnatural
There are also additional arguments to be made against a swarm being a valid option. For example, consider the description of the Beast type, in the introduction to the Monster Manual (p. 6)
And then look at the sidebar titled "The Nature of Swarms" in the section listing various types of swarms (Monster Manual, p. 377; emphasis mine):
A creature with the beast type is a natural creature. A swarm is something that does not occur naturally.
Buyer beware
Of course, your DM may choose to allow you to choose a swarm. However, be wary of making such a choice. Each swarm, including the Swarm of Ravens, includes the following text in its Swarm trait:
Not being able to heal your swarm is likely going to cause you issues, especially given the relative squishiness of the animal companion in general.