[root@localhost ~]# hostnamectl set-hostname --static pypi-server[root@pypi-server ~]# yum -y install epel-release.noarch # 安裝pip需要epel源[root@pypi-server ~]# yum -y install python-pip[root@pypi-server ~]# pip install pypiserver # 安裝pypiserver[root@pypi-server ~]# useradd pypi[root@pypi-server ~]# mkdir /usr/local/pypi/packages -p # 創建一個pypi存放python代碼的目錄[root@pypi-server ~]# chown pypi.pypi /usr/local/pypi -R[root@pypi-server ~]# cd /usr/local/pypi/packages/[root@pypi-server packages]# vim setup.py
from setuptools import setupsetup(name='maytest',version='0.0.1',packages=['maytest'])[root@pypi-server ~]# pypi-server -p 8080 /usr/local/pypi/packages/ # 加上&就可以后臺啟動了
192.168.57.1 - - [14/Jul/2020 03:56:17]"GET / HTTP/1.1" 200 1017
192.168.57.1 - - [14/Jul/2020 03:56:17]"GET /favicon.ico HTTP/1.1" 404 718# 瀏覽器訪問192.168.57.123:8080,就會顯示如下的界面,pypi服務啟動成功
Welcome to pypiserver!
This is a PyPI compatible package index serving 0 packages.To use this server with pip, run the following command:pip install --index-url http://192.168.57.123:8080/simple/ PACKAGE [PACKAGE2...]To use this server with easy_install, run the following command:easy_install --index-url http://192.168.57.123:8080/simple/ PACKAGE [PACKAGE2...]The complete list of all packages can be found here or via the simple index.This instance is running version 1.3.2 of the pypiserver software.