The PyPi mirror installer is a source-installation kit that installs a PyPi mirror and all its dependencies.
Feedback/bugs to: email@example.com
- Manuel Viera firstname.lastname@example.org [original author check: https://github.com/mviera/pypi-mirror]
- David Blewett [for this patch: https://bugs.launchpad.net/pypi-mirror/+bug/712989]
- Daniel Nouri [https://github.com/dnouri] for parts of his Kotti README
The installer will compile Nginx and it will install required python eggs from Pypi. (See "Dependencies" below.)
It's recommended to install PyPi Mirror inside a virtualenv.
First of all, edit buildout.cfg and modify the following parameters:
mirror-base at repository section. This is the directory where all packages will be downloaded.
mirror-base = /media/sd/pypi
url at mirror-config. That URL will be the URL for access to your PyPi mirror.
url = http://pypi.mviera.es
Once you have installed all required dependencies, you can continue with the installation process. So you execute the following command:
$ python2.6 bootstrap.py
You should have the buildout environment ready to go. Now, you must execute the buildout installation:
At the end, you should have the 'bin/pypimirror' binary. Now it's time to start downloading packages from PyPi executing the following command:
$ bin/pypimirror -I -c -v etc/pypi/pypimirror.cfg
The following packages are necessary to run buildout and install the PyPi mirror.:
setuptools gcc GNU make libpcre3-dev libssl-dev
You should run bin/supervisord and Nginx server should be automatically started.
To start Nginx,:
$HOME/bin/supervisorctl start nginx
To stop Nginx,:
$HOME/bin/supervisorctl stop nginx
To restart Nginx,:
$HOME/bin/supervisorctl restart nginx
To check status,:
$HOME/bin/supervisorctl status nginx
Also, you can access to Supervisor Admin Panel at:
(Use the default admin password in doc/adminPassword.txt)
To change the admin password, edit the supervisor part in buildout.cfg and run bin/buildout.
Password changes will not be reflected in doc/adminPassword.txt.
Nginx server runs on port 8080
Supervisord server runs on port 9000
Edit buildout.cfg and run bin/buildout to change ports.
Now, we have our PyPi mirror ready to go. We must to run the following command::
$HOME/bin/pypimirror -I -c -v $HOME/etc/pypi/pypimirror.cfg
This command will start downloading all packages from PyPi. When finished an index.html file will be generated containing an index with all downloaded packages.
At this time, you should be able to access to that index at:
When the buildout installation process has finished it configures a cron job for keeping the mirror up to date every two hours.
You can see this cron job executing the following command:
$ crontab -l
Edit the buildout.cfg and run bin/buildout to change the cron job execution frequency.
- Stop supervisord
- Remove the folder $HOME/pypi-mirror