How do I set 'txindex = 1' in bitcoincore?
If you installed Bitcoin Core on linux, the config file is most likely found in ~/.bitcoin/bitcoin.conf

Edit bitcoin.conf file and just add txindex=1 anywhere you like on a new line, just make sure it's not commented out.