Установка и обновление приложений для ОС FreeBSD

В этой статье рассматриваются установка и обновление приложений операционной системы FreeBSD разными методами.

Устанавливаем пакет Curl. С ним и будем играться.

Назначили прокси :

freebsd7# setenv HTTP_PROXY http://172.16.2.1:3128

Скачиваем и инсталируем пакет:

freebsd7# pkg_add -vr curl

(ключ -v -расширенный вывод, -r — ставить из удаленного репозитария.)

scheme: [ftp]

user: []

password: []

host: [ftp.freebsd.org]

<<<offset 0, length -1, size -1, clength 1088297

Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/

packages-7.1-release/Latest/curl.tbz…

x +CONTENTS

x +COMMENT

x +DESC

x +MTREE_DIRS

x man/man1/curl.1.gz

port: [0]

document: [/pub/FreeBSD/ports/i386/packages-7.1-release/

Latest/curl.tbz]

scheme: [http]

user: []

pas(s)word: []

host: [172.16.2.1]

port: [3128]

document: [/]

—> 172.16.2.1:3128

looking up 172.16.2.1

connecting to 172.16.2.1:3128

packages-7.1-release/Latest/curl.tbz

>>> GET ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/

packages-7.1-release/Latest/curl.tbz HTTP/1.1

>>> Host: ftp.freebsd.org

>>> User-Agent: pkg_add libfetch/2.0

>>> Connection: close>>

<<< HTTP/1.0 200 Gatewaying

<<< Server: squid/2.7.STABLE6

<<< Date: Mon, 24 Aug 2009 19:52:19 GMT

<<< Content-Type: text/plain

<<< Content-Length: 1088297

content length: [1088297]

<<< Last-Modified: Mon, 08 Sep 2008 10:45:09 GMT

last modified: [2008-09-08 10:45:09]

<<< X-Cache: MISS from r200a.taosecurity.com

<<< Via: 1.0 r200a.taosecurity.com:3128 (squid/2.7.STABLE6)

<<< Connection: close

…edited…

x share/examples/curl/synctime.c

tar command returns 0 status

Done.

extract: Package name is curl-7.18.0

extract: CWD to /usr/local

extract: /usr/local/man/man1/curl.1.gz

…edited…

extract: /usr/local/share/examples/curl/synctime.c

extract: execute ‘/sbin/ldconfig -m /usr/local/lib’

extract: CWD to .

Running mtree for curl-7.18.0..

mtree -U -f +MTREE_DIRS -d -e -p /usr/local >/dev/null

Attempting to record package into /var/db/pkg/curl-7.18.0..

Package curl-7.18.0 registered in /var/db/pkg/curl-7.18.0

Проверяем регистрацию пакета:

freebsd7# pkg_info

curl-7.18.0 Non-interactive tool to get files

from FTP, GOPHER, HTTP(S)

Обновляем пути:

freebsd7# rehash

Инструмент Portaudit — самый легкий путь для проверки обновлений безопасности установленных пакетов.  Инсталируем portaudit на FreeBSD.

freebsd7# pkg_add -r portaudit

Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/

packages-7.1-release/Latest/portaudit.tbz… Done.

===> To check your installed ports for known

vulnerabilities now, do:

/usr/local/sbin/portaudit -Fda

freebsd7# rehash

Проверяем инсталированные пакеты

.

freebsd7# portaudit -Fdav

Attempting to fetch from http://www.FreeBSD.org/ports/.

auditfile.tbz 100% of57 kB 95 kBps

New database installed.

Database created: Mon Aug 24 15:10:03 EDT 2009

Affected package: curl-7.18.0 (matched by curl>=5.11<7.19.4)

Type of problem: curl — cURL/libcURL Location: Redirect

URLs Security Bypass.

5d433534-f41c-402e-ade5-e0a2259a7cb6.html>

1 problem(s) in your installed packages found.

You are advised to update or deinstall the affected

package(s) immediately.

Строка

(matched by curl>=5.11<7.19.4)

говорит нам о том, что есть более новая версия программного обеспечения Curl.

Теперь нам необходимо обновить программу.

Делаем это методом удаления старой версии и инсталляции новой.

Удаление пакета FreeBSD c помощью pkg_delete:

Смотрим какие пакеты установлены.

freebsd7# pkg_info

curl-7.18.0 Non-interactive tool to get files from FTP, GOPHER,HTTP(S)

portaudit-0.5.12 Checks installed ports against a list of security

vulnerabi

Переходим в /var/db/pkg/

freebsd7# cd /var/db/pkg/

freebsd7# ls

curl-7.18.0

Удаляем пакет curl-7.18.0

freebsd7# pkg_delete curl-7.18.0/

Проверяем — удалилось ли.

freebsd7# pkg_info

portaudit-0.5.12 Checks installed ports against a list of security

vulnerabi

Инсталяция новой версии пакета Curl с помощью pkg_add.

Определяем переменную PACKAGESITE, которая ссылается на место расположения новых пакетов

.

freebsd7# setenv PACKAGESITE ftp://ftp.freebsd.org//pub/

FreeBSD/ports/i386/packages-7.2-release/Latest/

Инсталлируем новый пакет.

free

bsd7# pkg_add -vr curl

scheme: [ftp]

user: []

password: []

host: [ftp.freebsd.org]

port: [0]

document: [//pub/FreeBSD/ports/i386/packages-7.2-release/Latest/curl.tbz]

scheme: [http]

user: []

password: []

host: [172.16.2.1]

port: [3128]

document: [/]

—> 172.16.2.1:3128

looking up 172.16.2.1

connecting to 172.16.2.1:3128

requesting ftp://ftp.freebsd.org//pub/FreeBSD/ports/

i386/packages-7.2-release/Latest/curl.tbz

>>> GET ftp://ftp.freebsd.org//pub/FreeBSD/ports/i386/

packages-7.2-release/Latest/curl.tbz HTTP/1.1

>>> Host: ftp.freebsd.org

>>> User-Agent: pkg_add libfetch/2.0

>>> Connection: close

>>>

<<< HTTP/1.0 200 Gatewaying

<<< Server: squid/2.7.STABLE6

<<< Date: Mon, 24 Aug 2009 20:00:58 GMT

<<< Content-Type: text/plain

<<< Content-Length: 1097934

content length: [1097934]

<<< Last-Modified: Mon, 13 Apr 2009 21:18:46 GMT

last modified: [2009-04-13 21:18:46]

<<< X-Cache: MISS from r200a.taosecurity.com

<<< Via: 1.0 r200a.taosecurity.com:3128 (squid-2.7.STABLE6)

<<< Connection: close

<<<

offset 0, length -1, size -1, clength 1097934

Fetching ftp://ftp.freebsd.org//pub/FreeBSD/ports/i386/

packages-7.2-release/Latest/curl.tbz…

x +CONTENTS

x +COMMENT

x +DESC

x +MTREE_DIRS

x man/man1/curl.1.gz

…edited…

x share/examples/curl/threaded-ssl.c

tar command returns 0 status

Done.

Package ‘curl-7.19.4’ depends on ‘ca_root_nss-3.11.9_2’

with ‘security/ca_root_nss’ origin.

scheme: [ftp]

user: []

password: []

host: [ftp.freebsd.org]

port: [0]

document: [//pub/FreeBSD/ports/i386/packages-7.2-release/All/ca_root_nss-3.11.9_2.tbz]

scheme: [http]

user: []

password: []

host: [172.16.2.1]

port: [3128]

document: [/]

—> 172.16.2.1:3128

looking up 172.16.2.1

connecting to 172.16.2.1:3128

requesting ftp://ftp.freebsd.org//pub/FreeBSD/ports/

i386/packages-7.2-release/All/ca_root_nss-3.11.9_2.tbz

>>> GET ftp://ftp.freebsd.org//pub/FreeBSD/ports/i386/

packages-7.2-release/All/ca_root_nss-3.11.9_2.tbz HTTP/1.1

>>> Host: ftp.freebsd.org

>>> User-Agent: pkg_add libfetch/2.0

>>> Connection: close

>>>

<<< HTTP/1.0 200 Gatewaying

<<< Server: squid/2.7.STABLE6

<<< Date: Mon, 24 Aug 2009 20:01:02 GMT

<<< Content-Type: text/plain

<<< Content-Length: 172602

content length: [172602]

<<< Last-Modified: Mon, 13 Apr 2009 21:00:07 GMT

last modified: [2009-04-13 21:00:07]

<<< X-Cache: MISS from r200a.taosecurity.com

<<< Via: 1.0 r200a.taosecurity.com:3128 (squid/2.7.STABLE6)

<<< Connection: close

<<<

offset 0, length -1, size -1, clength 172602

Fetching ftp://ftp.freebsd.org//pub/FreeBSD/ports/i386/

packages-7.2-release/All/ca_root_nss-3.11.9_2.tbz…

x +CONTENTS

x +COMMENT

x +DESC

x +MTREE_DIRS

x share/certs/ca-root-nss.crt

tar command returns 0 status

Done.

Finished loading ca_root_nss-3.11.9_2 over FTP.

extract: Package name is ca_root_nss-3.11.9_2

extract: CWD to /usr/local

extract: /usr/local/share/certs/ca-root-nss.crt

extract: CWD to .

Running mtree for ca_root_nss-3.11.9_2..

mtree -U -f +MTREE_DIRS -d -e -p /usr/local >/dev/null

Attempting to record package into /var/db/pkg/ca_root_nss-3.11.9_2..

Package ca_root_nss-3.11.9_2 registered in /var/db/pkg/ca_root_nss-3.11.9_2

‘ca_root_nss-3.11.9_2’ loaded successfully.

extract: Package name is curl-7.19.4

extract: CWD to /usr/local

extract: /usr/local/man/man1/curl.1.gz

…edited…

extract: /usr/local/share/examples/curl/threaded-ssl.c

extract: execute ‘/sbin/ldconfig -m /usr/local/lib’

extract: CWD to .

Running mtree for curl-7.19.4..

mtree -U -f +MTREE_DIRS -d -e -p /usr/local >/dev/null

Attempting to record package into /var/db/pkg/curl-7.19.4..

Trying to record dependency on package ‘ca_root_nss-3.11.9_2’ with ‘security/ca_root_nss’ origin.

Package curl-7.19.4 registered in /var/db/pkg/curl-7.19.4

Проверяем.

freebsd7# pkg_info

ca_root_nss-3.11.9_2 The root certificate bundle from the Mozilla Project

curl-7.19.4 Non-interactive tool to get files from FTP, GOPHER, HTTP(S)

portaudit-0.5.12 Checks installed ports against a list of security vulnerabi

Проверяем инсталированные пакеты.

freebsd7# portaudit -Fdav

Attempting to fetch from http://www.FreeBSD.org/ports/.

auditfile.tbz 100% of 57 kB 69 kBps

New database installed.

Database created: Mon Aug 24 15:40:01 EDT 2009

0 problem(s) in your installed packages found.

Итак видим что все нормально.

Работаем с портами.

Во FreeBSD дерево портов находится в директории/usr/ports. Простейший путь обновить дерево портов — использовать утилиту portsnap.Она входит в стандартную установку FreeBSD

.

Сначала необходимо выполнить команду:

# portsnap fetch для загрузки дерева портов.

# portsnap extract (используется только 1 раз при первой загрузке (обновлении) портов).

Далее

#portsnap update для обновления базы данных портов.

Проинсталлировав порты. мы можем использовать утилиту pkg_version.

Вот как это делается.

freebsd7# portsnap fetch

Looking up portsnap.FreeBSD.org mirrors… 3 mirrors found.

Fetching public key from portsnap2.FreeBSD.org… done.

Fetching snapshot tag from portsnap2.FreeBSD.org… done.

Fetching snapshot metadata… done.

Fetching snapshot generated at Sun Aug 23 20:41:07 EDT 2009:

e4a063906c569a6d82cdc053dda2ced013f53d80723ef4100% of 59 MB 359 kBps

00m00s

Extracting snapshot… done.

Verifying snapshot integrity… done.

Fetching snapshot tag from portsnap2.FreeBSD.org… done.

Fetching snapshot metadata… done.

Updating from Sun Aug 23 20:41:07 EDT 2009 to Mon Aug 24 13:52:56 EDT 2009.

Fetching 4 metadata patches… done.

Applying metadata patches… done.

Fetching 0 metadata files… done.

Fetching 36 patches…..10….20….30… done.

Applying patches… done.

Fetching 2 new ports or files… done.

freebsd7# portsnap extract

/usr/ports/.cvsignore

/usr/ports/CHANGES

/usr/ports/COPYRIGHT

…edited…

/usr/ports/x11/zenity/

Building new INDEX files… done.

Используем pkg_version для проверки обновлений

freebsd7# pkg_version -v

ca_root_nss-3.11.9_2 = up-to-date with port

curl-7.19.4 < needs updating (port has 7.19.6_1)

portaudit-0.5.12 < needs updating (port has 0.5.13)

Обновляем программу Curl.

Сначала удаляем старый Curl.

freebsd7# pkg_deinstall -R curl

—> Deinstalling ‘curl-7.19.4’

—> Deinstalling ‘ca_root_nss-3.11.9_2’

[Updating the pkgdb <format:bdb_btree> in /var/db/pkg … – 9 packages found

(-1 +0) (…) done]

[Updating the pkgdb <format:bdb_btree> in /var/db/pkg … – 8 packages found

(-1 +0) (…) done]

Ищем порт Curl в дереве портов.

freebsd7# cd /usr/ports

freebsd7# make search name=curl

Port: curl-7.19.6_1

Path: /usr/ports/ftp/curl

Info: Non-interactive tool to get files from FTP, GOPHER, HTTP(S) servers

Maint:

Этот адрес электронной почты защищен от спам-ботов. У вас должен быть включен JavaScript для просмотра.

B-deps: perl-5.8.9_3R-deps: ca_root_nss-3.11.9_2

Port: curlpp-0.7.0_1

Path: /usr/ports/ftp/curlpp

Info: A C++ wrapper for libcurl

B-deps: ca_root_nss-3.11.9_2 curl-7.19.6_1

R-deps: ca_root_nss-3.11.9_2 curl-7.19.6_1

WWW:

…truncated…

freebsd7# cd /usr/ports/ftp/curl

Выполняем make showconfig порта Curl, что покажет с каками опциями будет собираться порт.

Если необходимо редактируем опции.

freebsd7# make showconfig

===> The following configuration options are available for curl-7.19.6_1:

CARES=off «Asynchronous DNS resolution via c-ares»

CURL_DEBUG=off «Enable curl diagnostic output»

GNUTLS=off «Use GNU TLS if OPENSSL is OFF»

IPV6=on «IPv6 support»

KERBEROS4=off «Kerberos 4 authentication»

LDAP=off «LDAP support»

LDAPS=off «LDAPS support (requires LDAP and SSL)»

LIBIDN=off «Internationalized Domain Names via libidn»

LIBSSH2=on «SCP/SFTP support via libssh2»

NTLM=off «NTLM authentication»

OPENSSL=on «OpenSSL support»

PROXY=on «Proxy support»

TRACKMEMORY=off «Enable curl memory diagnostic output»

===> Use ‘make config’ to modify these settings

Выполняем команду make

freebsd7# make

===> Found saved configuration for curl-7.19.6_1

=> curl-7.19.6.tar.bz2 doesn’t seem to exist in /usr/ports/distfiles/.

curl-7.19.6.tar.bz2 100% of 2292 kB 2336 kBps

…edit…

===> Extracting for curl-7.19.6_1

=> MD5 Checksum OK for curl-7.19.6.tar.bz2.

=> SHA256 Checksum OK for curl-7.19.6.tar.bz2.

===> curl-7.19.6_1 depends on file: /usr/local/bin/perl5.8.9 – found

===> Patching for curl-7.19.6_1

===> curl-7.19.6_1 depends on file: /usr/local/bin/perl5.8.9 – found

===> Applying FreeBSD patches for curl-7.19.6_1

===> curl-7.19.6_1 depends on file: /usr/local/bin/perl5.8.9 – found

===> curl-7.19.6_1 depends on shared library: ssh2.1– not found

===> Verifying install for ssh2.1 in /usr/ports/security/libssh2

=> libssh2-1.2.tar.gz doesn’t seem to exist in /usr/ports/distfiles/.

…edit…

FreeBSD/ports/distfiles/.

libssh2-1.2.tar 100% of 519 kB 2150 kBps

===> Extracting for libssh2-1.2,2

=> MD5 Checksum OK for libssh2-1.2.tar.gz.

=> SHA256 Checksum OK for libssh2-1.2.tar.gz.

===> Patching for libssh2-1.2,2

===> Configuring for libssh2-1.2,2

checking whether to enable maintainer-specific portions

of Makefiles… no

checking for sed… /usr/bin/sed

checking for a BSD-compatible install… /usr/bin/

install -c -o root -g wheel

checking whether build environment is sane… yes

…edited…

===> Registering installation for libssh2-1.2,2

===> Returning to build of curl-7.19.6_1

===> Configuring for curl-7.19.6_1

checking whether to enable maintainer-specific portions of Makefiles… no

checking whether to enable debug build options… no

checking whether to enable compiler optimizer… notspecified (assuming yes)

checking whether to enable strict compiler warnings… no

checking whether to enable curl debug memory tracking… no

checking for sed… /usr/bin/sed

checking for grep… /usr/bin/grep

checking for egrep… /usr/bin/grep -E

checking for ar… /usr/bin/ar

…edited…

Making all in examples

Making all in libcurl

Выполняем команду make install порта Curl.

freebsd7# make install

===> Installing for curl-7.19.6_1

===> curl-7.19.6_1 depends on file: /usr/local/share/certs/ca-root-nss.crt – found

===> curl-7.19.6_1 depends on shared library: ssh2.1 – found

===> Generating temporary packing list

===> Checking if ftp/curl already installed

Making install in lib

…edited…

===> Registering installation for curl-7.19.6_1

===> SECURITY REPORT:

This port has installed the following files which

Порт проинсталлирован.

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *