注意:本人系统为centos7
本人在安装ktorrent时,发现默认的YUM源里安装不了ktorrent,需要手动给YUM添加源,丰富YUM软件源!
1.安装之前先看一下初始状态下yum的源,只有3个:base/extras/updates
[liuyao@localhost ~]$ yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.cug.edu.cn
* extras: mirrors.cug.edu.cn
* updates: mirrors.cug.edu.cn
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base 9,007
extras/7/x86_64 CentOS-7 - Extras 265
updates/7/x86_64 CentOS-7 - Updates 1,401
repolist: 10,673
2.查看系统架构和版本
[liuyao@localhost ~]$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
[liuyao@localhost ~]$ rpm -q centos-release
centos-release-7-2.1511.el7.centos.2.10.x86_64
[liuyao@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
可知,本人系统架构为x86_64,系统版本为7.2.1511
3.去EPEL官网下载与系统架构和版本相对应的EPEL源
[root@localhost yum-repositories]$ ls
epel-release-latest-7.noarch.rpm
[root@localhost yum-repositories]# rpm -ivh epel-release-latest-7.noarch.rpm
警告:epel-release-latest-7.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:epel-release-7-6 ################################# [100%]
4.更新好YUM源后,最好立刻手动更新一下,使操作立即生效
[root@localhost yum-repositories]# yum makecache
5.此时查看YUM源,可以看到多了一个epel
[root@localhost yum-repositories]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.opencas.cn
* epel: mirrors.opencas.cn
* extras: mirrors.opencas.cn
* updates: mirrors.opencas.cn
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base 9,007
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 10,018
extras/7/x86_64 CentOS-7 - Extras 265
updates/7/x86_64 CentOS-7 - Updates 1,401
repolist: 20,691
详细请参考:https://blog.itnmg.net/centos-yum-source/
1.添加YUM源
[root@localhost yum-repositories]# ls
epel-release-latest-7.noarch.rpm remi-release-7.rpm rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
[root@localhost yum-repositories]# rpm -ivh remi-release-7.rpm
警告:remi-release-7.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 00f97f56: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:remi-release-7.1-3.el7.remi ################################# [100%]
[root@localhost yum-repositories]# rpm -ivh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
警告:rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 6b8d79e6: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:rpmforge-release-0.5.3-1.el7.rf ################################# [100%]
[root@localhost yum-repositories]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
获取https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
警告:/var/tmp/rpm-tmp.nKcd1X: 头V4 RSA/SHA1 Signature, 密钥 ID 62e74ca5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:webtatic-release-7-3 ################################# [100%]
[root@localhost yum-repositories]# yum clean all
[root@localhost yum-repositories]# yum update
[root@localhost yum-repositories]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* epel: mirrors.opencas.cn
* extras: mirror.bit.edu.cn
* remi-safe: mirror.innosol.asia
* rpmforge: mirrors.neusoft.edu.cn
* updates: mirror.bit.edu.cn
* webtatic: us-east.repo.webtatic.com
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base 9,007
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 10,018
extras/7/x86_64 CentOS-7 - Extras 265
remi-safe Safe Remi's RPM repository for Enterprise Linux 7 - x86_64 798
rpmforge RHEL 7 - RPMforge.net - dag 245
updates/7/x86_64 CentOS-7 - Updates 1,401
webtatic/x86_64 Webtatic Repository EL7 - x86_64 276
repolist: 22,010
2.若想停用某个YUM源,只需要在相应的配置文件中设置enable=0即可,如
[root@localhost yum.repos.d]# vim /etc/yum.repos.d/epel.repo
3.最后需要设置源的管理策略,比如设置各个源的优先级,方法:
3.1.安装yum-priorities插件
[root@localhost yum-repositories]# yum install yum-priorities
3.2.设置/etc/yum.repos.d/目录下的.repo相关文件,在文件中插入priority=N(N为1-99的整数,数字越小优先级越高)
[root@localhost yum-repositories]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-Media.repo epel-testing.repo remi-php70.repo webtatic-archive.repo
CentOS-CR.repo CentOS-Sources.repo mirrors-rpmforge remi.repo webtatic.repo
CentOS-Debuginfo.repo CentOS-Vault.repo mirrors-rpmforge-extras remi-safe.repo webtatic-testing.repo
CentOS-fasttrack.repo epel.repo mirrors-rpmforge-testing rpmforge.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
priority=1
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
priority=1
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
priority=1
注意:在添加Remi/php源之前需要先添加EPEL
添加常用YUM源完毕!
添加完YUM源后安装ktorrent很简单,只需要一行命令即可:
[root@localhost yum-repositories]# yum install ktorrent
但在运行ktorrent时,可能会发现下载速度为零,追踪服务器发现“状态”处显示:
Port 6881 is blacklisted
此时在ktorrent里:Setting–>Configure KTorrent–>Network中,Port处把默认的6881修改为一个大于50000的数字,比如50005,亲测可用!(参考:https://forum.utorrent.com/topic/4299-port-6881-blacklisted/)