|
yum
yum :Yellow dog Updater modified
是Centos中前端软件管理器,基于RPM包管理,能够从指定的服务器自动下载RPM包且安装,最大的特点就是能够解决软件包的依赖性。
软件包来源:
可以是通过网络共享服务器获取,也可以通过本地文件获取
通过ftp文件共享服务器获得ftp://
通过网络共享服务器获得http://
本地文件共享服务器获得file://
yum客户端配置文件:
/etc/yum.conf 提供仓库的配置
/etc/yum.repos.d/*.repo 指定仓库位置的配置文件,可以是多个*.repo结尾的文件
yum库指定文件详解
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| [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库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| #将光盘进行挂载
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文件
[iyunv@localhost yum.repos.d]# vim bash.repo
[bash]
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
[iyunv@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
[iyunv@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 ...]
包管理
1
2
3
4
5
6
7
8
9
10
11
12
13
| yum install package1 [package2] [....]
#安装程序包
yum reinstall package1
#重新安装
yum update|downgrade package1 [.....]
#升级|降级程序包
yum check-update
#检查可用升级
yum remove package1
yum repolist [all|enabled|disabled]
#显示仓库列表
yum list
#显示程序包
|
包组管理
1
2
3
4
5
6
7
8
9
10
| yum groupinstall group1
#安装包组
yum groupupdate group1
#升级安装包组
yum grouplist
#查看包组
yum groupremove group1
#删除包组
yum groupinfo group1
#查看组属性
|
yum 命令行常用选项
1
2
3
| --nogpgcheck 禁止进行 gpg check
-y 自动回答yes,取消交互式安装
-q 静默模式
|
下面使用yum安装一个vsftp服务:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
| [iyunv@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.
[iyunv@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
[iyunv@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!
[iyunv@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.
[iyunv@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
[iyunv@localhost cdrom]# ll /etc/vsftpd/
ftpusers vsftpd.conf vsftpd.conf.rpmsave
user_list vsftpd_conf_migrate.sh
[iyunv@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
www.code.google.com
下图是sourceforge站点
开始准备编译安装一个apache软件
首先准备
编译安装准备:
提供开发工具及开发环境
开发工具:make, gcc等
开发环境:开发库,头文件
glibc:标准库
安装开发工具及开发环境
首先用yum安装开发环境包组
1
| yum groupinstall Development Tools -y
|
然后从apache官网下载源代码包
解压包
1
| [iyunv@localhost testdir]# tar -jxvf httpd-2.2.31.tar.bz2
|
正式安装
在安装前还要啰嗦几句
编译安装源代码包需要三部
第一步:执行configure脚本,该脚本位于程式源文件的主目录下
1
| [iyunv@localhost httpd-2.2.31]# ./configure
|
常用选项
./configure --help
--prefix=/PATH: 指定默认安装位置,默认为/usr/local/
--sysconfdir=/PATH:配置文件安装位置
该脚本将对系统进行扫描,确保程序所需的库文已存在,并做好文件路径及其他所需的设置工作。如果程式所需的库文件不完全,该设置脚本就会退出,并告诉你还需要哪些库文件或是哪些版本太旧需要更新。
第二步:编译
脚本执行完成没有报错后就是编译源代码了,在软件目录下执行make
第三步:安装
软件成功编译后,然后将他们安装到系统上。大部分程序的makefile文件中都会有一个用于安装的函数
启动程序
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| [iyunv@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
[iyunv@localhost bin]# ./apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[iyunv@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
|
|
|