over 7 years ago

I had the pleasure of setting up my own pypi server last week because the server I had to work with is behind a corporate firewall.

To setup your own pypi server, here is what to do:

  1. Download pypiserver, then:
unzip pypiserver-1.1.10
cd pypiserver-1.1.10
python setup.py install

Config pypyserver settings:

cd ~
touch .pypirc

Enter the following info in to .pypirc:

[distutils]
index-servers =
  pypi
  local

[pypi]
username:
password:

[local]
repository: http://localhost:8080
username:
password: 

Setup the packages dir, this is the place where you store the packages:

cd ~
mkdir packages

Run!

pypi-server -p 8080 ~/packages

You might want to keep the server running even after you logout of terminal:

nohup pypi-server -p 8080 ~/packages &

You need to stuff your packages folder so that there will be something for pip install, here are essential packages you need to at least get a virtual environment running:

  • pbr
  • pip
  • setuptools
  • six
  • stevedore
  • virtualenv
  • virtualenv-clone
  • virtualenvwrapper
  • wheel

To download these packages, just go to https://pypi.python.org/pypi/ and search for the package name, then download the tar.gz version of that package. Once downloaded, move the zip file to the ~/packages folder.

To verify that the server is up and running, simply go to localhost:8080/simple/, you should see a list of package names (or empty if you haven't copied any packages into the packages folder yet).

Config your client to download python packages from your server:

cd ~
mkdir .pip
touch .pip/pip.conf

Put the following lines into pip.conf

[global]
index-url = http://localhost:8080/simple
[install]
trusted-host = localhost

Done! Try using pip install and it will download a package instantly from your ~/packages folder and install it :)

← Django compress image before saving Django admin login keeps redirecting back to login page →
 
comments powered by Disqus