安装
通过wget命令下载安装
[root@localhost ~]# wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz
--2019-02-17 07:22:41-- http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz
Resolving yum.baseurl.org... 140.211.9.35
Connecting to yum.baseurl.org|140.211.9.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1140370 (1.1M) [application/x-gzip]
Saving to: "yum-3.4.3.tar.gz"
100%[======================================>] 1,140,370 23.3K/s in 28s
2019-02-17 07:23:09 (40.0 KB/s) - "yum-3.4.3.tar.gz" saved [1140370/1140370]
查看并且移动到tmp中解压
[root@localhost ~]# ls
anaconda-ks.cfg Downloads Music Templates
Desktop install.log Pictures Videos
Documents install.log.syslog Public yum-3.4.3.tar.gz
[root@localhost ~]# mv yum-3.4.3.tar.gz /usr/local/tmp
[root@localhost ~]# ls /usr/local/tmp
apache-tomcat-7.0.68.tar.gz mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz
Demo.class yum-3.4.3.tar.gz
Demo.java
[root@localhost ~]# cd /usr/local/tmp
[root@localhost tmp]# tar -zxvf yum-3.4.3.tar.gz
进入解压的文件,运行安装yum
[root@localhost yum-3.4.3]# ./yummain.py install yum
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.shu.edu.cn
* updates: mirrors.shu.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum.noarch 0:3.2.29-40.el6.centos will be updated
---> Package yum.noarch 0:3.2.29-81.el6.centos.0.1 will be an update
--> Processing Dependency: python-urlgrabber >= 3.9.1-10 for package: yum-3.2.29-81.el6.centos.0.1.noarch
--> Running transaction check
---> Package python-urlgrabber.noarch 0:3.9.1-9.el6 will be updated
---> Package python-urlgrabber.noarch 0:3.9.1-11.el6 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
yum noarch 3.2.29-81.el6.centos.0.1 updates 1.0 M
Updating for dependencies:
python-urlgrabber noarch 3.9.1-11.el6 base 86 k
Transaction Summary
================================================================================
Upgrade 2 Packages
Total download size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): python-urlgrabber-3.9.1-11.el6.noarch.rpm | 86 kB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Public key for python-urlgrabber-3.9.1-11.el6.noarch.rpm is not installed
(2/2): yum-3.2.29-81.el6.centos.0.1.noarch.rpm | 1.0 MB 00:03
Public key for yum-3.2.29-81.el6.centos.0.1.noarch.rpm is not installed
--------------------------------------------------------------------------------
Total 274 kB/s | 1.1 MB 00:04
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-5.el6.centos.11.1.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : python-urlgrabber-3.9.1-11.el6.noarch 1/4
Updating : yum-3.2.29-81.el6.centos.0.1.noarch 2/4
Cleanup : yum-3.2.29-40.el6.centos.noarch 3/4
Cleanup : python-urlgrabber-3.9.1-9.el6.noarch 4/4
Updated:
yum.noarch 0:3.2.29-81.el6.centos.0.1
Dependency Updated:
python-urlgrabber.noarch 0:3.9.1-11.el6
Complete!
[root@localhost yum-3.4.3]# yum
Loaded plugins: fastestmirror, refresh-packagekit, security
You need to give some command
Usage: yum [options] COMMAND
List of Commands:
check Check for problems in the rpmdb
check-update Check for available package updates
至此,安装完成!!!!!!!!!!!!!
1.备份原始源
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2.创建新源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
- 重新缓存
yum clean all
yum makecache
使用yum来安装或卸载CentOS图形界面包
命令行模式安装图形界面
yum grouplist 检查已安装的组
yum groupinstall "X Window System"
yum groupinstall "GNOME Desktop Environment"
startx
或者init 5
就OK。
重新安装了带图形界面模式的centos系统,来实验yum方式卸载图形界面
图形界面想要卸载:
yum groupremove "GNOME Desktop Environment"
yum groupremove "X Window System"
以图形界面安装的linux 卸载图形界面之后会提示错误
init: Id "x" respawning too fast: disabled for 5 minutes
解决的办法是
vi /etc/inittab
找到这段文字 把这段文字中id后面的数字改为3 id:3:initdefault 让系统以文本界面启动
找到这段文字x:5:respawn:/etc/X11/prefdm -nodaemon注释掉!
注(此方法未证实能否保证服务器保持稳定!未在服务器上线实验过)
如何查看yum 安装的软件路径
比如查看yum install keepalived安装后的路径
第一步:
[root@localhost local]# rpm -qa|grep keepalived
keepalived-1.2.13-5.el6_6.x86_64
第二步得结果:
[root@localhost local]# rpm -ql keepalived-1.2.13-5.el6_6.x86_64
/etc/keepalived
/etc/keepalived/keepalived.conf
/etc/rc.d/init.d/keepalived
/etc/sysconfig/keepalived
/usr/bin/genhash
/usr/libexec/keepalived
/usr/sbin/keepalived
/usr/share/doc/keepalived-1.2.13
/usr/share/doc/keepalived-1.2.13/AUTHOR
/usr/share/doc/keepalived-1.2.13/CONTRIBUTORS
/usr/share/doc/keepalived-1.2.13/COPYING
/usr/share/doc/keepalived-1.2.13/ChangeLog
/usr/share/doc/keepalived-1.2.13/NOTE_vrrp_vmac.txt
/usr/share/doc/keepalived-1.2.13/README
/usr/share/doc/keepalived-1.2.13/TODO
/usr/share/doc/keepalived-1.2.13/VERSION
/usr/share/doc/keepalived-1.2.13/keepalived.conf.SYNOPSIS
/usr/share/doc/keepalived-1.2.13/samples
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.HTTP_GET.port
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.IPv6
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.SMTP_CHECK
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.SSL_GET
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.fwmark
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.inhibit
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.misc_check
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.misc_check_arg
yum命令
1.使用YUM查找软件包
命令:yum search
2.列出所有可安装的软件包
命令:yum list
3.列出所有可更新的软件包
命令:yum list updates
4.列出所有已安装的软件包
命令:yum list installed
5.列出所有已安装但不在 Yum Repository 内的软件包
命令:yum list extras
6.列出所指定的软件包
命令:yum list XX
7.使用YUM获取软件包信息
命令:yum info XX
8.列出所有软件包的信息
命令:yum info
9.列出所有可更新的软件包信息
命令:yum info updates
10.列出所有已安装的软件包信息
命令:yum info installed
11.列出所有已安装但不在 Yum Repository 内的软件包信息
命令:yum info extras
12.列出软件包提供哪些文件
命令:yum provides