1.1.RPM软件包管理

1)查询是否安装firefoxsetup

[root@localhostyum.repos.d]# rpm -q firefox setup

firefox-10.0.11-1.el5_8

firefox-10.0.11-1.el5_8

setup-2.5.58-9.el5

2)查询是否安装ftp相关的软件包,查询安装软件中以vim开头的软件

[root@localhost~]# rpm -q ftp

ftp-0.17-38.el5


[root@localhost~]# rpm -qa vim*

vim-common-7.0.109-7.2.el5

vim-enhanced-7.0.109-7.2.el5

vim-minimal-7.0.109-7.2.el5

3)查询所有已安装的软件包

[root@localhost~]# rpm -qa | more

termcap-5.5-1.20060701.1

chkconfig-1.3.30.2-2.el5

audit-libs-1.8-2.el5

libpng-1.2.10-17.el5_8


...


tk-8.4.13-5.el5_1.1

libXxf86dga-1.0.1-3.1

--More--

4)查询firefox的详细信息

[root@localhost~]# rpm -qi firefox

Name : firefox Relocations: (not relocatable)

Version : 10.0.11 Vendor: Red Hat, Inc.

Release : 1.el5_8 Build Date: 20121117星期六 073025

InstallDate: 20131011星期五 162026


...

Summary : Mozilla Firefox 网页浏览器。

Description:

MozillaFirefox 是一个开源的万维网浏览器,它的设计目的是服从标准、高性能、和可移植性。

5)查询firefox安装到什么地方了

[root@localhost~]# rpm -ql firefox | more

/usr/bin/firefox

/usr/lib/firefox


...


/usr/lib/firefox/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/preview.png

/usr/lib/firefox/firefox

/usr/lib/firefox/icons

--More--

6)查询setup安装到/etc下的文件

[root@localhost~]# rpm -qc setup

/etc/aliases

/etc/bashrc

/etc/filesystems


...


/etc/protocols

/etc/shells

7)查询/etc/passwd是那个软件包产生的

[root@localhost~]# rpm -qf /etc/passwd

setup-2.5.58-9.el5

8)挂载5.9DVD光盘到/media

//先查看光盘是否已经挂载

[root@localhost~]# mount | tail -n 1

/dev/hdcon /media type iso9660 (ro)


//已挂载,卸载光盘

[root@localhost~]# umount /media


//确认已经卸载

[root@localhost~]# mount | tail -n 1

sunrpcon /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)


//挂载光盘

[root@localhost~]# mount /dev/cdrom /media/

mount:block device /dev/cdrom is write-protected, mounting read-only

//确认挂载成功

[root@localhost~]# mount | tail -n 1

/dev/hdcon /media type iso9660 (ro)

9)查询dvd光盘中vsftpd这个软件包的详细信息

//进入光盘目录

[root@localhost~]# cd /media/Server/

//找出vsftpd的安装包名

[root@localhostServer]# ls | grep vsftpd

vsftpd-2.0.5-28.el5.x86_64.rpm


//查看详细信息

[root@localhostServer]# rpm -qpivsftpd-2.0.5-28.el5.x86_64.rpm

Name : vsftpd Relocations: (not relocatable)

Version : 2.0.5 Vendor: Red Hat,Inc.

Release : 28.el5 Build Date: 20120925星期二 203852

InstallDate: (not installed) BuildHost: x86-022.build.eng.bos.redhat.com

Group :System Environment/Daemons Source RPM:vsftpd-2.0.5-28.el5.src.rpm

Size : 293689 License: GPL

Signature : DSA/SHA1, 20121009星期二 142626, Key ID5326810137017186

Packager : Red Hat, Inc.

URL : http://vsftpd.beasts.org/

Summary : vsftpd - 非常安全 Ftp 守护进程

Description:

vsftpd是一个非常安全 FTP 守护进程。它是完全从零开始

编写的。

10)查询dvd光盘中vsftpd这个软件包安装的话会安装到什么地方,可执行程序会安装到哪里去

//查看安装位置

[root@localhostServer]# rpm -qpl vsftpd-2.0.5-28.el5.x86_64.rpm


//查看可执行程序

[root@localhostServer]# rpm -qplvsftpd-2.0.5-28.el5.x86_64.rpm | grep bin

/usr/sbin/vsftpd

11)查询bash这个软件包安装的文件是否被改动

[root@localhostServer]# rpm -V bash

[root@localhostServer]#

//没有改动

12)查询/etc/passwd这个文件有没改动

[root@localhostServer]# rpm -Vf /etc/passwd

S.5....T c /etc/printcap

//该文件未改动,但同源文件printcap被改动

13)列出系统中在RPM安装后改动过的所有文件

[root@localhostServer]# rpm -Va

SM5....T /usr/lib64/xorg/modules/drivers/vmware_drv.so

.M...... /media

...

14)导入RPM公钥文件

[root@localhostServer]#

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

15)测试vsftpd是否可以安装

[root@localhostServer]# rpm -ivhvsftpd-2.0.5-28.el5.x86_64.rpm --test

Preparing... ###########################################[100%]

package vsftpd-2.0.5-28.el5.x86_64 isalready installed


//确认只是测试,没有安装

[root@localhostServer]# rpm -q vsftpd

packagevsftpd is not installed

16)#号显示安装进度并显示细节信息安装vsftpd

[root@localhostServer]# rpm -ivhvsftpd-2.0.5-28.el5.x86_64.rpm

Preparing... ###########################################[100%]

1:vsftpd ###########################################[100%]


//确认安装成功

[root@localhostServer]# rpm -q vsftpd

vsftpd-2.0.5-28.el5

17)查找vivim的位置,然后删除vi,vim程序,用rpm重装进行恢复

//查看vi,vim位置

[root@localhostServer]# which vi vim

/bin/vi

/usr/bin/vim


//删除vi,vim程序

[root@localhostServer]# rm -rf /bin/vi /usr/bin/vim


//确认删除成功

[root@localhostServer]# vim /etc/passwd

bash:vim: command not found


//查找安装包名

[root@localhostServer]# rpm -qf /bin/vi /usr/bin/vim

vim-minimal-7.0.109-7.2.el5

vim-enhanced-7.0.109-7.2.el5


//到光盘Server确认安装包是否存在

[root@localhostServer]# ls *vim*

vim-common-7.0.109-7.2.el5.x86_64.rpm vim-minimal-7.0.109-7.2.el5.x86_64.rpm

vim-enhanced-7.0.109-7.2.el5.x86_64.rpm vim-X11-7.0.109-7.2.el5.x86_64.rpm


//强制安装恢复

[root@localhost Server]# rpm -ivh vim-minimal-7.0.109-7.2.el5.x86_64.rpmvim-enhanced-7.0.109-7.2.el5.x86_64.rpm --force

Preparing... ###########################################[100%]

1:vim-enhanced ###########################################[ 50%]

2:vim-minimal ###########################################[100%]


//确认恢复成功

[root@localhostServer]# vim /etc/passwd

18)卸载vsftpd

[root@localhostServer]# rpm -e vsftpd


//确认卸载成功

[root@localhostServer]# rpm -q vsftpd

packagevsftpd is not installed

1.2.配置YUM库及更新操作

1)安装gcc

//卸载光盘

[root@localhost~]# umount /dev/cdrom


//确认卸载成功

[root@localhost~]# mount | tail -n 1

sunrpcon /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)


//手工挂载光盘

[root@localhost~]# mount /dev/cdrom /media/

mount:block device /dev/cdrom is write-protected, mounting read-only


//确认挂载成功

[root@localhost~]# mount | tail -n 1

/dev/hdcon /media type iso9660 (ro)


//进入配置文件目录

[root@localhost~]# cd /etc/yum.repos.d/

[root@localhostyum.repos.d]# ls

rhel-debuginfo.repo



//复制配置模版

[root@localhostyum.repos.d]# cp rhel-debuginfo.reporhel5.9.repo


//确认复制成功

[root@localhostyum.repos.d]# ls

rhel5.9.repo rhel-debuginfo.repo


//修改复制的配置文件

[root@localhostyum.repos.d]# vim rhel5.9.repo

//内容如下

[rhel5.9]

name=Liunx RedHat 5.9

baseurl=file:///media/Server/

enable=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


//确认yum库配置正确

[root@localhost~]# yum list | head

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

InstalledPackages

...

installed

GConf2.i386 2.14.0-9.el5 installed

GConf2.x86_64 2.14.0-9.el5 installed

MAKEDEV.x86_64 3.23-1.2 installed

NetworkManager.i386 1:0.7.0-13.el5 installed


//确认gcc未安装

[root@localhost~]# rpm -q gcc

packagegcc is not installed


//安装gcc

[root@localhost~]# yum -y install gcc

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

Settingup Install Process

ResolvingDependencies

...

Complete!


//确认安装成功

[root@localhost~]# rpm -q gcc

gcc-4.1.2-54.el5

2)卸载vim-common

[root@localhost~]# yum -y remove vim-common

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

Settingup Remove Process

ResolvingDependencies

...

Complete!


//确认卸载成功

[root@localhost~]# rpm -q vim-common

packagevsftpd is not installed


3)安装vim-enhanced

[root@localhost~]# yum -y install vim-enhanced

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

Settingup Install Process

ResolvingDependencies

...

Complete!


//确认安装成功

[root@localhost~]# rpm -q vim-enhanced

vim-enhanced-7.0.109-7.2.el5

4)查看软件包列表

[root@localhost~]# yum list | head

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

InstalledPackages

Deployment_Guide-en-US.noarch 5.8-1.el5 installed

Deployment_Guide-zh-CN.noarch 5.8-1.el5 installed

Deployment_Guide-zh-TW.noarch 5.8-1.el5 installed

GConf2.i386 2.14.0-9.el5 installed

GConf2.x86_64 2.14.0-9.el5 installed

MAKEDEV.x86_64 3.23-1.2 installed

NetworkManager.i386 1:0.7.0-13.el5 installed

5)查看vsftpd的说明信息

[root@localhost~]# yum info vsftpd

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

AvailablePackages

Name : vsftpd

Arch : x86_64

Version : 2.0.5

Release : 28.el5

Size : 143 k

Repo : rhel5.9

Summary : vsftpd - 非常安全 Ftp 守护进程

URL : http://vsftpd.beasts.org/

License : GPL

Description:vsftpd 是一个非常安全 FTP 守护进程。它是完全从零开始

: 编写的。

6)安装vsftpd

//确认vsftpd未安装

[root@localhost ~]# rpm -qd vsftpd

packagevsftpd is not installed


//安装vsftpd

[root@localhost~]# yum -y install vsftpd

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

Settingup Install Process

ResolvingDependencies

...

Complete!

7)卸载vsftpd

[root@localhost~]# yum -y remove vsftpd

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

Settingup Remove Process

ResolvingDependencies

...

Complete!

8)查看软件组列表

[root@localhost~]# yum grouplist | head

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

Settingup Group Process

InstalledGroups:

GNOME 桌面环境

X 窗口系统

办公/生产率

图形化互联网

基于文本的互联网

打印支持

9)查看软件组DNS名称服务器的说明信息

[root@localhost~]# yum groupinfo "DNS 名称服务器"

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

Settingup Group Process


Group:DNS 名称服务器

Description: 该软件包组允许您在系统上运行 DNS 名称服务器(BIND)

Mandatory Packages:

bind

Default Packages:

bind-chroot

10)安装DNS名称服务器软件组

[root@localhost~]# yum -y groupinstall "DNS 名称服务器"

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

Settingup Group Process

ResolvingDependencies

...

Complete!

11)卸载DNS名称服务器软件组

[root@localhost~]# yum -y groupremove "DNS 名称服务器"

Loadedplugins: product-id, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

Settingup Group Process

ResolvingDependencies

...

Complete!

1.3.源码包的编译安装

安装httpd,并启动服务

//安装编译环境

[root@localhostyum.repos.d]# yum grouplist

[root@localhostyum.repos.d]# yum -y groupinstall "开发工具" " 开发库"

//将源码包文件手动放置到桌面

[root@localhostDesktop]# cd /root/Desktop/

[root@localhostDesktop]# cd tools/

[root@localhost tools]# ls

AdobeReader_chs-8.1.2-1.i486.tar.gz LibreOffice_4.1.1.2_Linux_x86-64_rpm.tar.gz

aria2-1.17.1.tar.gz linuxqq-v1.0.2-beta1.i386.rpm

Firefox-latest.tar.bz2 RealPlayer11GOLD.rpm

httpd-2.2.25.tar.gz webmin-1.630.tar.gz


//解压缩tar包到/usr/src

[root@localhost tools]# tar -zxf httpd-2.2.25.tar.gz -C /usr/src/


//进入目录,配置安装路径

[root@localhost tools]#cd /usr/src/httpd-2.2.25/

[root@localhosthttpd-2.2.25]# ./configure --prefix=/usr/local/apache2


//编译

[root@localhosthttpd-2.2.25]# make


//安装

[root@localhosthttpd-2.2.25]# make install


//开启apache服务

[root@localhosthttpd-2.2.25]# /usr/local/apache2/bin/apachectl start

[root@localhosthttpd-2.2.25]#


//用浏览器验证安装成功

005026133.png