Gemstones can be acquired from Treasure Dungeons. B1 gives you a Tier 1 Gemstone Box, while B2 can give you a Tier 2 Gemstone Box. These Gemstones can then be placed into Accessories that have sockets unlocked. To unlock a socket, go to your Inventory and click on the "Sockets/Gemstones" button on the bottom left, and then going to the "Unlock Sockets" tab. You will then be required to put in Crystal Fragments and a Catalyst. A Catalyst is the exact same accessory that you are trying to unlock a socket for, with the same number of open sockets. For example, if you had a Savagery Necklace with 0 sockets open, you will need to pay 200 Crystal Fragments and another Savagery Necklace with 0 open sockets. Afterwards, your Savagery Necklace will have 1 socket open and you will lose the other Savagery Necklace. To open a second socket (if it has a second spot available), you would need another Savagery Necklace with 1 socket open to be sacrificed. Note that if that accessory you are sacrificing has a gemstone in the socket, it will also be lost, so make sure to go to the Equip tab and unequip the gemstone.

To upgrade a gemstone, you will need Gem Dust. You can get gem dust by dismantling gemstones, clearing hard dungeons, doing your "Toughen Up" daily missions, and converting 10 Obsidian Essences in Tria by talking to the NPC near the palace entrance. You can get Obsidian Essences by killing random monsters or killing World Bosses. Finally, you can also exchange Treva for gemstone dust and gemstones in Queenstown.
Maple Weeb's Video: