forked from duty-machine/duty-machine
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: "玩转服务器—从卡顿到秒装,Conda焕新极速体验" | ||
date: 2025-01-16T00:29:04Z | ||
draft: ["false"] | ||
tags: [ | ||
"fetched", | ||
"生信菜鸟团" | ||
] | ||
categories: ["Acdemic"] | ||
--- | ||
玩转服务器—从卡顿到秒装,Conda焕新极速体验 by 生信菜鸟团 | ||
------ | ||
<div><section data-md5="d93a6" act="xmy"><section data-md5="d93a6"><section data-md5="d93a6"><section data-md5="d93a6"><section data-md5="d93a6"><section data-md5="d93a6"><section data-md5="d93a6"><p data-md5="d93a6"><strong data-md5="d93a6">滴水穿石 非一日之功</strong></p></section></section></section></section></section></section></section><p><br></p><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com"><h2 data-tool="mdnice编辑器"><span></span><span>conda</span><span></span></h2><p data-tool="mdnice编辑器"><code>conda</code> 是一个开源的包管理系统和环境管理工具,它能够帮助用户安装、更新、删除和管理各种软件包。<code>conda</code> 最初是由 <strong>Continuum Analytics</strong>(现为 Anaconda, Inc.)开发的,用于其推出的 <strong>Anaconda</strong> 发行版。在 conda 被创建之前,开发者面临着多个包管理工具和环境管理工具无法有效整合的问题。常见的包管理工具有 <code>pip</code>(Python包管理器),而环境管理工具(如 <code>virtualenv</code> 和 <code>venv</code>)则用于创建和管理隔离的 Python 环境。这些工具各自存在,并且无法完全解决依赖关系、跨语言软件包的管理等问题。而 <code>conda</code> 通过提供一个环境管理系统,允许用户在不同的虚拟环境中安装和使用不同版本的软件包,从而避免了软件依赖的冲突问题。因此广泛应用于数据科学、生物信息学、机器学习等领域。</p><p data-tool="mdnice编辑器">官网:https://www.anaconda.com/<br>安装包:https://www.anaconda.com/download/success</p><h2 data-tool="mdnice编辑器"><span></span><span>Anaconda 和 Miniconda</span><span></span></h2><ul data-tool="mdnice编辑器"><li><section><strong>Anaconda</strong> 是一个包含 Conda 和大部分数据科学工具的完整发行版,非常适合科研人员、数据科学家和工程师使用。</section></li><li><section><strong>Miniconda</strong> 是 Conda 的一个最小化版本,用户可以根据需要选择性地安装包和环境,适合对空间和安装包有更高需求的用户。</section></li></ul><h2 data-tool="mdnice编辑器"><span></span><span>在服务器安装</span><span></span></h2><p data-tool="mdnice编辑器">通常情况下我们只需要安装miniconda即可满足使用。</p><pre data-tool="mdnice编辑器"><span></span><code><span>#</span><span><span>#官网下载安装包</span></span><br>wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh<br><span>#</span><span><span>#文件大小141M</span></span><br><span>#</span><span>如果网速不好,也可以在镜像站下载安装包,比如:https://mirrors.pku.edu.cn/anaconda/miniconda/</span><br>wget -c https://mirrors.pku.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh<br><br>bash Miniconda3-latest-Linux-x86_64.sh<br><span>#</span><span><span>#小Tips 问「yes|no」:输入yes ;没有问「yes|no」直接按回车</span></span><br><span>#</span><span><span>#查看软件的知情同意,按 q 可直接退出查看</span></span><br><br>source ~/.bashrc<br></code></pre><figure data-tool="mdnice编辑器"><img data-imgfileid="100047275" data-ratio="0.1361111111111111" data-src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2AdOWTzzuGKBOr1B3dnX884N9iavdsc7WzCxicGOsHiaxY35jlVFoTJmh07w/640?wx_fmt=png&from=appmsg" data-type="png" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2AdOWTzzuGKBOr1B3dnX884N9iavdsc7WzCxicGOsHiaxY35jlVFoTJmh07w/640?wx_fmt=png&from=appmsg"><figcaption>官网下载</figcaption></figure><figure data-tool="mdnice编辑器"><img data-imgfileid="100047276" data-ratio="0.13055555555555556" data-src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2AdUKpLm6JkAT0BPyBIdwibLcKiaVXv0SLwUbh5nvMSlOiaMVNpTiabPs648Q/640?wx_fmt=png&from=appmsg" data-type="png" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2AdUKpLm6JkAT0BPyBIdwibLcKiaVXv0SLwUbh5nvMSlOiaMVNpTiabPs648Q/640?wx_fmt=png&from=appmsg"><figcaption>镜像站下载</figcaption></figure><figure data-tool="mdnice编辑器"><img data-imgfileid="100047278" data-ratio="0.5361111111111111" data-src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ados8VXibgdBFQicClSjk34XnwPqFmzpWRia1icpFBXkf8KgAD2YiboOr9ytQ/640?wx_fmt=png&from=appmsg" data-type="png" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ados8VXibgdBFQicClSjk34XnwPqFmzpWRia1icpFBXkf8KgAD2YiboOr9ytQ/640?wx_fmt=png&from=appmsg"><figcaption>北大镜像</figcaption></figure><h2 data-tool="mdnice编辑器"><span></span><span>常用命令</span><span></span></h2><pre data-tool="mdnice编辑器"><span></span><code><span>#</span><span><span>#创建环境</span></span><br>conda create -n test python=3.8<br><span><br>#</span><span><span>#查看环境</span></span><br>conda info --envs<br>conda info -e<br><span><br>#</span><span><span>#安装软件或者指定版本安装</span></span><br>conda install -y fastqc<br>conda install gnuplot=4.6.2<br><span><br>#</span><span><span>#删除某一个软件</span></span><br>conda uninstall fastqc<br><span>#</span><span><span>#删除环境</span></span><br>conda remove -n test --all<br><span><br>#</span><span><span>#创建.condarc 文件</span></span><br>conda config<br><span><br>#</span><span><span>#conda清理环境缓存</span></span><br>conda clean -i<br><span><br>#</span><span><span>#查看当前的channel设置</span></span><br>conda config --show-sources<br><span>#</span><span><span>#查看channel状态和优先级</span></span><br>conda config --get channels<br><span><br>#</span><span><span>#查看帮助文档</span></span><br>conda --help<br></code></pre><h2 data-tool="mdnice编辑器"><span></span><span>conda 镜像</span><span></span></h2><p data-tool="mdnice编辑器">conda 镜像是 conda 包管理工具用来下载和安装软件包的服务器或存储库的副本。镜像通常是某个官方服务器的完全复制,分布在不同的地理位置,以提高下载速度、降低网络延迟,并减轻原始服务器的负载。默认情况下,conda 从官方的 <code>defaults</code> 或其他频道(如 <code>conda-forge</code>)下载包。如果用户的网络连接到官方服务器速度较慢(例如国内用户访问国外的服务器),使用镜像可以显著提高下载速度。常用的镜像有清华大学镜像、北京外国语大学镜像、中科大镜像、阿里云镜像 等等。不过,即便国内有这些公共镜像,但是因为种种原因,镜像源难免有不稳定的时候,导致用户无法顺利安装软件。<strong>为了提升我们服务器的使用体验,我们专门搭建了服务器内网镜像</strong>。</p><h3 data-tool="mdnice编辑器"><span></span><span>共享服务器内网镜像</span><span></span></h3><p data-tool="mdnice编辑器">我们的内网镜像后面会进行统一设置。自己设置也很简单,只需修改自己家目录下的<code>.condarc</code> 文件,内容如下:</p><pre data-tool="mdnice编辑器"><span></span><code>channels:<br> - defaults<br>show_channel_urls: true<br>default_channels:<br> - http://10.10.11.66:8181/pkgs/main<br> - http://10.10.11.66:8181/pkgs/r<br> - http://10.10.11.66:8181/cloud/conda-forge<br> - http://10.10.11.66:8181/cloud/bioconda<br> - http://10.10.11.66:8181/pkgs/free<br>custom_channels:<br> prtorch: http://10.10.11.66:8181/cloud/pytorch<br> Paddle: http://10.10.11.66:8181/cloud/Paddle<br> qiime2: http://10.10.11.66:8181/cloud/qiime2<br></code></pre><p data-tool="mdnice编辑器">在同一台服务器,不同的账号,安装conda后,创建小环境,我们来测试一下看看内网镜像的效果:</p><pre data-tool="mdnice编辑器"><span></span><code>conda create -n test <br><br>conda install -y hdf5<br>conda install -y tensorflow<br></code></pre><figure data-tool="mdnice编辑器"><img data-imgfileid="100047277" data-ratio="0.8583333333333333" data-src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2AdICAkROxGpKYSVGXOHOD9JafqAOKxnkQdtmCW2BUNTFC0MwxhyTToibg/640?wx_fmt=png&from=appmsg" data-type="png" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2AdICAkROxGpKYSVGXOHOD9JafqAOKxnkQdtmCW2BUNTFC0MwxhyTToibg/640?wx_fmt=png&from=appmsg"><figcaption>两个账号的镜像设置</figcaption></figure><h4 data-tool="mdnice编辑器"><span></span><span>设置内网镜像的账号 (账号1):</span><span></span></h4><figure data-tool="mdnice编辑器"><img data-imgfileid="100047279" data-ratio="0.9666666666666667" data-src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ad9DYgIiavYwretk0wM8OacK1LIsMibtsic8IdGGQjnx06hQjnqQV3hY5XA/640?wx_fmt=png&from=appmsg" data-type="png" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ad9DYgIiavYwretk0wM8OacK1LIsMibtsic8IdGGQjnx06hQjnqQV3hY5XA/640?wx_fmt=png&from=appmsg"></figure><figure data-tool="mdnice编辑器"><img data-imgfileid="100047282" data-ratio="0.40555555555555556" data-src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2AdmfiaqfASxjicMwOa0qcMqUOSsB2zUCnfHZFqOL0vJL6XibKZW9SXBeyCg/640?wx_fmt=png&from=appmsg" data-type="png" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2AdmfiaqfASxjicMwOa0qcMqUOSsB2zUCnfHZFqOL0vJL6XibKZW9SXBeyCg/640?wx_fmt=png&from=appmsg"></figure><p data-tool="mdnice编辑器">可以看到,不管大小文件,即便1.6G的安装文件,也可以很快下载,不到2分钟就搞定。</p><h4 data-tool="mdnice编辑器"><span></span><span>使用默认镜像的账号(账号2):</span><span></span></h4><figure data-tool="mdnice编辑器"><img data-imgfileid="100047284" data-ratio="1.4425925925925926" data-src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ad6f3VSXYWWDzw1iczTGO24E3SdPzOt1CyM60LH3HHq78jdACJQR1DMKw/640?wx_fmt=png&from=appmsg" data-type="png" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ad6f3VSXYWWDzw1iczTGO24E3SdPzOt1CyM60LH3HHq78jdACJQR1DMKw/640?wx_fmt=png&from=appmsg"></figure><figure data-tool="mdnice编辑器"><img data-imgfileid="100047283" data-ratio="0.3851851851851852" data-src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ad2siaOCSwSkvK3lHZqS8LLdEicwFGtVos9PpH3W8ibICdjINiaIa1T6dsTw/640?wx_fmt=png&from=appmsg" data-type="png" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_png/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ad2siaOCSwSkvK3lHZqS8LLdEicwFGtVos9PpH3W8ibICdjINiaIa1T6dsTw/640?wx_fmt=png&from=appmsg"></figure><p data-tool="mdnice编辑器">安装不仅耗时多,而且还出现了网络报错。</p><h3 data-tool="mdnice编辑器"><span></span><span>其他公共镜像</span><span></span></h3><p data-tool="mdnice编辑器">如果我们的内网镜像不能满足你的需求,也可以网上查找一些公共镜像,如果仍然网络报错,可以尝试切换不同的镜像测试。下面是一些镜像示例:</p><h4 data-tool="mdnice编辑器"><span></span><span>北外镜像</span><span></span></h4><pre data-tool="mdnice编辑器"><span></span><code>conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/ <br>conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/ <br>conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/ <br>conda config --set show_channel_urls yes <br></code></pre><h4 data-tool="mdnice编辑器"><span></span><span>北大镜像</span><span></span></h4><pre data-tool="mdnice编辑器"><span></span><code>conda config --add channels https://mirrors.pku.edu.cn/anaconda/cloud/bioconda/<br>conda config --add channels https://mirrors.pku.edu.cn/anaconda/cloud/conda-forge/<br>conda config --add channels https://mirrors.pku.edu.cn/anaconda/pkgs/main/<br>conda config --set show_channel_urls yes<br></code></pre><h4 data-tool="mdnice编辑器"><span></span><span>阿里镜像</span><span></span></h4><pre data-tool="mdnice编辑器"><span></span><code>conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/msys2<br>conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/bioconda<br>conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/main<br>conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/r<br>conda config --set show_channel_urls yes<br></code></pre><h4 data-tool="mdnice编辑器"><span></span><span>南方科技大学镜像</span><span></span></h4><pre data-tool="mdnice编辑器"><span></span><code>conda config --add channels https://mirrors.sustech.edu.cn/anaconda/cloud/bioconda/<br>conda config --add channels https://mirrors.sustech.edu.cn/anaconda/cloud/conda-forge/<br>conda config --add channels https://mirrors.sustech.edu.cn/anaconda/pkgs/main/<br>conda config --set show_channel_urls yes<br></code></pre><hr data-tool="mdnice编辑器"><blockquote data-tool="mdnice编辑器"><span></span><p>如果你也需要共享服务器,详见:<a href="https://mp.weixin.qq.com/s?__biz=MzUzMTEwODk0Ng==&mid=2247530048&idx=1&sn=28aa7bbd5e00521f79e074496a5f5d66&scene=21#wechat_redirect" data-linktype="2">满足你生信分析计算需求的低价解决方案</a>福利抢购方式</p><figure><img data-imgfileid="100047281" data-ratio="1.7777777777777777" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ad3dDTtwNichKRArkAPvsEK4PJWQ10fRQlo4eFEnOxmWzxXEBnd1DVrJQ/640?wx_fmt=jpeg&from=appmsg" data-type="jpeg" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_jpg/iaRJcrq2Los8pwau2XygOQ10icdpwYJ2Ad3dDTtwNichKRArkAPvsEK4PJWQ10fRQlo4eFEnOxmWzxXEBnd1DVrJQ/640?wx_fmt=jpeg&from=appmsg"><figcaption>还等什么呢,赶快扫描下面二维码添加微信抢购吧!</figcaption></figure></blockquote></section><p><br></p><section><section act="xmy"><section data-id="123409" data-type="lspecial02,lspecial04" powered-by="xmyeditor.com" data-md5="8b46d"><section powered-by="xmyeditor.com" data-md5="8b46d"><section powered-by="xmyeditor.com" data-md5="8b46d"><section powered-by="xmyeditor.com" data-md5="8b46d"><br></section><section powered-by="xmyeditor.com" data-md5="8b46d"><img data-imgfileid="100047274" data-ratio="0.6940298507462687" data-src="https://mmbiz.qpic.cn/mmbiz_gif/iaRJcrq2LosibrvQnXTV3PMktpwwmDsjia2JG4e3ibpLQ1G6M4nktW4PiaiaKfnpiaRmNbTT6St7QLfzAMAomKgWxQ4kA/640?wx_fmt=gif&wxfrom=5&wx_lazy=1&tp=webp" data-type="gif" data-w="134" src="https://mmbiz.qpic.cn/mmbiz_gif/iaRJcrq2LosibrvQnXTV3PMktpwwmDsjia2JG4e3ibpLQ1G6M4nktW4PiaiaKfnpiaRmNbTT6St7QLfzAMAomKgWxQ4kA/640?wx_fmt=gif&wxfrom=5&wx_lazy=1&tp=webp"></section><section powered-by="xmyeditor.com" data-md5="8b46d"><br></section></section></section></section></section></section><p><span></span><br></p><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com"><h4 data-tool="mdnice编辑器">文末友情宣传</h4><p data-tool="mdnice编辑器">强烈建议你推荐给身边的<strong>博士后以及年轻生物学PI</strong>,多一点数据认知,让他们的科研上一个台阶:</p><ul data-tool="mdnice编辑器"><li><section><a target="_blank" href="https://mp.weixin.qq.com/s?__biz=MzUzMTEwODk0Ng==&mid=2247530582&idx=2&sn=7178b8dd66ce3eb492fc2b65d4ea1c30&scene=21#wechat_redirect" textvalue="生信入门&数据挖掘线上直播课2025年1月班" linktype="text" imgurl="" imgdata="null" data-itemshowtype="11" tab="innerlink" data-linktype="2"><strong>生信入门&数据挖掘线上直播课2025年1月班</strong></a><strong>,你的生物信息学入门课</strong></section></li><li><section><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzAxMDkxODM1Ng==&mid=2247524148&idx=1&sn=7806da6feb41a36493c519c1cfc1d3ac&chksm=9b4bdf8fac3c569960369602f1ef26639cb366b250f233b2297d1f059471c0458335bfc0b829&scene=21#wechat_redirect" textvalue="时隔5年,我们的生信技能树VIP学徒继续招生啦" linktype="text" imgurl="" imgdata="null" data-itemshowtype="0" tab="innerlink" data-linktype="2" hasload="1"><strong>时隔5年,我们的生信技能树VIP学徒继续招生啦</strong></a><br></section></li><li><p><a target="_blank" href="https://mp.weixin.qq.com/s?__biz=MzUzMTEwODk0Ng==&mid=2247530048&idx=1&sn=28aa7bbd5e00521f79e074496a5f5d66&scene=21#wechat_redirect" textvalue="满足你生信分析计算需求的低价解决方案" linktype="text" imgurl="" imgdata="null" data-itemshowtype="0" tab="innerlink" data-linktype="2"><strong>满足你生信分析计算需求的低价解决方案</strong></a></p></li></ul></section><p><mp-style-type data-value="10000"></mp-style-type></p></div> | ||
<hr> | ||
<a href="https://mp.weixin.qq.com/s/ZvKqEd3SvHY5STGWAIg0hQ",target="_blank" rel="noopener noreferrer">原文链接</a> |