To gain weight, you have to ultimately eat more, it is the easiest way of gaining weight, as you gain weight because you get more calories that you consume, that are transformed into bodyweight. However, even though it is the simpliest way of gaining weight, there are way more ways of doing so, but they are less efficient and more time consuming and energy demanding. I can suggest you doing everyday workouts. A daily warmup would take you 20 to 40 minutes every morning, but will help you gaining bodymass by creating muscles out of unused things your body has. I personally use "Keep" app, it is free and available for both Android and iOS. You can start with easier workouts, but I'd suggest going hard on yourself right from the start.
To gain bodyweight you have to also setup your daily routine, get time management. Healthy day is a key to a healthy body that leads to a healthy spirit. I'd suggest you waking up at 7 AM and going to sleep when the clock hits 11 PM.
If you have any drug addictions, like cigarettes or any other drugs, you should ultimately leave them in the past for good. They lead to bodyweight losses and you will never be able to construct a healthy body on unhealthy addictions.
Last, but not least is getting enough Vitamine D, that you can get from sunlight. Daily exposure to rays of the Sun is a very simple, but yet effective way to become healthier.