yum

yum :Yellow dog Updater modified 

    是Centos中前端软件管理器,基于RPM包管理,能够从指定的服务器自动下载RPM包且安装,最大的特点就是能够解决软件包的依赖性。

ps:rpm包具体管理参考请博客:http://snowbamboo1.blog.51cto.com

软件包来源:

可以是通过网络共享服务器获取,也可以通过本地文件获取

通过ftp文件共享服务器获得ftp://

通过网络共享服务器获得http://

本地文件共享服务器获得file://

yum客户端配置文件:

/etc/yum.conf 提供仓库的配置

/etc/yum.repos.d/*.repo 指定仓库位置的配置文件,可以是多个*.repo结尾的文件

yum库指定文件详解

[extras]#名称name=CentOS-$releasever - Extras#描述可省去不用写baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/       file:///mnt/cdrom       ftp://10.0.10.1/centos7/#url地址,格式如上。也可以只设定一个地址。gpgcheck=1#gpg检查是否key,可以设置成0禁用enabled=1 #默认是开启状态,可以不用添加gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#key地址

下面我配置做一个本地光盘挂载的yum库

#将光盘进行挂载vim /etc/fstab/dev/sr0       /mnt/cdrom        iso9660      defaults     0 0 df hT #查看挂载状态/dev/sr0                   iso9660   7.3G  7.3G     0 100% /mnt/cdrom#配置yum仓库,首先将目录下其他yum原文件备份到别处,新建一个新的.repo文件[root@localhost yum.repos.d]# vim bash.repo [bash]baseurl=file:///mnt/cdromgpgcheck=0enabled=1[root@localhost yum.repos.d]# yum clean allLoaded plugins: fastestmirror, langpacksRepository 'bash' is missing name in configuration, using idCleaning repos: bashCleaning up everythingCleaning up list of fastest mirrors[root@localhost yum.repos.d]# yum repolistLoaded plugins: fastestmirror, langpacksRepository 'bash' is missing name in configuration, using idbash                         | 3.6 kB     00:00     (1/2): bash/group_gz           | 155 kB   00:00     (2/2): bash/primary_db         | 5.3 MB   00:00     Determining fastest mirrorsrepo id                 repo name             statusbash                    bash                  9,007repolist: 9,007

yum 命令

yum [options] [command] [package ...]

包管理

yum install package1 [package2] [....]#安装程序包yum reinstall package1 #重新安装yum update|downgrade package1 [.....]#升级|降级程序包yum check-update#检查可用升级yum remove package1yum repolist [all|enabled|disabled]#显示仓库列表yum list #显示程序包

包组管理

yum groupinstall group1#安装包组yum groupupdate group1#升级安装包组yum grouplist  #查看包组yum groupremove group1#删除包组yum groupinfo group1#查看组属性

yum 命令行常用选项

--nogpgcheck 禁止进行 gpg check-y 自动回答yes,取消交互式安装-q 静默模式

下面使用yum安装一个vsftp服务

[root@localhost cdrom]# yum info vsftpd Loaded plugins: fastestmirror, langpacksRepository 'bash' is missing name in configuration, using idLoading mirror speeds from cached hostfileAvailable PackagesName        : vsftpdArch        : x86_64Version     : 3.0.2Release     : 10.el7Size        : 167 kRepo        : bashSummary     : Very Secure Ftp DaemonURL         : https://security.appspot.com/vsftpd.htmlLicense     : GPLv2 with exceptionsDescription : vsftpd is a Very Secure FTP daemon. It was written completely from            : scratch.            [root@localhost cdrom]# yum list |grep vsftpdRepository 'bash' is missing name in configuration, using idvsftpd.x86_64                                3.0.2-10.el7                   bashvsftpd-sysvinit.x86_64                       3.0.2-10.el7                   bash[root@localhost cdrom]# yum install vsftpd.x86_64 -yLoaded plugins: fastestmirror, langpacksRepository 'bash' is missing name in configuration, using idLoading mirror speeds from cached hostfileResolving Dependencies--> Running transaction check---> Package vsftpd.x86_64 0:3.0.2-10.el7 will be installed--> Processing Dependency: logrotate for package: vsftpd-3.0.2-10.el7.x86_64--> Processing Dependency: libwrap.so.0()(64bit) for package: vsftpd-3.0.2-10.el7.x86_64--> Running transaction check---> Package logrotate.x86_64 0:3.8.6-6.el7 will be installed---> Package tcp_wrappers-libs.x86_64 0:7.6-77.el7 will be installed--> Finished Dependency ResolutionDependencies Resolved=================================================================================================================== Package                           Arch                   Version                       Repository            Size===================================================================================================================Installing: vsftpd                            x86_64                 3.0.2-10.el7                  bash                 167 kInstalling for dependencies: logrotate                         x86_64                 3.8.6-6.el7                   bash                  66 k tcp_wrappers-libs                 x86_64                 7.6-77.el7                    bash                  66 kTransaction Summary===================================================================================================================Install  1 Package (+2 Dependent packages)Total download size: 299 kInstalled size: 579 kDownloading packages:-------------------------------------------------------------------------------------------------------------------Total                                                                              636 kB/s | 299 kB  00:00:00     Running transaction checkRunning transaction testTransaction test succeededRunning transaction  Installing : tcp_wrappers-libs-7.6-77.el7.x86_64                                                             1/3   Installing : logrotate-3.8.6-6.el7.x86_64                                                                    2/3 warning: /var/lib/logrotate.status created as /var/lib/logrotate.status.rpmnew  Installing : vsftpd-3.0.2-10.el7.x86_64                                                                      3/3   Verifying  : logrotate-3.8.6-6.el7.x86_64                                                                    1/3   Verifying  : vsftpd-3.0.2-10.el7.x86_64                                                                      2/3   Verifying  : tcp_wrappers-libs-7.6-77.el7.x86_64                                                             3/3 Installed:  vsftpd.x86_64 0:3.0.2-10.el7                                                                                     Dependency Installed:  logrotate.x86_64 0:3.8.6-6.el7                       tcp_wrappers-libs.x86_64 0:7.6-77.el7                      Complete![root@localhost cdrom]# yum info vsftpdLoaded plugins: fastestmirror, langpacksRepository 'bash' is missing name in configuration, using idLoading mirror speeds from cached hostfileInstalled PackagesName        : vsftpdArch        : x86_64Version     : 3.0.2Release     : 10.el7Size        : 347 kRepo        : installedFrom repo   : bashSummary     : Very Secure Ftp DaemonURL         : https://security.appspot.com/vsftpd.htmlLicense     : GPLv2 with exceptionsDescription : vsftpd is a Very Secure FTP daemon. It was written completely from            : scratch.[root@localhost cdrom]# rpm -ql vsftpd/etc/logrotate.d/vsftpd/etc/pam.d/vsftpd/etc/vsftpd/etc/vsftpd/ftpusers/etc/vsftpd/user_list/etc/vsftpd/vsftpd.conf/etc/vsftpd/vsftpd_conf_migrate.sh/usr/lib/systemd/system-generators/vsftpd-generator/usr/lib/systemd/system/vsftpd.service/usr/lib/systemd/system/vsftpd.target/usr/lib/systemd/system/vsftpd@.service/usr/sbin/vsftpd/usr/share/doc/vsftpd-3.0.2/usr/share/doc/vsftpd-3.0.2/AUDIT/usr/share/doc/vsftpd-3.0.2/BENCHMARKS/usr/share/doc/vsftpd-3.0.2/BUGS/usr/share/doc/vsftpd-3.0.2/COPYING/usr/share/doc/vsftpd-3.0.2/Changelog/usr/share/doc/vsftpd-3.0.2/EXAMPLE/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README.configuration/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.conf/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README.configuration/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/hosts.allow/usr/share/doc/vsftpd-3.0.2/EXAMPLE/README/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS/README/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README.configuration/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/logins.txt/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2/README/usr/share/doc/vsftpd-3.0.2/FAQ/usr/share/doc/vsftpd-3.0.2/INSTALL/usr/share/doc/vsftpd-3.0.2/LICENSE/usr/share/doc/vsftpd-3.0.2/README/usr/share/doc/vsftpd-3.0.2/README.security/usr/share/doc/vsftpd-3.0.2/REWARD/usr/share/doc/vsftpd-3.0.2/SECURITY/usr/share/doc/vsftpd-3.0.2/SECURITY/DESIGN/usr/share/doc/vsftpd-3.0.2/SECURITY/IMPLEMENTATION/usr/share/doc/vsftpd-3.0.2/SECURITY/OVERVIEW/usr/share/doc/vsftpd-3.0.2/SECURITY/TRUST/usr/share/doc/vsftpd-3.0.2/SIZE/usr/share/doc/vsftpd-3.0.2/SPEED/usr/share/doc/vsftpd-3.0.2/TODO/usr/share/doc/vsftpd-3.0.2/TUNING/usr/share/doc/vsftpd-3.0.2/vsftpd.xinetd/usr/share/man/man5/vsftpd.conf.5.gz/usr/share/man/man8/vsftpd.8.gz/var/ftp/var/ftp/pub[root@localhost cdrom]# ll /etc/vsftpd/ftpusers                vsftpd.conf             vsftpd.conf.rpmsave     user_list               vsftpd_conf_migrate.sh  [root@localhost cdrom]# ll /etc/vsftpd/total 24-rw-------. 1 root root  125 Nov 21  2015 ftpusers-rw-------. 1 root root  361 Nov 21  2015 user_list-rw-------. 1 root root 5030 Nov 21  2015 vsftpd.conf-rwxr--r--. 1 root root  338 Nov 21  2015 vsftpd_conf_migrate.sh-rw-------. 1 root root 1043 Aug 23 21:21 vsftpd.conf.rpmsave

 

源码安装 

  

源码报获取方式:

官方自建站点

例如tomcat站点

代码托管站点

www.SourceForge.net

www.Github.com

下图是sourceforge站点

开始准备编译安装一个apache软件

首先准备

编译安装准备:

提供开发工具及开发环境

  开发工具:make, gcc等

  开发环境:开发库,头文件

  glibc:标准库

安装开发工具及开发环境

首先用yum安装开发环境包组

yum groupinstall Development Tools -y

然后从apache官网下载源代码包

wget http://apache.fayea.com//httpd/httpd-2.2.31.tar.bz2

解压包

[root@localhost testdir]# tar -jxvf httpd-2.2.31.tar.bz2

正式安装

  在安装前还要啰嗦几句

编译安装源代码包需要三部

第一步:执行configure脚本,该脚本位于程式源文件的主目录下

[root@localhost httpd-2.2.31]# ./configure

常用选项

./configure --help

--prefix=/PATH: 指定默认安装位置,默认为/usr/local/

--sysconfdir=/PATH:配置文件安装位置

该脚本将对系统进行扫描,确保程序所需的库文已存在,并做好文件路径及其他所需的设置工作。如果程式所需的库文件不完全,该设置脚本就会退出,并告诉你还需要哪些库文件或是哪些版本太旧需要更新

第二步:编译

make

脚本执行完成没有报错后就是编译源代码了,在软件目录下执行make

第三步:安装

make install

软件成功编译后,然后将他们安装到系统上。大部分程序的makefile文件中都会有一个用于安装的函数

启动程序

[root@localhost bin]# netstat -antActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address           Foreign Address         State      tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN     tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN     tcp        0      0 127.0.0.1:6012          0.0.0.0:*               LISTEN     tcp        0     52 10.1.252.249:22         10.1.250.31:50337       ESTABLISHEDtcp        0      0 10.1.252.249:22         10.1.250.31:61474       ESTABLISHEDtcp6       0      0 :::22                   :::*                    LISTEN     tcp6       0      0 ::1:631                 :::*                    LISTEN     tcp6       0      0 ::1:25                  :::*                    LISTEN     tcp6       0      0 ::1:6010                :::*                    LISTEN     tcp6       0      0 ::1:6012                :::*                    LISTEN     [root@localhost bin]# ./apachectl starthttpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName[root@localhost bin]# netstat -antActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address           Foreign Address         State      tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN     tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN     tcp        0      0 127.0.0.1:6012          0.0.0.0:*               LISTEN     tcp        0     52 10.1.252.249:22         10.1.250.31:50337       ESTABLISHEDtcp        0      0 10.1.252.249:22         10.1.250.31:61474       ESTABLISHEDtcp6       0      0 :::80                   :::*                    LISTEN     tcp6       0      0 :::22                   :::*                    LISTEN     tcp6       0      0 ::1:631                 :::*                    LISTEN     tcp6       0      0 ::1:25                  :::*                    LISTEN     tcp6       0      0 ::1:6010                :::*                    LISTEN     tcp6       0      0 ::1:6012                :::*                    LISTEN