Several of the games I've run over the years have been licensed (or fan-hacked) RPGs set in popular fictional universes. The first RPG I ever ran was the Angel RPG, and since then I've run Doctor Who, Firefly and Stargate. Now that I've recently acquired both Age of Rebellion and Force and Destiny, it seems more than likely I'll be adding Star Wars to my GMing resume sooner or later.
The thing about running (or even playing) in an established universe is, you need to decide how you're going to deal with canon, which will depend on a few things:
1. How familiar is your group with the setting?
2. How flexible are your group (those who are familiar with the universe) willing to be with regard to established canon?
3. How important do your players want their characters to be in the grand scheme of this universe?
4. (Optional) Is there any way that altering canon can be made into a plot device within the rules of the fictional universe (via time travel, alternate realities, etc)?
You might want to have a discussion with your group to answer the first three questions before the game starts. Once you know their position regarding these points, you'll have a better idea of how to approach canon in your campaign.
The options available to you might differ depending on the setting, but here's a couple ways I've done it in the past, and a couple of other ways I might consider doing it.
Same 'Verse, Different Stories: The game is set firmly within canon. All of the events that happened in the source material are happening right now and your PCs may cross paths with the main storyline now and then. But the focus is firmly on your PCs and their problems, all of that other stuff is just a side-show for them. Not important.
This is the way I ran my Stargate SG-10 campaign back in university. The PCs were part of the SGC, reported to General Hammond (and later Jack O'Neill) and were aware of the exploits of SG-1 as they ran in parallel to events in the campaign. But they had their own nemesis, their own personal issues and potential end-of-the-world scenarios to deal with.
The advantages of this style of play is that by having cameos and references to established canon in the game, you can reinforce the feel that they are a part of the setting. The danger is, of course, that your PCs adventures are never going to be as 'important' in the grand scheme of things as the 'main cast', unless you bend plausibility a little and have your PCs adventures share similar stakes. If you're going with the latter, you're going to need your players to be willing to handwave the fact that these other big events never even got mentioned onscreen in-universe. If you're going with the former, you're going to need your players cool with their stories being smaller, more personal ones set in the same universe as the more impactful adventures of the main storyline.
Maybe the Same 'Verse, Maybe Not: This approach is similar to the first, but you don't mention the major events of the source material at all, and if you do have any canon characters appear, make them supporting characters, not the big names. Make their adventure as high stakes as you like, leaving enough space for the canon events to be occuring off-screen (in case it somehow becomes relevant later on), but never explicitly call it out. If anyone asks if the other stuff really is happening off-screen, tell them it might be or it might not. If it is, it's not important to them, they've got their own problems.
This is how I played it with my Firefly campaign. Sure, the Hands of Blue showed up, they met Badger, Mr Universe and Niska. But I never once mentioned Captain Reynolds or the crew of the Serenity. As far as the PCs were concerned though, Mal and his crew did not exist. The PCs were the stars of this story, featuring a sinister megacorporation and their conspiracy to improve upon humanity through cybernetic enhancement. (As it turned out, I did end the campaign with an epilogue where I played them the Miranda signal and got them to narrate their reactions, but only because I felt it worked well in regards to one of the PCs character arcs.)
The advantages to this method are that you can maintain the same authentic feel with minor cameos, but focus things more solidly on your group of PCs. If you leave enough space in the narrative for canon events to be going on off-screen without your PCs knowledge, then they can worry less about being a B-team, but you can still keep any purists happy with the suggestion that things might still be occurring as they should. Of course, that's as much a weakness as it is a strength of this approach, because it still leaves room for doubt one way or another. It also only works if, like in Firefly, the canon story arc can feasibly be taking place without being noticed by the larger universe.
Wibbly Wobbly, Timey Wimey: Don't worry about messing around with canon; in fact, make the fact that canon is messed up part of your campaign's main arc! This works really well in settings which feature time-travel or reality warping powers. Maybe somebody made a wish, and now the protagonist never existed and it's up to your PCs to save the day in their place. Or somebody went back in time and changed a pivotal event in the canon timeline, creating a world where your PCs are the last best hope.
When I started my Doctor Who campaign, it was just a year off from the 50th anniversary, so I came up with a campaign idea that would work as a nice homage in honour of that event. The stakes of the campaign would be the very existence of the Whoniverse itself, because the Doctor was missing and his removal from the timeline had thrown the universe into disarray. It was up to the PCs - temporal exiles whose own existence was jeopardised by the Doctor's disappearance - to find the lost Time Lord and set things right.
The advantage here is that you have some leeway to play as fast and loose with canon, because the reason that it's not the way it should be is built into the campaign. The problem with that is, it's a gimmick. You can get away with it every now and then, but you can't do it every time you want to run a campaign in an established universe. Well, you probably could, but you might end up pigeon-holed to that schtick. Also, you have leeway to mess with canon, but only insofar as it fits with the inciting event that has caused all the divergences.
Same Universe, Different Time: I've never done this myself, but I can see it as an option that might work. Maybe your campaign takes place before the main canonical storyline and - if you're feeling brave - you might even have your PCs be part of historical events that shape that later conflict. Or you could go the other route, have your campaign set after established events, let the PCs deal with the aftermath of the original heroes' exploits, or have their own adventures in a future shaped by those events.
One upside is that your players aren't 'competing' with the original characters in terms of stakes, since their adventure takes place outside of the main time period. A potential downside is that your players may not necessarily be familiar with the historical setting if they haven't read that tie-in novel series or whatever you're drawing those details from. Or, maybe they haven't seen/read all of the source material yet, so the future setting (which, presumably, has been shaped by events from the main storyline) contains potential spoilers for them.
Alternate Universe: This is another option I've never really tried myself, but I've heard it mentioned in regard to Star Wars RPGs lately. Take an established setting, pose a 'what if' question about some aspect of its timeline, work out how the timeline would diverge if that 'what if' had occurred, and then play in the alternate universe that forms from that.
The upside to this is, since you're already drastically changing canon, you can worry a lot less about being true to the original timeline. Also, even though it is gimmicky like the 'Wibbly Wobbly' option, it's a bit more of a repeatable gimmick: you can continue to play within this new timeline you've created, or you can create another 'what if' universe and explore new possibilities with it. The downside I can see with this is that it might such a drastic shift from established canon, some players will feel it's not 'proper' Firefly/Star Wars/Stargate/etc.
You'll have to weigh the potential pros and cons of any of these approaches against the answers to the earlier questions about your group's attitude towards canon.
Specific approaches to campaign setup aside, there are a couple other things you should be aware of when running games based on an established setting:
Canon Buffs: There is a chance that your group will include one or more players who know their trivia about your chosen setting better than you do and, will be more than ready to correct you if you get stuff wrong or miss out a detail they know about. This can be both good and bad. On the one hand, you can see these players as a useful information source to help fill in some of the blanks in the universe and enrich your roleplaying experience with extra detail. On the other hand, having players interject with interesting trivia every time it comes up can be a distraction which slows down the actual play for everyone.
You'll need to reach an agreement with such players, asking them to keep such information to themselves unless specifically called upon to help you with details you know you're fuzzy on. Beyond those moments when you call upon them, ask them to save any corrections or extra information until after the session and discuss it then.
Quotes/References: It's unavoidable that those of your players who are fans of the source material are going to want to make the occasional quote or reference to it. Heck, you as the GM may even throw in the odd call-back or reference of your own as a bit of fan service for the players. The problem is, it's likely not all of your players are fans (or not as big fans as others are). These quotes and references are probably going to make them feel a bit excluded, maybe even annoy them if they become common enough to be a distraction from the game. (And, again, if they plan on actually checking out the source material, there's a risk of spoilers.)
If the references are getting to to the point that they're more of a distraction from the game, then that's something you'll need to discuss with the players in question: just ask them to tone it down a bit. As for the less-invested players, try to encourage them to check out the source material. If it's a movie or TV show, maybe arrange a night for the group to watch it together. That way, it's more of a social thing, rather than feeling like homework for the player. Of course, if the player is resistant, for whatever reason, to checking out the source material then there's not much that can be done. You'll just need to take extra care as a GM to make the game accessible to them despite their unfamiliarity with the universe.
Well, that's all the insight I have into the matter of dealing with canon in roleplaying games. Bit long and rambling, but hopefully it'll be of some interest or use to you. If you have advice or thoughts of your own regarding the topic, please feel free to share them in the comments as I'm always interested in hearing from fellow GMs about topics like this.