First, one must commit an offense that will result in incarceration, preferably six months or greater in duration.
Second, cigarettes are a fungible asset in prison. Therefore, it is imperative to eschew any form of fiat currency. There are support groups for this.
Third, get a hobby. Meditation, yoga, and other forms of asceticism are easy to take up in a confined space.