Your main question: yes, however you will improve MUCH quicker with a teacher, and they will also be able to point out bad habits that you may pick up and they will always be there to help you and answer all of your questions. However if you can't afford a teacher, there are plenty of free sites on the internet that can help get you started.
Also i'd like to point out, you have to not only buy the electric guitar($75-100+) but an amp ($50+), a guitar cable($5-8) some picks ($4), and a tuner($15). It might be a good idea to get a starter pack which includes most of this for a better price.
Please whatever you do, make sure you buy a tuner. You don't want to get home and not be able to play b/c you can't tune it.
When I read your question I got the feeling like you expect to be able to play GnR right off the bat. I have been playing guitar off and on for years, and although i don't play every day (I try to) it has taken me about 2 and a half years to be able to play Sweet Child of Mine (including the solo) and not mess up. Im just saying this because I dont want you to get your hopes up. Now im not saying you will never be able to play it, just realize it is going to take a lot of practice and time. If you are willing to put in the effort, eventually you will be able to play GnR songs and more.
This is what you should start off doing:
1. Learn all the parts of the guitar. For example, know what the bridge is, the nut, the saddle, the pegs, etc.
2. Learn the names of each string. When your guitar is in standard tuning the strings should be: E A D G B e (from top string to bottom) many people come up with phrases to help them remember this. My teacher told me to memorize "Every Adult Dog Growls Barks eats." yes, when I heard it I thought it was kinda stupid, but hey.. if it works.. why not?
3. Learn all of your basic chords. Start with G, C, and D. These are the three most used chords. Eventually you will want to know A, B, C, D, E, F, G. Then learn their minor chords, Am, Bm, Cm,...,Gm. Many people have that one chord that they just cant get. For me that was the F chord. I couldn't make my first finger bar over the bottom two strings, therefore it didnt sound right. So I found a song (Second Chance - Shinedown) that had the F chord in it, and played it to death.
The result? after playing it over and over my finger eventually got used to baring the two strings and I can play the chord perfect now :)
The best way to learn these chords are to find some songs you like and get the chords to them(www.ultimate-guitar.com) . Try to start out with slower songs until you can switch chords fast. You will probably be frustrated to begin with, 99% of people are when they first learn chords because they can't switch fast enough, dont worry the more you practice the faster you become.
4. Learn how to read guitar tabs. Eventually you will want to learn how to read sheet music( i cant do this yet) but for beginners, tab is much easier.
5. Once you understand how to read tabs, find some guitar tabs on the internet. The two main sites for this are "www.ultimate-guitar.com" and "www.911tabs..com" On both sites, you just type in the name of the song in the search bar, and it will give you a list. (I personally like ultimate guitar better) Try to find one that has at least four or five gold stars( the more stars it has, the better chance it is correct, you can also read comments to see if other people say it is good or it sucks)
Here are a few songs you can try out: These are all songs I have enjoyed playing. I'll put the difficulty beside each from a beginners viewpoint.
Smoke on the water - Deep Purple (intro, easy)
If I could be like that - 3 doors down (the intro, easy)
Sweet home alabama - various artists (intro, medium)
Crazy Train - Ozzy Osbourne (the intro, med-hard)
Tears Don't Fall - Bullet for my Valentine (the intro, hard)
Sweet Child Of Mine - GnR (the intro, really hard)
yea so.. basically the intro to each of those songs O.o
OK! well I am tired of typing and I have lost my train of thought haha. I will just end it here, if you have any more questions Id be happy to help. Just send me an email, "email@example.com" and I should reply within 1-2 days if not sooner.
Playing Electric guitar for 3-4 years.
I can play all of Sweet Child of Mine, and some Paradise City.
Fav solo right now: Hotel California :D