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/cdrom gpgcheck=0 enabled=1 [root@localhost yum.repos.d]# yum clean all Loaded plugins: fastestmirror, langpacks Repository 'bash' is missing name in configuration, using id Cleaning repos: bash Cleaning up everything Cleaning up list of fastest mirrors [root@localhost yum.repos.d]# yum repolist Loaded plugins: fastestmirror, langpacks Repository 'bash' is missing name in configuration, using id bash | 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 mirrors repo id repo name status bash bash 9,007 repolist: 9,007
yum 命令
yum [options] [command] [package ...]
包管理
yum install package1 [package2] [....] #安裝程序包 yum reinstall package1 #重新安裝 yum update|downgrade package1 [.....] #升級|降級程序包 yum check-update #檢查可用升級 yum remove package1 yum 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, langpacks Repository 'bash' is missing name in configuration, using id Loading mirror speeds from cached hostfile Available Packages Name : vsftpd Arch : x86_64 Version : 3.0.2 Release : 10.el7 Size : 167 k Repo : bash Summary : Very Secure Ftp Daemon URL : https://security.appspot.com/vsftpd.html License : GPLv2 with exceptions Description : vsftpd is a Very Secure FTP daemon. It was written completely from : scratch. [root@localhost cdrom]# yum list |grep vsftpd Repository 'bash' is missing name in configuration, using id vsftpd.x86_64 3.0.2-10.el7 bash vsftpd-sysvinit.x86_64 3.0.2-10.el7 bash [root@localhost cdrom]# yum install vsftpd.x86_64 -y Loaded plugins: fastestmirror, langpacks Repository 'bash' is missing name in configuration, using id Loading mirror speeds from cached hostfile Resolving 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 Resolution Dependencies Resolved =================================================================================================================== Package Arch Version Repository Size =================================================================================================================== Installing: vsftpd x86_64 3.0.2-10.el7 bash 167 k Installing for dependencies: logrotate x86_64 3.8.6-6.el7 bash 66 k tcp_wrappers-libs x86_64 7.6-77.el7 bash 66 k Transaction Summary =================================================================================================================== Install 1 Package (+2 Dependent packages) Total download size: 299 k Installed size: 579 k Downloading packages: ------------------------------------------------------------------------------------------------------------------- Total 636 kB/s | 299 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running 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 vsftpd Loaded plugins: fastestmirror, langpacks Repository 'bash' is missing name in configuration, using id Loading mirror speeds from cached hostfile Installed Packages Name : vsftpd Arch : x86_64 Version : 3.0.2 Release : 10.el7 Size : 347 k Repo : installed From repo : bash Summary : Very Secure Ftp Daemon URL : https://security.appspot.com/vsftpd.html License : GPLv2 with exceptions Description : 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/[email protected] /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 -ant Active 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 ESTABLISHED tcp 0 0 10.1.252.249:22 10.1.250.31:61474 ESTABLISHED 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 [root@localhost bin]# ./apachectl start httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName [root@localhost bin]# netstat -ant Active 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 ESTABLISHED tcp 0 0 10.1.252.249:22 10.1.250.31:61474 ESTABLISHED tcp6 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