=听我讲个故事=
https://wiki.centos.org/SpecialInterestGroup CentOS官方推荐源
在 Red Hat 企业 Linux(RHEL) 上,提供那些早已老掉牙的软件已经是企业级软件厂商的传统了。这倒不是因为他们懒,而确实是用户需要。很多公司像看待家具一样看待软件:我买一张桌子,能用一辈子,软件不应该也这样吗?
CentOS 作为 RHEL 的复制品有着同样的遭遇。虽然 Red Hat 还在为这些被厂商抛弃的过时软件提供支持、修补安全漏洞等,但如果你的应用依赖新版软件,你就得想办法了。 我在这个问题上不止一次碰壁。 LAMP 组合里任一个组件都需要其它所有组件能与其兼容,这有时就显得很麻烦。 比如说去年我就被 RHEL/CentOS 折腾得够呛。REHL/CentOS 第 6 版最高支持 PHP 5.3 ,第 7 版支持到 PHP 5.4 。而 PHP 5.3 早在 2014 年 8 月就到达 EOL(End Of Life) ,不再被厂商支持了, PHP 5.4 的 EOL 在 2015 年 9 月, 5.5 则是 2016 年 7 月。 有太多古老的软件版本,包括 MySQL、Python 等,它们应该像木乃伊一样被展示在博物馆里,但它们却活在你的系统上。
那么,可怜的管理员们该怎么办呢?如果你跑着 RHEL/CentOS ,那应该先试试 Software Collections,因为这是 Red Hat 唯一支持的新软件包源。 Software Collections 为 CentOS 设立了专门的仓库,安装和管理都和其它第三方仓库一样。但如果你用的是 RHEL 的,情况就有点不同了,具体请参考 RHEL 的解决方法。Software Collections 同样支持 Fedora 和 Scientific Linux 。
yum安装方式基本与安装epel-release一致
yum install centos-release-scl #相关依赖自动安装centos-release-scl-rh
在 Enterprise Linux 中启用 ELRepo
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
),自动生成配置文件[user-defined-repo-name] name=user-defined-repo-name baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
最少配置为以下3个配置段
[user-defined-repo-name]
name=
baseurl=
源名称定义
[]
中与name=
一行可以任意定义,也无须相同
源地址
baseurl=file:///home/software_downloads/CentOS-7-x86_64-Everything-1908
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64
gpg key 校验
gpgcheck=0
时,将取消包校验rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
官方推定来源
repo name | links |
---|---|
Repositories list | https://wiki.centos.org/AdditionalResources/Repositories |
EPEL:Extra Packages for Enterprise Linux | https://fedoraproject.org/wiki/EPEL |
k8s from Aliyun Mirrors | https://developer.aliyun.com/mirror/kubernetes |
remi [php & mysql ] | https://mirrors.tuna.tsinghua.edu.cn/remi/ |
nginx | http://nginx.org/en/linux_packages.html |
docker-ce-stable | https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/ |
推荐的第三方汇总整理版
https://centos.pkgs.org 使用:点击任意一个包,最终下载地址的下方将提供安装使用方式
#Install Howto #Download latest mysql57-community-release-el7 rpm from #http://repo.mysql.com/ #Install mysql57-community-release rpm: rpm -Uvh mysql57-community-release*rpm #Install mysql-community-common rpm package: yum --enablerepo=mysql57-community install mysql-community-common
强大的 Fedora 社区为 Feora 及所有 RHEL 系的发行版维护着 EPEL:Extra Packages for Enterprise Linux 。 里面包含一些最新软件包以及一些未被发行版收纳的软件包。安装 EPEL 里的软件就不用麻烦 enable 脚本了,直接像平常一样用。你还可以用 –disablerepo 和 –enablerepo 选项指定从 EPEL 里安装软件包:
$ sudo yum install epel-releases $ sudo yum --disablerepo "*" --enablerepo epel install [package]
Goto http://elrepo.org/ ,find Everything about ELRepo
ELRepo, an RPM repository for Enterprise Linux packages. ELRepo supports Red Hat Enterprise Linux (RHEL) and its derivatives (Scientific Linux, CentOS & others).
The ELRepo Project focuses on hardware related packages to enhance your experience with Enterprise Linux. This includes filesystem drivers, graphics drivers, network drivers, sound drivers, webcam and video drivers.[译:涉及有支持的驱动:文件系统、图形、网络、声音]
ELRepo 共分为 4 个独立频道:
# yum –enablerepo=elrepo-extras install package
默认情况下,elrepo-testing 和 elrepo-kernel 都被禁用,如果我们需要从中安装或更新软件包,可以像 elrepo-extras 那样启用它们。
要列出每个频道中的可用软件包,请运行以下命令之一:
yum --disablerepo="*" --enablerepo="elrepo" list available yum --disablerepo="*" --enablerepo="elrepo-extras" list available yum --disablerepo="*" --enablerepo="elrepo-testing" list available yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
SCL仓库仅支持CentOS 6.5以上版本,最新版的SCL提供了Python3.3版本,具体安装步骤
yum --disablerepo="*" --enablerepo="elrepo" list available yum --disablerepo="*" --enablerepo="elrepo-extras" list available yum --disablerepo="*" --enablerepo="elrepo-testing" list available yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
software | version |
---|---|
python | SCLo 7.7上最新phthon v3.6.9 |
Red-Hat Package Manager
二进制包(Binary)以及源代码包(Source)两种。二进制包可以直接安装在计算机中,而源代码包将会由RPM自动编译、安装。源代码包经常以src.rpm作为后缀名。 常用命令组合:
安装 -ivh:安装显示安装进度--install--verbose--hash -Uvh:升级软件包--Update; 查询 -qpl: 列出RPM软件包内的文件信息[Query Package list]; -qpi:列出RPM软件包的描述信息[Query Package install package(s)]; -qf:查找指定文件属于哪个RPM软件包[Query File]; -Va:校验所有的RPM软件包,查找丢失的文件[View Lost]; -e:删除包
rpm -q samba //查询程序是否安装 rpm -ivh /media/cdrom/RedHat/RPMS/samba-3.0.10-1.4E.i386.rpm //按路径安装并显示进度 rpm -ivh --relocate /=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm //指定安装目录 rpm -ivh --test gaim-1.3.0-1.fc4.i386.rpm //用来检查依赖关系;并不是真正的安装; rpm -Uvh --oldpackage gaim-1.3.0-1.fc4.i386.rpm //新版本降级为旧版本 rpm -qa | grep httpd #[搜索指定rpm包是否安装]--all搜索*httpd* rpm -ql httpd #[搜索rpm包]--list所有文件安装目录 rpm -qpi Linux-1.4-6.i368.rpm #[查看rpm包]--query--package--install package信息 rpm -qpf Linux-1.4-6.i368.rpm #[查看rpm包]--file rpm -qpR file.rpm #[查看包]依赖关系 rpm2cpio file.rpm |cpio -div #[抽出文件] rpm -ivh file.rpm #[安装新的rpm]--install--verbose--hash rpm -ivh [url]http://mirrors.kernel.org/fedora/core/4/i386/os/Fedora/RPMS/gaim-1.3.0-1.fc4.i386.rpm[/url] rpm -Uvh file.rpm #[升级一个rpm]--upgrade rpm -e file.rpm #[删除一个rpm包]--erase
Install/Upgrade/Erase options: -i, --install install package(s) -v, --verbose provide more detailed output -h, --hash print hash marks as package installs (good with -v) -e, --erase erase (uninstall) package -U, --upgrade=<packagefile>+ upgrade package(s) --replacepkge 无论软件包是否已被安装,都强行安装软件包 --test 安装测试,并不实际安装 --nodeps 忽略软件包的依赖关系强行安装 --force 忽略软件包及文件的冲突 Query options (with -q or --query): -a, --all query/verify all packages -p, --package query/verify a package file -l, --list list files in package -d, --docfiles list all documentation files -f, --file query/verify package(s) owning file RPM源代码包装安装 .src.rpm结尾的文件,这些文件是由软件的源代码包装而成的,用户要安装这类RPM软件包,必须使用命令: rpm --recompile vim-4.6-4.src.rpm #这个命令会把源代码解包并编译、安装它,如果用户使用命令: rpm --rebuild vim-4.6-4.src.rpm #在安装完成后,还会把编译生成的可执行文件重新包装成i386.rpm的RPM软件包。
[root@localhost src]# rpm -qpl bc-1.06.95-13.el7.x86_64.rpm /usr/bin/bc /usr/bin/dc /usr/share/doc/bc-1.06.95 /usr/share/doc/bc-1.06.95/AUTHORS /usr/share/doc/bc-1.06.95/COPYING /usr/share/doc/bc-1.06.95/COPYING.LIB /usr/share/doc/bc-1.06.95/Examples /usr/share/doc/bc-1.06.95/Examples/ckbook.b
rpm -qpi bc-1.06.95-13.el7.x86_64.rpm [root@loalhost]# rpm -qpi bc-1.06.95-13.el7.x86_64.rpm Name : bc Version : 1.06.95 Release : 13.el7 Architecture: x86_64 Install Date: (not installed) Group : Applications/Engineering Size : 219830 License : GPLv2+ Signature : RSA/SHA256, Thu 03 Jul 2014 08:47:28 PM EDT, Key ID 24c6a8a7f4a80eb5 Source RPM : bc-1.06.95-13.el7.src.rpm Build Date : Mon 09 Jun 2014 03:51:54 PM EDT Build Host : worker1.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://www.gnu.org/software/bc/ Summary : GNU's bc (a numeric processing language) and dc (a calculator) Description : The bc package includes bc and dc. Bc is an arbitrary precision numeric processing arithmetic language. Dc is an interactive arbitrary precision stack based calculator, which can be used as a text mode calculator. Install the bc package if you need its number handling capabilities or if you would like to use its text mode calculator.
自2001年起,联合国教科文组织正式启用“Free and Open Source Software”(简称“FOSS”)官方术语,在观念上前进了一大步,避开了一些哲学争执。“FOSS”的中译文是“自由及开源软件”。我们认为,“FOSS”术语的启用是科学的、准确的、令人不致发生误解。实际上,“开源”(Open Source)一词,在中国的实际使用情况相当混乱,往往被某些商业化操作所利用。
花点时间做个蒸鸡蛋吧!!