The usual "linear" way to regulate current in some load is in a closed loop, where negative feedback to an op-amp is perpetually monitoring and adjusting the current through the load:

simulate this circuit – Schematic created using CircuitLab
While this works, it's really inefficient. At full current (2A), the MOSFET is dissipating 5W of power, and will need serious cooling, with a big heat-sink and perhaps even a fan.
The best way to go, in my opinion, is going to be some kind of PWM, which Davide Andrea described in his answer. With PWM, the transistor is always switched completely on or off, and dissipates power only during transitions between those states. Without a control loop to measure current, and adjust the PWM output accordingly, control is hit-and-miss. You rely only on "such-and-such duty cycle corresponds roughly to such-and-such average inductor current", but maybe that's all you need.
However, there's no reason why you can't somehow measure coil current with the ADC on the microcontroller (which I do with resistor Rs in the circuit below), and implement feedback and a control loop in software.
Here's a PWM solution that uses a comparator with hysteresis to keep coil L1 current very close to the set-point determined by the potential at IN:

simulate this circuit
It's really just a relaxation oscillator, using the inductor (your coil) as the timing element, rather than the capacitor.
When the transistor is on, the coil is energised, and the current through it rises slowly. That current is sensed by Rs. When the voltage across Rs reaches some threshold, as detected by comparator U1, the transistor switches off. Coil current continues to flow, this time drawn via D1, and still passing via Rs, and the voltage across Rs falls. The comparator's threshold is slightly lower during this phase, due to positive feedback via R4 to implement hysteresis. When the voltage across Rs falls below this lower threshold, the transistor turns back on, and the process repeats.
The result is a current through the coil which oscillates about some mean value, set by applying a DC potential at IN, between 0V and 5V, corresponding to 0A and 2A respectively.
The fuse is there to prevent Rs from exploding if ever the transistor is permanently switched on, either through some circuit failure or failure of the transistor itself. Rs will dissipate nearly 1W at maximum current, so make it beefy.
Oscillation frequency will depend entirely on the inductance of the coil, so if you build this, you may need to experiment a bit, to make it operate at an appropriate frequency.
I've never built or tested this, so I can't vouch for it at all, but it's worth a try.
Here's the voltage at S, and the current through the coil, when the \$V_{IN}=3V\$:
