linux 离线安装各种依赖

linux 离线安装各种依赖

因为客户的机器是内网,不能访问外网,需要把所有的yum 包,python包都提前离线安装好。

下载yum包

yum install epel-release   # 这个软件包会自动配置yum的软件仓库。

yumdownloader --resolve redis

# yumdownloader 可以只下载不安装
# 如果提示没有yumdownloader 命令,需要先yum install yum-utils


rpm  -ivh  *.rpm --nodeps --force # 安装该文件夹下所有的rpm包

添加yum仓库

  • 方法1:
echo "[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" > /etc/yum.repos.d/mariadb.repo
rpm -iUvh https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
  • 方法2:
rpm -iUvh https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm

下载python包

pip install -r requirements.txt -t /dir/dir  # 下载requirements.txt 里的到指定的目录

# 下载到本地
pip download -d /path/to/your/packages_path/ -r requirement.txt

"""
有时候安装某些包的时候会有错误提示,
1)The required version of setuptools (>=3.4.4) is not available,
    and can't be installed while this script is running. Please
    install a more recent version first, using
    'easy_install -U setuptools'.

这个错误提示需要先升级setuptools,pip install --upgrade setuptools

2)EnvironmentError: mysql_config not found

yum install mysql-devel -y
"""

# 从本地目录安装
pip install --no-index --find-links=/path/to/your/packages_path/ -r requirements.txt
# python  linux 

右下角对话与我联系。


评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×