linux软件安装
软件安装:
1、bin文件 .bin(可执行文件,适合所有linux发行版)
2、rpm包、yum(redhat系列)
3、源码压缩包(适合所有linux发行版)
4、官方已经编译好的,下载软件包直接使用(绿色软件)
[zyj@localhost ~]$ ll total 32 -rw-rw-r--. 1 zyj zyj 0 Apr 27 10:24 install.bin [zyj@localhost ~]$ chmod u+x install.bin [zyj@localhost ~]$ ll total 32 -rwxrw-r--. 1 zyj zyj 0 Apr 27 10:24 install.bin [zyj@localhost ~]$ ./install.bin //执行
安装软件步骤:
1、检查是否已经安装:rpm -qa | grep jdk
查询
rpm -q PACKAGE_NAME:查询指定的包是否已经安装;
rpm -qa:查询已经安装的所有包;
rpm -qi PACKAGE_NAME:查询指定包的说明信息;
rpm -ql PACKAGE_NAME:查询指定包安装后生成的文件列表;
rpm -qc PACKAGE_NAME:查询指定包安装的配置文件;
rpm -qd PACKAGE_NAME:查询指定包安装的帮助文档;
rpm -q --scripts PACKAGE_NAME:查询指定包中包含的脚本;
rpm -qf /path/to/somefile:查询指定的文件是由哪个rpm包安装生成的。
如果某个rpm安装包未安装,我们需要查询其说明信息、安装以后会生成的文件;
rpm -qpi /PATH/TO/PACKAGE_FILE
rpm -qpl
[zyj@localhost ~]$ rpm -qa | grep man //完整版上面安装了man的包 man-1.6f-39.el6.x86_64 libsemanage-2.0.43-5.1.el6.x86_64 pixman-0.32.8-1.el6.x86_64 gnome-power-manager-2.28.3-7.el6_4.x86_64 man-pages-overrides-6.9.1-1.el6.noarch man-pages-3.22-20.el6.noarch [root@localhost home]# rpm -qa | grep man //简单版上面没有man命令 libsemanage-2.0.43-5.1.el6.x86_64
[zyj@localhost ~]$ rpm -qi man //查看安装包说明信息 Name : man Relocations: (not relocatable) Version : 1.6f Vendor: CentOS Release : 39.el6 Build Date: Tue Mar 21 17:53:55 2017 Install Date: Sat Apr 14 02:41:20 2018 Build Host: c1bm.rdu2.centos.org Group : System Environment/Base Source RPM: man-1.6f-39.el6.src.rpm Size : 398735 License: GPLv2 Signature : RSA/SHA1, Thu Mar 23 08:02:14 2017, Key ID 0946fca2c105b9de Packager : CentOS BuildSystem <http://bugs.centos.org> URL : http://primates.ximian.com/~flucifredi/man/ Summary : A set of documentation tools: man, apropos and whatis Description : The man package includes three tools for finding information and/or documentation about your Linux system: man, apropos, and whatis. The man system formats and displays on-line manual pages about commands or functions on your system. Apropos searches the whatis database (containing short descriptions of system commands) for a string. Whatis searches its own database for a complete word. The man package should be installed on your system because it is the primary way to find documentation on a Linux system.
[zyj@localhost ~]$ rpm -qc man //查看安装包配置文件 /etc/man.config [zyj@localhost ~]$ rpm -ql man | more //查看安装包文件列表 /etc/cron.daily/makewhatis.cron /etc/man.config /usr/bin/apropos /usr/bin/man /usr/bin/man2html /usr/bin/manpath /usr/bin/whatis [zyj@localhost ~]$ whereis man man: /usr/bin/man /etc/man.config /usr/share/man /usr/share/man/man7/man.7.gz /usr/share/man/man1/man.1.gz /usr/share/man/man1p/man.1p.gz
2、下载软件包
http://mirrors.163.com/centos/6.9/os/x86_64/Packages/
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
下载到本地后,通过CRT的文件传输功能,将windows上的文件传输到linux中;
[root@localhost ~]# cd /home/zyj [root@localhost zyj]# ll total 8856 drwxr-xr-x. 2 zyj zyj 4096 Apr 14 09:13 Desktop drwxr-xr-x. 2 zyj zyj 4096 Apr 14 09:13 Documents drwxr-xr-x. 2 zyj zyj 4096 Apr 14 09:13 Downloads drwxr-xr-x. 2 zyj zyj 4096 Apr 14 09:13 Music drwxr-xr-x. 2 zyj zyj 4096 Apr 14 09:13 Pictures drwxr-xr-x. 2 zyj zyj 4096 Apr 14 09:13 Public drwxr-xr-x. 2 zyj zyj 4096 Apr 14 09:13 Templates drwxr-xr-x. 2 zyj zyj 4096 Apr 14 09:13 Videos-rw-rw-r--. 1 zyj zyj 9034460 Apr 27 2018 mysql-server-5.1.73-8.el6_8.x86_64.rpm
3、安装、依赖
rpm -i /PATH/TO/PACKAGE_FILE
-h:以#显示进度,每个#表示2%
-v:显示详细过程;
-vv(两个v):显示更详细的过程
rmp -ivh /PATH/TO/PACKAGE_FILE
--nodeps:忽略依赖关系;
--replacepkgs:重新安装,替换原有安装;
--force:强行安装,可以实现重装或降级;
[root@localhost zyj]# rpm -ivh mysql-server-5.1.73-8.el6_8.x86_64.rpm //安装软件包 warning: mysql-server-5.1.73-8.el6_8.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY error: Failed dependencies: //错误:这个软件包(只有核心部分,所以比较小),必须依赖其他软件,否则无法安装和运行,下列的依赖包需要先安装好。 mysql = 5.1.73-8.el6_8 is needed by mysql-server-5.1.73-8.el6_8.x86_64 perl(DBI) is needed by mysql-server-5.1.73-8.el6_8.x86_64 perl-DBD-MySQL is needed by mysql-server-5.1.73-8.el6_8.x86_64 perl-DBI is needed by mysql-server-5.1.73-8.el6_8.x86_64
rpm安装过程中不需要指定安装路径,rpm文件在制作的时候已经确定了安装路径;可以通过安装包rpm -ql jdk查看,缺点是当安装包有依赖包时安装比较麻烦。
yum:用来管理rpm软件包,解决rpm下载问题,解决rpm文件的查询,解决rpm安装问题,解决rpm文件的依赖问题,需要一个yum源,yum源一般在外网上。因此yum安装需要能访问外网,这也是yum的局限性。
yum安装的文件还是rpm文件
[root@localhost ~]# yum search mysql-s //查询软件包 已加载插件:fastestmirror base | 3.7 kB 00:00 base/primary_db | 4.7 MB 00:48 extras | 3.4 kB 00:00 extras/primary_db | 30 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 7.0 MB 00:12 ===================== N/S Matched: mysql-s ===================== mysql-server.x86_64 : The MySQL server and related files Name and summary matches only, use "search all" for everything. [root@localhost ~]# yum info mysql-server //查看安装包信息 已加载插件:fastestmirror Determining fastest mirrors * base: mirrors.cn99.com * extras: mirrors.sohu.com * updates: mirrors.aliyun.com 可安装的软件包 Name : mysql-server Arch : x86_64 Version : 5.1.73 Release : 8.el6_8 Size : 8.6 M Repo : base Summary : The MySQL server and related files URL : http://www.mysql.com License : GPLv2 with exceptions Description : MySQL is a multi-user, multi-threaded SQL database : server. MySQL is a client/server implementation : consisting of a server daemon (mysqld) and many : different client programs and libraries. This : package contains the MySQL server and some : accompanying files and directories. [root@localhost ~]# yum install mysql-server //安装软件包 已加载插件:fastestmirror 设置安装进程 Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.sohu.com * updates: mirrors.aliyun.com 解决依赖关系 --> 执行事务检查 ---> Package mysql-server.x86_64 0:5.1.73-8.el6_8 will be 安装 --> 处理依赖关系 mysql = 5.1.73-8.el6_8,它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl-DBI,它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl-DBD-MySQL,它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(vars),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(strict),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(Sys::Hostname),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(POSIX),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(Getopt::Long),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(File::Temp),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(File::Path),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(File::Copy),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(File::Basename),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(Data::Dumper),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 perl(DBI),它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 处理依赖关系 /usr/bin/perl,它被软件包 mysql-server-5.1.73-8.el6_8.x86_64 需要 --> 执行事务检查 ---> Package mysql.x86_64 0:5.1.73-8.el6_8 will be 安装 ---> Package perl.x86_64 4:5.10.1-144.el6 will be 安装 --> 处理依赖关系 perl-libs = 4:5.10.1-144.el6,它被软件包 4:perl-5.10.1-144.el6.x86_64 需要 --> 处理依赖关系 perl-libs,它被软件包 4:perl-5.10.1-144.el6.x86_64 需要 --> 处理依赖关系 perl(version),它被软件包 4:perl-5.10.1-144.el6.x86_64 需要 --> 处理依赖关系 perl(Pod::Simple),它被软件包 4:perl-5.10.1-144.el6.x86_64 需要 --> 处理依赖关系 perl(Module::Pluggable),它被软件包 4:perl-5.10.1-144.el6.x86_64 需要 --> 处理依赖关系 libperl.so()(64bit),它被软件包 4:perl-5.10.1-144.el6.x86_64 需要 ---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be 安装 ---> Package perl-DBI.x86_64 0:1.609-4.el6 will be 安装 --> 执行事务检查 ---> Package perl-Module-Pluggable.x86_64 1:3.90-144.el6 will be 安装 ---> Package perl-Pod-Simple.x86_64 1:3.13-144.el6 will be 安装 --> 处理依赖关系 perl(Pod::Escapes) >= 1.04,它被软件包 1:perl-Pod-Simple-3.13-144.el6.x86_64 需要 ---> Package perl-libs.x86_64 4:5.10.1-144.el6 will be 安装 ---> Package perl-version.x86_64 3:0.77-144.el6 will be 安装 --> 执行事务检查 ---> Package perl-Pod-Escapes.x86_64 1:1.04-144.el6 will be 安装 --> 完成依赖关系计算 依赖关系解决 ================================================================ 软件包 架构 版本 仓库 大小 ================================================================ 正在安装: mysql-server x86_64 5.1.73-8.el6_8 base 8.6 M 为依赖而安装: mysql x86_64 5.1.73-8.el6_8 base 895 k perl x86_64 4:5.10.1-144.el6 base 10 M perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k perl-DBI x86_64 1.609-4.el6 base 705 k perl-Module-Pluggable x86_64 1:3.90-144.el6 base 41 k perl-Pod-Escapes x86_64 1:1.04-144.el6 base 33 k perl-Pod-Simple x86_64 1:3.13-144.el6 base 213 k perl-libs x86_64 4:5.10.1-144.el6 base 579 k perl-version x86_64 3:0.77-144.el6 base 52 k 事务概要 ================================================================ Install 10 Package(s) 总下载量:21 M Installed size: 65 M 确定吗?[y/N]:y 下载软件包: (1/10): mysql-5.1.73-8.el6_8.x86_64.rpm | 895 kB 00:00 (2/10): mysql-server-5.1.73-8.el6_8.x86_64.rpm | 8.6 MB 00:09 (3/10): perl-5.10.1-144.el6.x86_64.rpm | 10 MB 00:10 (4/10): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm | 134 kB 00:00 (5/10): perl-DBI-1.609-4.el6.x86_64.rpm | 705 kB 00:00 (6/10): perl-Module-Pluggable-3.90-144.el6.x86_64.rpm | 41 kB 00:00 (7/10): perl-Pod-Escapes-1.04-144.el6.x86_64.rpm | 33 kB 00:00 (8/10): perl-Pod-Simple-3.13-144.el6.x86_64.rpm | 213 kB 00:00 (9/10): perl-libs-5.10.1-144.el6.x86_64.rpm | 579 kB 00:01 (10/10): perl-version-0.77-144.el6.x86_64.rpm | 52 kB 00:00 ----------------------------------------------------------------------------------------------------------------------------------- 总计 848 kB/s | 21 MB 00:25 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY 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-9.el6.12.3.x86_64 (@anaconda-CentOS-201703281317.x86_64/6.9) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 确定吗?[y/N]:y 运行 rpm_check_debug 执行事务测试 事务测试成功 执行事务 正在安装 : 1:perl-Pod-Escapes-1.04-144.el6.x86_64 1/10 正在安装 : 4:perl-libs-5.10.1-144.el6.x86_64 2/10 正在安装 : 1:perl-Module-Pluggable-3.90-144.el6.x86_64 3/10 正在安装 : 1:perl-Pod-Simple-3.13-144.el6.x86_64 4/10 正在安装 : 3:perl-version-0.77-144.el6.x86_64 5/10 正在安装 : 4:perl-5.10.1-144.el6.x86_64 6/10 正在安装 : perl-DBI-1.609-4.el6.x86_64 7/10 正在安装 : perl-DBD-MySQL-4.013-3.el6.x86_64 8/10 正在安装 : mysql-5.1.73-8.el6_8.x86_64 9/10 正在安装 : mysql-server-5.1.73-8.el6_8.x86_64 10/10 Verifying : 3:perl-version-0.77-144.el6.x86_64 1/10 Verifying : 4:perl-libs-5.10.1-144.el6.x86_64 2/10 Verifying : 4:perl-5.10.1-144.el6.x86_64 3/10 Verifying : perl-DBD-MySQL-4.013-3.el6.x86_64 4/10 Verifying : mysql-server-5.1.73-8.el6_8.x86_64 5/10 Verifying : perl-DBI-1.609-4.el6.x86_64 6/10 Verifying : 1:perl-Module-Pluggable-3.90-144.el6.x86_64 7/10 Verifying : 1:perl-Pod-Simple-3.13-144.el6.x86_64 8/10 Verifying : 1:perl-Pod-Escapes-1.04-144.el6.x86_64 9/10 Verifying : mysql-5.1.73-8.el6_8.x86_64 10/10 已安装: mysql-server.x86_64 0:5.1.73-8.el6_8 作为依赖被安装: mysql.x86_64 0:5.1.73-8.el6_8 perl.x86_64 4:5.10.1-144.el6 perl-DBD-MySQL.x86_64 0:4.013-3.el6 perl-DBI.x86_64 0:1.609-4.el6 perl-Module-Pluggable.x86_64 1:3.90-144.el6 perl-Pod-Escapes.x86_64 1:1.04-144.el6 perl-Pod-Simple.x86_64 1:3.13-144.el6 perl-libs.x86_64 4:5.10.1-144.el6 perl-version.x86_64 3:0.77-144.el6 完毕! [root@localhost ~]#
[root@localhost zyj]# yum install tree //安装tree或者man Failed to set locale, defaulting to C Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Install Process Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package tree.x86_64 0:1.5.3-3.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================== Installing: tree x86_64 1.5.3-3.el6 base 36 k Transaction Summary =================================================================================================================================== Install 1 Package(s) Total download size: 36 k Installed size: 65 k Is this ok [y/N]: y Downloading Packages: tree-1.5.3-3.el6.x86_64.rpm | 36 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : tree-1.5.3-3.el6.x86_64 1/1 Verifying : tree-1.5.3-3.el6.x86_64 1/1 Installed: tree.x86_64 0:1.5.3-3.el6 Complete! [root@localhost zyj]# tree . |-- Desktop |-- Documents |-- Downloads |-- Music |-- Pictures |-- Public |-- Templates |-- Videos `-- mysql-server-5.1.73-8.el6_8.x86_64.rpm 8 directories, 1 file
不能上网时,可以自己在局域网中构建yum源。如何自己构造yum源:下载外网的yum源。
1、本地yum源;
2、局域网内部yun源。
查看在哪里寻找yum源:在配置文件中查看。
[root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# ll //从下面的配置文件中依次查找yum源。 总用量 24 -rw-r--r--. 1 root root 1991 3月 28 2017 CentOS-Base.repo -rw-r--r--. 1 root root 647 3月 28 2017 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 289 3月 28 2017 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 3月 28 2017 CentOS-Media.repo -rw-r--r--. 1 root root 7989 3月 28 2017 CentOS-Vault.repo [root@localhost yum.repos.d]# [root@localhost yum.repos.d]# [root@localhost yum.repos.d]# [root@localhost yum.repos.d]# more CentOS-Base.repo //文件中均有url地址 # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [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-6 #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-6 #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-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
yumgroup 组相关命令:
groupinfo、grouplist、groupinstall、groupremove、groupupdate
[root@localhost yum.repos.d]# yum grouplist //将rpm文件分类 已加载插件:fastestmirror 设置组进程 Loading mirror speeds from cached hostfile * extras: mirrors.aliyun.com * updates: mirrors.sohu.com 已安装的组: MySQL 数据库客户端 MySQL 数据库服务器 Perl 支持 iSCSI 存储客户端 可扩展文件系统 存储可用性工具 安全性工具 电子邮件服务器 系统管理工具 有效的组: CIFS 文件服务器 Eclipse Emacs FCoE 存储客户端 FTP 服务器 Infiniband 支持 Java 平台 KDE 桌面 NFS 文件服务器 PHP 支持 PostgreSQL 数据库客户端 PostgreSQL 数据库服务器 Ruby 支持 SNMP 支持 TeX 支持 TurboGear 应用程序框架 Web 服务器程序引擎 X 窗口系统 ...... 完成 [root@localhost yum.repos.d]# yum groupinfo MySQL 数据库客户端 //查看组信息 已加载插件:fastestmirror 设置组进程 Loading mirror speeds from cached hostfile * extras: mirrors.aliyun.com * updates: mirrors.sohu.com 组:MySQL 数据库服务器 描述:MySQL SQL 数据库服务器以及相关软件包。 必要的软件包: mysql-server 可选的软件包: mysql-bench mysql-test [root@localhost yum.repos.d]# yum groupinstall MySQL 数据库客户端 //安装组内的所有软件包 已加载插件:fastestmirror 设置组进程 Loading mirror speeds from cached hostfile * extras: mirrors.aliyun.com * updates: mirrors.sohu.com 包 mysql-server-5.1.73-8.el6_8.x86_64 已安装并且是最新版本 Warning: Group mysql does not have any packages. 指定组中没有可安装或升级的软件包
安装httpd服务:
[root@localhost yum.repos.d]# yum info httpd //具体的安装包信息 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * extras: mirrors.aliyun.com * updates: mirrors.sohu.com 可安装的软件包 Name : httpd Arch : x86_64 Version : 2.2.15 Release : 60.el6.centos.6 Size : 836 k Repo : updates Summary : Apache HTTP Server URL : http://httpd.apache.org/ License : ASL 2.0 Description : The Apache HTTP Server is a powerful, efficient, and extensible : web server. [root@localhost yum.repos.d]# yum install httpd //安装 -y 参数 自动回答yes yum install httpd -y 已加载插件:fastestmirror 设置安装进程 Loading mirror speeds from cached hostfile * extras: mirrors.aliyun.com * updates: mirrors.sohu.com 解决依赖关系 --> 执行事务检查 ---> Package httpd.x86_64 0:2.2.15-60.el6.centos.6 will be 安装 --> 处理依赖关系 httpd-tools = 2.2.15-60.el6.centos.6,它被软件包 httpd-2.2.15-60.el6.centos.6.x86_64 需要 --> 处理依赖关系 apr-util-ldap,它被软件包 httpd-2.2.15-60.el6.centos.6.x86_64 需要 --> 处理依赖关系 /etc/mime.types,它被软件包 httpd-2.2.15-60.el6.centos.6.x86_64 需要 --> 处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.2.15-60.el6.centos.6.x86_64 需要 --> 处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.2.15-60.el6.centos.6.x86_64 需要 --> 执行事务检查 ---> Package apr.x86_64 0:1.3.9-5.el6_9.1 will be 安装 ---> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be 安装 ---> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be 安装 ---> Package httpd-tools.x86_64 0:2.2.15-60.el6.centos.6 will be 安装 ---> Package mailcap.noarch 0:2.1.31-2.el6 will be 安装 --> 完成依赖关系计算 依赖关系解决 =================================================================================================================================== 软件包 架构 版本 仓库 大小 =================================================================================================================================== 正在安装: httpd x86_64 2.2.15-60.el6.centos.6 updates 836 k 为依赖而安装: apr x86_64 1.3.9-5.el6_9.1 updates 124 k apr-util x86_64 1.3.9-3.el6_0.1 base 87 k apr-util-ldap x86_64 1.3.9-3.el6_0.1 base 15 k httpd-tools x86_64 2.2.15-60.el6.centos.6 updates 80 k mailcap noarch 2.1.31-2.el6 base 27 k 事务概要 =================================================================================================================================== Install 6 Package(s) 总下载量:1.1 M Installed size: 3.7 M 确定吗?[y/N]:y 下载软件包: (1/6): apr-1.3.9-5.el6_9.1.x86_64.rpm | 124 kB 00:00 (2/6): httpd-2.2.15-60.el6.centos.6.x86_64.rpm | 836 kB 00:00 (3/6): httpd-tools-2.2.15-60.el6.centos.6.x86_64.rpm | 80 kB 00:00 ----------------------------------------------------------------------------------------------------------------------------------- 总计 1.0 MB/s | 1.1 MB 00:01 运行 rpm_check_debug 执行事务测试 事务测试成功 执行事务 正在安装 : apr-1.3.9-5.el6_9.1.x86_64 1/6 正在安装 : apr-util-1.3.9-3.el6_0.1.x86_64 2/6 正在安装 : httpd-tools-2.2.15-60.el6.centos.6.x86_64 3/6 正在安装 : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 4/6 正在安装 : mailcap-2.1.31-2.el6.noarch 5/6 正在安装 : httpd-2.2.15-60.el6.centos.6.x86_64 6/6 Verifying : httpd-tools-2.2.15-60.el6.centos.6.x86_64 1/6 Verifying : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 2/6 Verifying : httpd-2.2.15-60.el6.centos.6.x86_64 3/6 Verifying : apr-1.3.9-5.el6_9.1.x86_64 4/6 Verifying : mailcap-2.1.31-2.el6.noarch 5/6 Verifying : apr-util-1.3.9-3.el6_0.1.x86_64 6/6 已安装: httpd.x86_64 0:2.2.15-60.el6.centos.6 作为依赖被安装: apr.x86_64 0:1.3.9-5.el6_9.1 apr-util.x86_64 0:1.3.9-3.el6_0.1 apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 httpd-tools.x86_64 0:2.2.15-60.el6.centos.6 mailcap.noarch 0:2.1.31-2.el6 完毕! [root@localhost yum.repos.d]# yum remove httpd //卸载安装包 remove|erase也是卸载 已加载插件:fastestmirror 设置移除进程 解决依赖关系 --> 执行事务检查 ---> Package httpd.x86_64 0:2.2.15-60.el6.centos.6 will be 删除 --> 完成依赖关系计算 依赖关系解决 =================================================================================================================================== 软件包 架构 版本 仓库 大小 =================================================================================================================================== 正在删除: httpd x86_64 2.2.15-60.el6.centos.6 @updates 3.0 M 事务概要 =================================================================================================================================== Remove 1 Package(s) Installed size: 3.0 M 确定吗?[y/N]:y 下载软件包: 运行 rpm_check_debug 执行事务测试 事务测试成功 执行事务 正在删除 : httpd-2.2.15-60.el6.centos.6.x86_64 1/1 Verifying : httpd-2.2.15-60.el6.centos.6.x86_64 1/1 删除: httpd.x86_64 0:2.2.15-60.el6.centos.6 完毕! 重新安装后: [root@localhost ~]# service httpd start //开启httpd服务 正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName [确定] [root@localhost ~]# netstat -ntpl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1292/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1371/master tcp 0 0 :::80 :::* LISTEN 1641/httpd tcp 0 0 :::22 :::* LISTEN 1292/sshd tcp 0 0 ::1:25 :::* LISTEN 1371/master [root@localhost ~]# [root@localhost ~]# service httpd stop //关闭服务 停止 httpd: [确定] [root@localhost ~]# netstat -ntpl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1292/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1371/master tcp 0 0 :::22 :::* LISTEN 1292/sshd tcp 0 0 ::1:25 :::* LISTEN 1371/master [root@localhost ~]# service iptables stop //关闭防火墙并开启httpd服务后可以通过浏览器访问。 iptables:将链设置为政策 ACCEPT:filter [确定] iptables:清除防火墙规则: [确定] iptables:正在卸载模块: [确定] http://192.168.166.129/ //在浏览器上就可以访问虚拟机,显示官网英文界面 [root@localhost html]# rpm -ql httpd //查看httpd的安装包文件安装在哪里了 /etc/httpd /etc/httpd/conf /etc/httpd/conf.d /etc/httpd/conf.d/README /etc/httpd/conf.d/welcome.conf /etc/httpd/conf/httpd.conf ... /var/www/html [root@localhost ~]# cd /var/www/ [root@localhost www]# ll 总用量 16 drwxr-xr-x. 2 root root 4096 10月 20 2017 cgi-bin drwxr-xr-x. 3 root root 4096 4月 30 20:12 error drwxr-xr-x. 2 root root 4096 10月 20 2017 html drwxr-xr-x. 3 root root 4096 4月 30 20:12 icons [root@localhost www]# cd html [root@localhost html]# ll 总用量 0 [root@localhost html]# vi hello.html hello world :wq 在浏览器中打开http://192.168.166.129/hello.html hello world
yum repolist:显示repo列表及简要信息
[root@localhost ~]# yum repolist 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * extras: mirrors.aliyun.com * updates: mirrors.sohu.com 仓库标识 仓库名称 状态 base CentOS-6 - Base 6,706 extras CentOS-6 - Extras 53 updates CentOS-6 - Updates 1,185 repolist: 7,944 [root@localhost ~]#
yum update:升级
yum update_to :升级为指定版本
[root@localhost ~]# yum update 已加载插件:fastestmirror 设置更新进程 Loading mirror speeds from cached hostfile * extras: mirrors.aliyun.com * updates: mirrors.sohu.com 解决依赖关系 --> 执行事务检查 ---> Package acl.x86_64 0:2.2.49-7.el6 will be 升级 ---> Package acl.x86_64 0:2.2.49-7.el6_9.1 will be an update ---> Package binutils.x86_64 0:2.20.51.0.2-5.46.el6 will be 升级 ---> Package binutils.x86_64 0:2.20.51.0.2-5.47.el6_9.1 will be an update ---> Package ca-certificates.noarch 0:2016.2.10-65.4.el6 will be 升级 ---> Package ca-certificates.noarch 0:2017.2.14-65.0.1.el6_9 will be an update ...
yum provides| whatprovides:查看指定的文件或特性是由哪个安装包生成的。