Start here:
http://www.nps.gov/yose/planyourvisit/wildpermits.htm
You need one permit. You need to be most careful about starting on the day you ask to start, as listed on the permit, from the trailhead listed on the permit - you cannot get a permit for Sunrise trailhead, for example, and just decide to go out on Cathedral trailhead instead. You would potentially be fined and escorted back to your car by a ranger if one happened upon you. You also need to pay close attention to food storage regulations and follow them. This will mean putting a bear canister in your pack, so you'll need enough space (and a big enough pack) for that.
There are regulations for where to camp in the park - read those at the above website as well. Some areas have different rules - some trailheads you must be 2 miles from the trailhead, others you must be 4 miles out. In the area between happy isles, little yosemite valley, and ilillouette/glacier point, the rules are quite restrictive, no camping at all.
If you haven't backpacked, I recommend something shorter the first time out. Not everyone finds that they can do long trips. And until you get the gear list worked out, you'll want to do some shorter outings to work the kinks out.
Think about joining a local backpacking group and going out with more experienced hikers. Also if you need to get packs etc. you can rent starting out instead of buying, since you don't know what you don't know - better to have some experience backpacking to begin to develop an idea of what it's about and what you think you need.