1.Linux如何安装软件?
联想一下我们在手机上如何安装软件?是不是在app store(应用商店)里搜索并安装。
而Linux的应用商店是conda,所以如果想在Linux安装软件,就得给我的服务器下载conda,我们使用conda的精华版--miniconda
下面开始安装和配置miniconda吧!
如何下载miniconda?
百度搜索“miniconda清华“点进去之后会出现一个界面
可见linux下面有64-bit(x86_64)、32-bit(x86)两种版本,那我应该选择哪个呢?
这取决于我的服务器是多少位的,可以输入命令uname -a
来查看。
(base) bio17@VM-0-10-ubuntu:~$ uname -a
Linux VM-0-10-ubuntu 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
把miniconda下载到昨天新建的soft目录中吧!怎么做呢?
先输入cd soft
指令进入soft目录中。
右键复制选中的下载链接
然后使用wget
指令,点一下右键,即可将刚刚所复制的下载链接粘贴到wget
指令后面,回车键开始下载
.sh是脚本的后缀,所以其实这下载的是一个脚本,如果安装失败也不需要重新下载这个脚本,还可以用。
如何安装miniconda?
输入指令
bash Miniconda3-latest-Linux-x86_64.sh
按回车跳过安装过程
Thank you for installing Miniconda3!
miniconda安装成功
【注意】最后还要激活conda
使用命令source ~/.bashrc
来激活conda,接着命令行输入conda
(base) bio17@VM-0-10-ubuntu:~/soft$ conda
usage: conda [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
Options:
positional arguments:
command
clean Remove unused packages and caches.
config Modify configuration values in .condarc. This is modeled
after the git config command. Writes to the user .condarc
file (/home/bio17/.condarc) by default.
create Create a new conda environment from a list of specified
packages.
help Displays a list of available conda commands and their help
strings.
info Display information about current conda install.
init Initialize conda for shell interaction. [Experimental]
install Installs a list of packages into a specified conda
environment.
list List linked packages in a conda environment.
package Low-level conda package utility. (EXPERIMENTAL)
remove Remove a list of packages from a specified conda environment.
uninstall Alias for conda remove.
run Run an executable in a conda environment. [Experimental]
search Search for packages and display associated information. The
input is a MatchSpec, a query language for conda packages.
See examples below.
update Updates conda packages to the latest compatible version.
upgrade Alias for conda update.
optional arguments:
-h, --help Show this help message and exit.
-V, --version Show the conda version number and exit.
conda commands available from other packages:
env
出现这样满屏的信息说明就成功了安装conda
添加镜像
将以下代码复制并输入到命令行即可
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
conda config --set show_channel_urls yes
使用conda
1.查看当前所有软件列表
命令:conda list
(base) bio17@VM-0-10-ubuntu:~/soft$ conda list
# packages in environment at /home/bio17/miniconda3:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
_openmp_mutex 4.5 0_gnu https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ca-certificates 2019.11.28 hecc5488_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
certifi 2019.11.28 py37hc8dfbb8_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cffi 1.14.0 py37hd463f26_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
chardet 3.0.4 py37_1003 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda 4.8.2 py37_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda-package-handling 1.6.0 py37h516909a_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cryptography 2.8 py37h72c5cf5_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
idna 2.9 py_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libedit 3.1.20181209 hc058e9b_0 defaults
libffi 3.2.1 he1b5a44_1006 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgcc-ng 9.2.0 h24d8f2e_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgomp 9.2.0 h24d8f2e_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libstdcxx-ng 9.2.0 hdf63c60_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ncurses 6.1 hf484d3e_1002 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
openssl 1.1.1d h516909a_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pip 20.0.2 py_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pycosat 0.6.3 py37h8f50634_1003 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pycparser 2.20 py_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pyopenssl 19.1.0 py_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pysocks 1.7.1 py37_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
python 3.7.4 h265db76_1 defaults
python_abi 3.7 1_cp37m https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
readline 7.0 hf8c457e_1001 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
requests 2.23.0 py37_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ruamel_yaml 0.15.80 py37h516909a_1000 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
setuptools 46.0.0 py37hc8dfbb8_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
six 1.14.0 py37_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
sqlite 3.31.1 h7b6447c_0 defaults
tk 8.6.10 hed695b0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
tqdm 4.43.0 py_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
urllib3 1.25.7 py37_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
wheel 0.34.2 py_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
xz 5.2.4 h14c3975_1001 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
yaml 0.2.2 h516909a_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
zlib 1.2.11 h516909a_1006 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
2.搜索软件
命令:conda search fastqc
(以软件fastqc为例)
(base) bio17@VM-0-10-ubuntu:~/soft$ conda search fastqc
Loading channels: done
# Name Version Build Channel
fastqc 0.10.1 0 anaconda/cloud/bioconda
fastqc 0.10.1 1 anaconda/cloud/bioconda
fastqc 0.11.2 1 anaconda/cloud/bioconda
fastqc 0.11.2 pl5.22.0_0 anaconda/cloud/bioconda
fastqc 0.11.3 0 anaconda/cloud/bioconda
fastqc 0.11.3 1 anaconda/cloud/bioconda
fastqc 0.11.4 0 anaconda/cloud/bioconda
fastqc 0.11.4 1 anaconda/cloud/bioconda
fastqc 0.11.4 2 anaconda/cloud/bioconda
fastqc 0.11.5 1 anaconda/cloud/bioconda
fastqc 0.11.5 4 anaconda/cloud/bioconda
fastqc 0.11.5 pl5.22.0_2 anaconda/cloud/bioconda
fastqc 0.11.5 pl5.22.0_3 anaconda/cloud/bioconda
fastqc 0.11.6 2 anaconda/cloud/bioconda
fastqc 0.11.6 pl5.22.0_0 anaconda/cloud/bioconda
fastqc 0.11.6 pl5.22.0_1 anaconda/cloud/bioconda
fastqc 0.11.7 4 anaconda/cloud/bioconda
fastqc 0.11.7 5 anaconda/cloud/bioconda
fastqc 0.11.7 6 anaconda/cloud/bioconda
fastqc 0.11.7 pl5.22.0_0 anaconda/cloud/bioconda
fastqc 0.11.7 pl5.22.0_2 anaconda/cloud/bioconda
fastqc 0.11.8 0 anaconda/cloud/bioconda
fastqc 0.11.8 1 anaconda/cloud/bioconda
fastqc 0.11.8 2 anaconda/cloud/bioconda
fastqc 0.11.9 0 anaconda/cloud/bioconda
3.安装软件
命令:conda install fastqc -y
(加上-y是自动安装)默认安装最新版本
如果想安装指定版本号,可以使用命令conda install fastqc=0.11.7 -y
(base) bio17@VM-0-10-ubuntu:~/soft$ conda install fastqc=0.11.7 -y
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/bio17/miniconda3
added / updated specs:
- fastqc=0.11.7
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2019.11.28 | py37hc8dfbb8_1 149 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
------------------------------------------------------------
Total: 149 KB
The following NEW packages will be INSTALLED:
4.卸载软件
命令:conda remove fastqc -y
(base) bio17@VM-0-10-ubuntu:~/soft$ conda remove fastqc=0.11.7 -y
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/bio17/miniconda3
removed specs:
- fastqc=0.11.7
The following packages will be downloaded:
package | build
---------------------------|-----------------
six-1.14.0 | py_1 13 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
------------------------------------------------------------
Total: 13 KB
The following packages will be REMOVED:
alsa-lib-1.1.5-h516909a_1002
fastqc-0.11.7-6
5.查看和新建conda环境
- 命令
conda info --envs
查看当前conda有哪些环境
(base) bio17@VM-0-10-ubuntu:~/soft$ conda info --envs
# conda environments:
#
base * /home/bio17/miniconda3
前面带*号的环境就是默认环境,可以看到我们目前就一个conda环境
- 命令:
conda create -n rna-seq python=3 fastqc trimmomatic -y
新建一个名为rna-seq的conda环境,然后指定python的版本是3,安装软件fastqc和trimmonatic(这些都可以一步完成)
现在来创建一个上述的新的conda环境吧
(base) bio17@VM-0-10-ubuntu:~/soft$ conda create -n rna-seq python=3 fastqc trimmomatic -y
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/bio17/miniconda3/envs/rna-seq
added / updated specs:
- fastqc
- python=3
- trimmomatic
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2019.11.28 | py38h32f6830_1 149 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ld_impl_linux-64-2.33.1 | h53a641e_8 589 KB https://mirror
创建完成后,用命令conda info --envs
来查看一下我的conda环境是否新增了一个rna-seq呢?
(base) bio17@VM-0-10-ubuntu:~/soft$ conda info --envs
# conda environments:
#
base * /home/bio17/miniconda3
rna-seq /home/bio17/miniconda3/envs/rna-seq
可以看到,默认 * 还是base,只有激活新的conda环境rna-seq,* 号才能转移到rna-seq前面
- 命令:
conda activate rna-seq
激活新环境rna-seq,试一下吧
(base) bio17@VM-0-10-ubuntu:~/soft$ conda activate rna-seq
(rna-seq) bio17@VM-0-10-ubuntu:~/soft$ conda info --envs #查看一下当前默认环境是否发生改变
# conda environments:
#
base /home/bio17/miniconda3
rna-seq * /home/bio17/miniconda3/envs/rna-seq
- 命令
fastqc
可以直接调用软件fastqc,如果出现一大片帮助信息,说明现在可以直接使用fastqc软件了
(rna-seq) bio17@VM-0-10-ubuntu:~/soft$ fastqc
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:208)
at java.desktop/java.awt.Window.(Window.java:548)
at java.desktop/java.awt.Frame.(Frame.java:423)
at java.desktop/java.awt.Frame.(Frame.java:388)
at java.desktop/javax.swing.JFrame.(JFrame.java:180)
at uk.ac.babraham.FastQC.FastQCApplication.(FastQCApplication.java:63)
at uk.ac.babraham.FastQC.FastQCApplication.main(FastQCApplication.java:338)