You 100% can, but I would recommend starting in person with a group of friends. You really only need three other people to get started (you can do it with less of course too but I’d recommend 3 players + 1 GM as a nice starting size for your group).
The reason I say this is that you’re all going to be learning together and can have a lot more control on shaping your experience. That way you can figure out what you want from the game before playing with strangers (there are loads of different ways to play and not everyone GMs in a way that you’re going to have fun with).
To start getting into it all you need is the core rules, dice (or an online dice roller), pens & paper and your players. You can get D&D 5e core rules for free here. Once you’ve read those, decided who’s playing & who’s DMing, then your DM needs to either write or find a pre-made story to play and you’re ready to go.
There’s loads of really great D&D advice blogs on the web that you can use for GM & playing advice. Too many to list but here’s a short rundown of some of my favs:
The Angry GM – Tons of think pieces and GMing advice about story with added rants.
The Newbie DM – practical advice on making things for your games & resources for new DMs.
Dungeonmastering.com – Tons of resources and advice
The D&D community on tumblr is really awesome and, as far as I’ve come across, the majority of people love to answer tabletop questions so just jump into an inbox and someone will help you (including me!)