总是忘记模块地址,还是记下为好。
1. 安装cpanm
cpanm其实是一个可执行文件而已。将它下载到bin目录,然后添加执行权限就可以了。
# wget -O /usr/bin/cpanm; chmod +x /usr/bin/cpanm
2. 使用cpanm安装模块
# cpanm -h
-v,--verbose Turns on chatty output
-q,--quiet Turns off the most output
--interactive 开启交互配置(required for Task:: modules)
-f,--force 强制安装
-n,--notest Do not run unit tests
--test-only 只测试不安装
-S,--sudo sudo to run install commands
--installdeps 只安装依赖模块
--showdeps 只显示依赖信息
--reinstall 重新安装
--mirror 指定镜像url (e.g. )
--mirror-only 只从镜像下载
--prompt Prompt when configure/build/test fails
-l,--local-lib Specify the install base to install modules
-L,--local-lib-contained Specify the install base to install all non-core modules
--self-contained Install all non-core modules, even if they're already installed.
--auto-cleanup Number of days that cpanm's work directories expire in. Defaults to 7
Examples:
cpanm Test::More # install Test::More
cpanm MIYAGAWA/Plack-0.99_05.tar.gz # full distribution path
cpanm # install from URL
cpanm ~/dists/MyCompany-Enterprise-1.00.tar.gz # install from a local file
cpanm --interactive Task::Kensho # Configure interactively
cpanm . # install from local directory
cpanm --installdeps . # install all the deps for the current directory
cpanm -L extlib Plack # install Plack and all non-core deps into extlib
cpanm --mirror DBI # use the fast-syncing mirror
参数名直接为模块名称
如,安装MongoDB模块
# cpanm MongoDB
--> Working on MongoDB
Fetching ... OK
Configuring MongoDB-0.702.0 ... OK
==> Found dependencies: DateTime, Tie::IxHash, Data::Types, DateTime::Tiny, Class::Method::Modifiers, boolean, Moose, File::Slurp, Try::Tiny, Test::Exception, ExtUtils::MakeMaker, Test::Warn, File::Temp, JSON
--> Working on DateTime
...... //自动解决依赖模块
为了加快下载速度, 可以指定使用镜像,并只从镜像下载:
3. 删除模块
安装App::pmuninstall模块:
# cpanm App::pmuninstall
删除模块:
# pm-uninstall MongoDB
4. 实际使用#######
wget -O /usr/bin/cpanm --no-check-certificate; chmod +x /usr/bin/cpanm
镜像安装
cpanm --mirror --mirror-only MongoDB
阅读(1890) | 评论(0) | 转发(0) |