I'm trying to install mongo-db on an ubuntu machine via a python script. If I were to do it manually, using the following steps found here, it works perfectly.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
sudo echo 'deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.lis
sudo apt-get update
sudo apt-get install mongodb-org
I'm representing these in python via a series of subprocess calls. What I have is as follows -
subprocess.call(["apt-key", "adv", "--keyserver", "hkp://keyserver.ubuntu.com:80", "--recv", "EA312927"])
subprocess.call(["echo", "deb", "http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse", "|", "tee", "/etc/apt/sources.list.d/mongodb-org-3.2.list"])
subprocess.call(["apt-get", "update"])
subprocess.call(["apt-get", "install", "mongodb-org"])
This seems to be correct based on python tutorials on the matter, and yet, the script seems to fail and mongodb is not installed.
Can anyone help me figure out whats wrong with these subprocess calls?