-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathchapter.system.packages.xml
More file actions
468 lines (435 loc) · 14 KB
/
Copy pathchapter.system.packages.xml
File metadata and controls
468 lines (435 loc) · 14 KB
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
<?xml version="1.0" encoding="UTF-8"?>
<chapter id="packages">
<title>Packages System</title>
<section id="packages.pkg">
<title>Using the Packages System</title>
<section>
<title>PACKAGESROOT / PKG_PATH 环境变量</title>
<screen>
setenv PACKAGESROOT ftp://ftp.freebsdchina.org
pkg_add -r libxml2 gmake autoconf262
export PKG_PATH=ftp://ftp.freebsd.org/pub/FreeBSD/8.2/packages/i386/
pkg_add mysql-server php5-fastcgi php5-gd-5.2.6-no_x11 lighttpd-1.4.19p3 nginx pecl-APC
</screen>
</section>
<section>
<title>Installing a Package</title>
<screen>
# pkg_add -r lsof
</screen>
</section>
<section>
<title>Managing Packages</title>
<screen>
# pkg_info
libiconv-1.13.1_1 A character set conversion library
libxml2-2.7.7 XML parser library for GNOME
lighttpd-1.4.26_3 A secure, fast, compliant, and very flexible Web Server
pcre-8.02 Perl Compatible Regular Expressions library
php5-5.3.2_1 PHP Scripting Language
pkg-config-0.23_1 A utility to retrieve information about installed libraries
spawn-fcgi-1.6.3 spawn-fcgi is used to spawn fastcgi applications
</screen>
<screen>
freebsd0# pkg_version
libiconv =
libxml2 =
lighttpd =
pcre =
php5 =
pkg-config =
spawn-fcgi =
# pkg_version -v
libiconv-1.13.1_1 = up-to-date with port
libxml2-2.7.7 = up-to-date with port
lighttpd-1.4.26_3 = up-to-date with port
pcre-8.02 = up-to-date with port
php5-5.3.2_1 = up-to-date with port
php5-ctype-5.3.2_1 = up-to-date with port
php5-dom-5.3.2_1 = up-to-date with port
php5-extensions-1.4 = up-to-date with port
php5-filter-5.3.2_1 = up-to-date with port
php5-hash-5.3.2_1 = up-to-date with port
php5-iconv-5.3.2_1 = up-to-date with port
php5-json-5.3.2_1 = up-to-date with port
php5-pdo-5.3.2_1 = up-to-date with port
php5-pdo_sqlite-5.3.2_1 = up-to-date with port
php5-posix-5.3.2_1 = up-to-date with port
php5-session-5.3.2_1 = up-to-date with port
php5-simplexml-5.3.2_1 = up-to-date with port
php5-sqlite-5.3.2_1 = up-to-date with port
php5-tokenizer-5.3.2_1 = up-to-date with port
php5-xml-5.3.2_1 = up-to-date with port
php5-xmlreader-5.3.2_1 = up-to-date with port
php5-xmlwriter-5.3.2_1 = up-to-date with port
pkg-config-0.23_1 = up-to-date with port
spawn-fcgi-1.6.3 = up-to-date with port
sqlite3-3.6.23.1_1 = up-to-date with port
</screen>
</section>
<section>
<title>Deleting a Package</title>
<screen>
# pkg_delete php5-5.3.2_1
</screen>
</section>
</section>
<section id="freebsd.upgrade">
<title>Updating and Upgrading FreeBSD</title>
<section>
<title>update</title>
<para>安全补丁</para>
<screen>
# freebsd-update fetch
# freebsd-update install
</screen>
<para>如果出现错误回滚</para>
<screen>
# freebsd-update rollback
</screen>
<screen>
freebsd# rehash
freebsd# freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching public key from update5.FreeBSD.org... done.
Fetching metadata signature for 8.0-RELEASE from update5.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 35 patches.....10....20....30.. done.
Applying patches... done.
The following files will be updated as part of updating to 8.0-RELEASE-p3:
/boot/kernel/ip_mroute.ko
/boot/kernel/ip_mroute.ko.symbols
/boot/kernel/kernel
/boot/kernel/kernel.symbols
/boot/kernel/krpc.ko
/boot/kernel/krpc.ko.symbols
/boot/kernel/nfsclient.ko
/boot/kernel/nfsclient.ko.symbols
/boot/kernel/zfs.ko
/boot/kernel/zfs.ko.symbols
/etc/mtree/BSD.var.dist
/lib/libzpool.so.2
/libexec/ld-elf.so.1
/usr/bin/dig
/usr/bin/host
/usr/bin/nslookup
/usr/bin/nsupdate
/usr/lib/libopie.a
/usr/lib/libopie.so.6
/usr/lib/libssl.a
/usr/lib/libssl.so.6
/usr/lib/libzpool.a
/usr/sbin/dnssec-dsfromkey
/usr/sbin/dnssec-keyfromlabel
/usr/sbin/dnssec-keygen
/usr/sbin/dnssec-signzone
/usr/sbin/freebsd-update
/usr/sbin/jail
/usr/sbin/lwresd
/usr/sbin/named
/usr/sbin/named-checkconf
/usr/sbin/named-checkzone
/usr/sbin/named-compilezone
/usr/sbin/ntpd
/usr/sbin/rndc-confgen
/usr/share/man/man2/mount.2.gz
/usr/share/man/man2/nmount.2.gz
/usr/share/man/man2/unmount.2.gz
/var/db/freebsd-update
/var/db/mergemaster.mtree
freebsd# freebsd-update install
Installing updates... done.
</screen>
</section>
<section>
<title>upgrade</title>
<para>寻找版本</para>
<para>http://update5.freebsd.org/</para>
<para>升级至9.1-RELEASE</para>
<screen>
freebsd# freebsd-update upgrade -r 9.1-RELEASE
</screen>
<screen>
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 9.1-RC3 from update5.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata files... done.
Inspecting system... done.
The following components of FreeBSD seem to be installed:
kernel/generic world/base world/games world/lib32
The following components of FreeBSD do not seem to be installed:
src/src world/doc
Does this look reasonable (y/n)? y
Fetching metadata signature for 9.1-RELEASE from update5.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 9.1-RC3 for merging... done.
Preparing to download files...
</screen>
<screen>
freebsd# freebsd-update install
</screen>
</section>
</section>
<section id="freebsd.ports">
<title>ports</title>
<section>
<title>update ports</title>
<para>update your port tree by typing following commands:</para>
<screen>
# portsnap fetch
# portsnap extract
# portsnap update
</screen>
<para>首次运行 portsnap 需要执行 portsnap extract 这个步骤,之后不再需要,直接运行 portsnap update 即可</para>
</section>
<section>
<title>install</title>
<screen>
# cd /usr/ports/lang/php5
# make install
</screen>
<para>reinstall</para>
<screen>
# make reinstall
</screen>
</section>
<section>
<title>remove</title>
<screen>
# make deinstall
</screen>
<para>如果用make install clean 安装,请用 pkg_delete 卸载</para>
</section>
<section>
<title>config menu</title>
<screen>
# cd /usr/ports/lang/php5
# make config
# make install
</screen>
</section>
</section>
<section id="pkgng">
<title>PKGNG - Pkgng is the Next Generation package management tool for FreeBSD.</title>
<para>https://mebsd.com/make-build-your-freebsd-word/pkgng-first-look-at-freebsds-new-package-manager.html</para>
<para>http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html</para>
<para>https://wiki.freebsd.org/pkgng</para>
<section>
<title>安装 pkgng</title>
<para>方法一:</para>
<screen>
<![CDATA[
# /usr/sbin/pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg please wait
Installing pkg-1.0.11... done
If you are upgrading from the old package format, first run:
# pkg2ng
usage: pkg [-v] [-d] [-j <jail name or id>|-c <chroot path>] <command> [<args>]
Global options supported:
-d Increment debug level
-j Execute pkg(1) inside a jail(8)
-c Execute pkg(1) inside a chroot(8)
-v Display pkg(1) version
Commands supported:
add Registers a package and installs it on the system
audit Reports vulnerable packages
autoremove Removes orphan packages
backup Backs-up and restores the local package database
check Checks for missing dependencies and database consistency
clean Cleans old packages from the cache
create Creates software package distributions
delete Deletes packages from the database and the system
fetch Fetches packages from a remote repository
help Displays help information
info Displays information about installed packages
install Installs packages from remote package repositories
query Queries information about installed packages
register Registers a package into the local database
remove Deletes packages from the database and the system
repo Creates a package repository catalogue
rquery Queries information in repository catalogues
search Performs a search of package repository catalogues
set Modifies information about packages in the local database
shell Opens a debug shell
shlib Displays which packages link against a specific shared library
stats Displays package database statistics
update Updates package repository catalogues
updating Displays UPDATING information for a package
upgrade Performs upgrades of packaged software distributions
version Displays the versions of installed packages
which Displays which package installed a specific file
For more information on the different commands see 'pkg help <command>'.
]]>
</screen>
<para>方法二:</para>
<screen>
# portsnap fetch update
# cd /usr/ports/ports-mgmt/pkg
# make
# make install clean
</screen>
<para>方法三</para>
<screen>
# pkg_add -r pkg
</screen>
</section>
<section>
<title>转换数据库</title>
<para>运行 pkg2ng 命令</para>
<screen>
# pkg2ng
</screen>
<para>设置 make.conf 文件</para>
<screen>
<![CDATA[
cat >> /etc/make.conf <<EOF
WITH_PKGNG=yes
EOF
]]>
</screen>
</section>
<section>
<title>install</title>
<para>安装包</para>
<screen>
# pkg install curl
</screen>
</section>
<section>
<title>delete</title>
<para>删除包</para>
<screen>
# pkg delete curl
</screen>
</section>
<section>
<title>info</title>
<para>显示所有包信息</para>
<screen>
pkg info
</screen>
<para>显示包之间的依赖关系</para>
<screen>
# pkg info -d subversion
subversion-1.7.7 depends on:
expat-2.0.1_2
pkgconf-0.8.9
sqlite3-3.7.14.1
gdbm-1.9.1
db42-4.2.52_5
libiconv-1.14
gettext-0.18.1.1
</screen>
<para>显示包中的文件</para>
<screen>
# pkg info -l subversion
subversion-1.7.7 owns the following files:
/usr/local/bin/svn
/usr/local/bin/svnadmin
/usr/local/bin/svndumpfilter
/usr/local/bin/svnlook
/usr/local/bin/svnrdump
/usr/local/bin/svnserve
/usr/local/bin/svnsync
/usr/local/bin/svnversion
/usr/local/etc/rc.d/svnserve
</screen>
</section>
<section>
<title>query</title>
<screen>
# pkg query "Package name = %n, Version = %v, Size = %sh" libxml2
Package name = libxml2, Version = 2.7.8_5, Size = 4 MB
# pkg query -a "Package name = %n, Version = %v, Size = %sh"
</screen>
<screen>
<![CDATA[
# pkg query "\
package[%n]\n\
version[%v]\n\
origin[%o]\n\
prefix[%p]\n\
maintainer[%m]\n\
comment[%c]\n\
www[%w]\n\
licenselogic[%l]\n\
flatsize[%sh]\n\
flatsizebytes[%sb]\n\
orphan[%a]\n\
message[%M]\n\
" libxml2
typescript package[libxml2]
typescript version[2.7.8_5]
typescript origin[textproc/libxml2]
typescript prefix[/usr/local]
typescript maintainer[gnome@FreeBSD.org]
typescript comment[XML parser library for GNOME]
typescript www[http://xmlsoft.org/]
typescript licenselogic[single]
typescript flatsize[4 MB]
typescript flatsizebytes[4258960]
typescript orphan[0]
typescript message[]
]]>
</screen>
</section>
<section>
<title>upgrade</title>
<screen>
# pkg upgrade
</screen>
</section>
</section>
<section id="pkg.faq">
<title>FAQ</title>
<section>
<title>Shared object "libarchive.so.5" not found, required by "pkg"</title>
<para>问题出现在从FreeBSD 9.2 升级到 FreeBSD 10.0,升级pkg可以解决</para>
<screen>
# pkg-static upgrade
</screen>
</section>
<section>
<title>pkg: PACKAGESITE in pkg.conf is deprecated. Please create a repository configuration file</title>
<para>编辑下面的文件</para>
<screen>
# cat /usr/local/etc/pkg.conf [0]
#packagesite: http://pkg.FreeBSD.org/freebsd:9:x86:64/latest
PACKAGESITE : http://pkg.freebsd.org/${ABI}/latest
</screen>
<para>到 http://pkg.freebsd.org/ 查找适合你版本的URL</para>
<screen>
# cat /usr/local/etc/pkg.conf [0]
#packagesite: http://pkg.FreeBSD.org/freebsd:9:x86:64/latest
#PACKAGESITE : http://pkg.freebsd.org/${ABI}/latest
PACKAGESITE : http://pkg.freebsd.org/freebsd:10:x86:64/latest
</screen>
<para>更新pkg</para>
<screen>
pkg update
</screen>
</section>
</section>
</chapter>
<chapter id="editors">
<title>编辑器 (editors)</title>
<section id="vim">
<title>vim</title>
<screen>
# pkg_add -r vim
</screen>
<screen>
# cd /usr/ports/editors/vim
# make install
</screen>
</section>
</chapter>