Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use pkgsrc on Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how to install and use pkgsrc on Linux", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to install and use pkgsrc on Linux" article.

Pkgsrc is a package management system similar to Unix operating system. As the main package management system for NetBSD, it was separated from the FreeBSD ports collection and later added support for Solaris, followed by support for other operating systems.

Why use pkgsrc?

With the exception of MacOS, all Unix operating systems come with package managers. You don't necessarily need pkgsrc, but these may be three important reasons you want to try:

Pack up. If you're curious about packaging but haven't tried to create your own package, pkgsrc is a relatively simple system, especially if you're already familiar with Makefile and build systems like GNU Autotools. General purpose. If you use multiple operating systems or distributions, you may encounter the package manager for each system. You can use pkgsrc on different systems so that when you package programs for one system, you package all systems. Flexible. In many packaging systems, it is not always obvious how to choose a binary or source package. With pkgsrc, the difference is obvious. Both installation methods are equally easy, and both can solve dependencies for you.

How to install pkgsrc

Whether you are using BSD, Linux, Illumos, Solaris, or MacOS, the installation process is basically the same:

1. Use CVS to check out the pkgsrc tree

2. Boot the pkgsrc system

3. Install the software package

Check out a pkgsrc tree using CVS

Before Git and Subversion, there was CVS. You don't need to know much about CVS to check out the code. If you are used to Git, you can call the checked-out checkout clone clone. When you check out pkgsrc with CVS, you download the recipe recipes, which details how to build each package. It has a lot of files, but they are all small, because you don't actually pull the source code for each package, but only the build infrastructure and Makefile that you need to build on demand. With CVS, you can easily update the pkgsrc checkout when a new version is released.

The pkgsrc documentation recommends that the source tree be placed in the / usr directory, so you must run this command using sudo (or root):

$cd / usr$ sudo cvs-Q-Z2-d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout-r pkgsrc-2019Q3-P pkgsrc

At the time of this writing, the latest version is 2019Q3. Check the news section of the pkgsrc.org home page or the NetBSD documentation to determine the latest version.

Boot pkgsrc

After copying the pkgsrc tree to your computer, you will see a / usr/pkgsrc directory full of build scripts. Before using it, you must boot pkgsrc so that you can easily access the commands needed to build and install the software.

The way you boot pkgsrc depends on the operating system you use.

For NetBSD, you only need to use the bundled bootstrap:

# cd pkgsrc/bootstrap#. / bootstrap

On other systems, there are better ways, including some custom features, which are provided by Joyent. To know exactly which command to run, visit pkgsrc.joyent.com. For example, on Linux (Fedora, Debian, Slackware, etc.):

$curl-O https://pkgsrc.joyent.com/packages/Linux/el7/bootstrap/bootstrap-trunk-x86_64-20170127.tar.gz$ BOOTSTRAP_SHA= "eb0d6911489579ca893f67f8a528ecd02137d43a"

Although the path implies that the file is suitable for RHEL 7, binaries tend to be compatible with all (the cutting-edge Linux distributions). If you find that the binaries are not compatible with your distribution, you can choose to build from the source code.

Verify the SHA1 checksum:

$echo "${BOOTSTRAP_SHA}" bootstrap-trunk*gz > check-shasumsha1sum-c check-shasum

You can also verify the PGP signature:

$curl-O https://pkgsrc.joyent.com/packages/Linux/el7/bootstrap/bootstrap-trunk-x86_64-20170127.tar.gz.asc$ curl-sS https://pkgsrc.joyent.com/pgp/56AAACAF.asc | gpg-- import$ gpg-- verify ${BOOTSTRAP_TAR} {.asc,}

When you confirm that you have the correct boot kit, install it to / usr/pkg:

Sudo tar-zxpf ${BOOTSTRAP_TAR}-C /

It provides you with the usual pkgsrc commands. Add these locations to your PATH environment variable:

$echo "PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH" > > ~ / .bashrc$ echo "MANPATH=/usr/pkg/man:$MANPATH" > > ~ / .bashrc

If you prefer to use pkgsrc rather than rely on Joyent builds, simply run the boot script of the pkgsrc source tree. Before running a system-specific script, read the relevant README file in the bootstrap directory.

Teach you how to use pkgsrc on Linux teach you how to use pkgsrc on Linux how to use pkgsrc to install software

Using pkgsrc to install precompiled binaries (just like using DNF or Apt) is easy. The command for binary installation is pgkin, which has its own dedicated website pkgin.net. For anyone who has used Linux, this process should feel quite familiar.

To search for tmux packages:

$pkgin search tmux

To install the tmux package:

$sudo pkgin install tmux

The purpose of the pkgin command is to mimic the behavior of a typical Linux package manager, so there are options to list available packages, find specific executables provided by packages, and so on.

How to use pkgsrc to build from source code

What is really powerful about pkgsrc, however, is the ease of building packages from source code. You have checked out all 20000-plus build scripts in the first step, and you can access them directly by going to the pkgsrc source tree.

For example, to build tcsh from source code, first find the build script:

$find / usr/pkgsrc-type d-name "tcsh" / usr/pkgsrc/shells/tcsh

Next, go to the source directory:

$cd / usr/pgksrc/shells/tcsh

The build scripts directory contains a number of files to help build applications on your system, but it is worth noting that there are DESCR files containing software instructions, as well as the Makefile that triggered the build.

$lsCVS DESCR MakefilePLIST distinfo patches$ cat DESCRTCSH is an extended C-shell with many useful features likefilename completion, history editing, etc.$

When you are ready, build and install:

$sudo bmake install

The pkgsrc system uses the bmake command (provided after the pkgsrc is checked out in the first step), so be sure to use bmake (not out of habit).

If you are building for multiple systems, you can create a package instead of installing it immediately:

$cd / usr/pgksrc/shells/tcsh$ sudo bmake package [...] = > Creating binary package in / usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz

The package created by pkgsrc is standard tarball, but it can be easily installed through pkg_add:

$sudo pkg_add / usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgztcsh-X.Y.Z: adding / usr/pkg/bin/tcsh to / etc/shells$ tcshlocalhost%

Pkgsrc's pkgtools collection provides pkg_add, pkg_info, pkg_admin, pkg_create, and pkg_delete commands to help manage your build and maintenance of software packages on your system.

Pkgsrc, easy to manage

Pkgsrc system provides a direct and easy-to-use method of software package management. If you are looking for a package manager that doesn't get in your way and can be customized, try pkgsrc on any system running Unix or Unix-like.

The above is about the content of this article on "how to install and use pkgsrc on Linux". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report