NOTE: If you add an empty file named ssh to the boot directory, ssh will be enabled when you first start your RPi (more info on the official website - section 3 - here). If you do this, you can connect your RPi via ethernet, ssh in (once you have your ip) and skip right to the update step below (step 7). If you do not want to do this, follow the initial setup instructions to connect peripherals below.
- connect rpi3 to monitor via HDMI
- connect internet via cat5
- insert usb for wireless keyboard and mouse (if using)
- plug in rpi3 with sd card installed with Raspbian Stretch with desktop
- select country & configure Raspbian
- open terminal -->
sudo raspi-config-->interfacing options --> SSH -->enable (allows ssh connection from MacBook); then navigate to VNC --> enable (allows GUI access) sudo apt-get update && sudo apt-get upgrade
If you installed the newest version of Raspian, skip to Install InstaPy
STEP 1: First install the dependencies needed to build.
sudo apt-get updatesudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
STEP 2: Compile (takes a while!)
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xztar xf Python-3.7.0.tar.xzcd Python-3.7.0./configure --prefix=/usr/local/opt/python-3.7.0make -j 4
STEP 3: Install
sudo make altinstall
STEP 4: Make Python 3.7 the default version, make aliases
sudo ln -s /usr/local/opt/python-3.7.0/bin/pydoc3.7 /usr/bin/pydoc3.7sudo ln -s /usr/local/opt/python-3.7.0/bin/python3.7 /usr/bin/python3.7sudo ln -s /usr/local/opt/python-3.7.0/bin/python3.7m /usr/bin/python3.7msudo ln -s /usr/local/opt/python-3.7.0/bin/pyvenv-3.7 /usr/bin/pyvenv-3.7sudo ln -s /usr/local/opt/python-3.7.0/bin/pip3.7 /usr/bin/pip3.7alias python3='/usr/bin/python3.7'echo "alias python3='/usr/bin/python3.7'" >> ~/.bashrc
STEP 5: Remove install files
cd ..sudo rm -r Python-3.7.0rm Python-3.7.0.tar.xz
sudo apt-get update && sudo apt-get upgrademkdir Projectscd Projectspython3 -m venv /home/pi/Projects/venv37source venv37/bin/activatepython3 -m pip install instapy -u
NOTE: the last step (6.) takes quite a while!
Navigate to the assets folder in your Workspace:
cd InstaPy/assets<-- or wherever your workspace is (note: you may have to runpython quickstart.pybefore)wget https://github.com/electron/electron/releases/download/v3.0.0-beta.5/chromedriver-v3.0.0-beta.5-linux-armv7l.zipunzip chromedriver-v3.0.0-beta.5-linux-armv7l.zip
NOTE: use headless_browser=True if you get an error running python quickstart.py!
Remove any versions of Firefox as it will conflict with the correct one installed below:
-
sudo apt-get remove firefox-esr -
sudo apt-get remove iceweasel -
sudo apt-get remove firefox -
echo 'deb http://q4os.org/qextrepo q4os-rpi-firefox-cn main' | sudo tee /etc/apt/sources.list.d/qextrepo.list -
wget -nv -O- http://q4os.org/qextrepo/q4a-q4os.gpg.pub | sudo apt-key add - -
sudo apt-get update -
sudo apt-get install firefox
Update GeckoDriver if needed. Instructions at the end of this document.
Firefox is not currently working correctly on Pi 2, to install a working version the following commands should be used:
Pi2.1. wget https://launchpad.net/~ubuntu-mozilla-security/+archive/ubuntu/ppa/+build/10930950/+files/firefox_49.0+build4-0ubuntu0.14.04.1_armhf.deb
Pi2.2 sudo dpkg -i firefox_49.0+build4-0ubuntu0.14.04.1_armhf.deb
Encountered some errors when trying to run the quickstart.py and ran the next 3 commands (all may not be necessary)
sudo pip install futuresudo apt-get install xvfbsudo pip install pyvirtualdisplaysudo reboot (may not be required, but no harm)
Assuming you've modified quickstart.py to your liking and added your Instagram login to instapy.py
sudo xvfb-run python quickstart.py
I installed TMUX to help run this headless, so that I can disconnect from the session and have the program continue to run on the rpi3
sudo apt-get install tmux (more info found here: https://github.com/tmux/tmux)- If using firefox, follow the example seen in
examples\firefoxExample.pyto set the default browser as Firefox
New releases can be found in: https://github.com/mozilla/geckodriver/releases
wget https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-arm7hf.tar.gztar -xvzf geckodriver-v*chmod +x geckodriversudo cp geckodriver /usr/local/bin/
If you've installed globally you can start quickstart on boot
sudo systemctl edit --force --full instapy.service- Edit the file and save with:
Description=InstaPy
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi
ExecStart=/usr/bin/python3 /home/pi/quickstart.py
[Install]
WantedBy=multi-user.target
Note: change ExecStart to wherever your quickstart.py is, and also note its specifying python3 here
3. systemctl enable instapy.service
You can check the most recent log lines with systemctl status instapy.service