perkin.org.uk - Installing SVR4 packages on SmartOS









Search Preview

Installing SVR4 packages on SmartOS

perkin.org.uk
Jonathan Perkin about me · rss · twitter · github
.org.uk > perkin.org.uk

SEO audit: Content analysis

Language Error! No language localisation is found.
Title Installing SVR4 packages on SmartOS
Text / HTML ratio 56 %
Frame Excellent! The website does not use iFrame solutions.
Flash Excellent! The website does not have any flash contents.
Keywords cloud » packages package SmartOS pkgsrc riak file SVR4 script files Solaris Jan Feb Dec install case provided Jun pkgmap metadata
Keywords consistency
Keyword Content Title Description Headings
» 52
packages 25
package 24
SmartOS 22
pkgsrc 20
riak 19
Headings
H1 H2 H3 H4 H5 H6
2 4 8 0 0 0
Images We found 0 images on this web page.

SEO Keywords (Single)

Keyword Occurrence Density
» 52 2.60 %
packages 25 1.25 %
package 24 1.20 %
SmartOS 22 1.10 %
pkgsrc 20 1.00 %
riak 19 0.95 %
file 14 0.70 %
SVR4 14 0.70 %
script 13 0.65 %
files 11 0.55 %
Solaris 10 0.50 %
Jan 9 0.45 %
Feb 8 0.40 %
Dec 8 0.40 %
install 7 0.35 %
case 7 0.35 %
provided 7 0.35 %
Jun 7 0.35 %
pkgmap 6 0.30 %
metadata 6 0.30 %

SEO Keywords (Two Word)

Keyword Occurrence Density
2013 » 18 0.90 %
2012 » 14 0.70 %
the package 11 0.55 %
2011 » 11 0.55 %
SVR4 packages 8 0.40 %
on SmartOS 7 0.35 %
Jun 2011 6 0.30 %
from the 6 0.30 %
Jan 2013 6 0.30 %
1 admin 5 0.25 %
admin deniedssh 5 0.25 %
riak riak 5 0.25 %
it is 5 0.25 %
we can 5 0.25 %
and we 5 0.25 %
Feb 19 5 0.25 %
we will 5 0.25 %
19 1517 5 0.25 %
CPU part 4 0.20 %
8bit CPU 4 0.20 %

SEO Keywords (Three Word)

Keyword Occurrence Density Possible Spam
Jun 2011 » 6 0.30 % No
Jan 2013 » 6 0.30 % No
Feb 19 1517 5 0.25 % No
1 admin deniedssh 5 0.25 % No
» pkgsrc on 4 0.20 % No
8bit CPU part 4 0.20 % No
nodejspowered 8bit CPU 4 0.20 % No
A nodejspowered 8bit 4 0.20 % No
» A nodejspowered 4 0.20 % No
2013 » A 4 0.20 % No
Dec 2013 » 4 0.20 % No
Jan 2012 » 3 0.15 % No
rwx 1 admin 3 0.15 % No
pkgsrc on SmartOS 3 0.15 % No
the pkgmap file 3 0.15 % No
2013 » pkgsrc 3 0.15 % No
» How to 3 0.15 % No
to create the 2 0.10 % No
the recommended minimum 2 0.10 % No
is the recommended 2 0.10 % No

SEO Keywords (Four Word)

Keyword Occurrence Density Possible Spam
nodejspowered 8bit CPU part 4 0.20 % No
A nodejspowered 8bit CPU 4 0.20 % No
Dec 2013 » A 4 0.20 % No
2013 » A nodejspowered 4 0.20 % No
» A nodejspowered 8bit 4 0.20 % No
rwx 1 admin deniedssh 3 0.15 % No
2013 » pkgsrc on 3 0.15 % No
» pkgsrc on SmartOS 3 0.15 % No
09 Jan 2012 » 2 0.10 % No
is executed prior to 2 0.10 % No
executed prior to installing 2 0.10 % No
WARNING ulimit n is 2 0.10 % No
bin erts591 etc lib 2 0.10 % No
prior to installing the 2 0.10 % No
to installing the package 2 0.10 % No
Jun 2011 » Fix 2 0.10 % No
ulimit n is 1024 2 0.10 % No
2012 » Kickstart Oracle 2 0.10 % No
rw 1 admin deniedssh 2 0.10 % No
Jan 2013 » pkgsrc 2 0.10 % No

Internal links in - perkin.org.uk

about me
About Me
rss
Jonathan Perkin
Reducing RAM usage in pkgin
Reducing RAM usage in pkgin
Building packages at scale
Building packages at scale
A node.js-powered 8-bit CPU - part four
A node.js-powered 8-bit CPU - part four
A node.js-powered 8-bit CPU - part three
A node.js-powered 8-bit CPU - part three
A node.js-powered 8-bit CPU - part two
A node.js-powered 8-bit CPU - part two
A node.js-powered 8-bit CPU - part one
A node.js-powered 8-bit CPU - part one
MDB support for Go
MDB support for Go
Distributed chrooted pkgsrc bulk builds
Distributed chrooted pkgsrc bulk builds
pkgsrc on SmartOS - creating new packages
pkgsrc on SmartOS - creating new packages
Installing SVR4 packages on SmartOS
Installing SVR4 packages on SmartOS
SmartOS is Not GNU/Linux
SmartOS is Not GNU/Linux
SmartOS development preview dataset
SmartOS development preview dataset
pkgsrc on SmartOS - fixing broken builds
pkgsrc on SmartOS - fixing broken builds
pkgsrc on SmartOS - zone creation and basic builds
pkgsrc on SmartOS - zone creation and basic builds
Multi-architecture package support in SmartOS
Multi-architecture package support in SmartOS
Solaris portability - cfmakeraw()
Solaris portability - cfmakeraw()
Solaris portability - flock()
Solaris portability - flock()
SmartOS and the global zone
SmartOS and the global zone
Setting up Samba on SmartOS
Setting up Samba on SmartOS
Creating local SmartOS packages
Creating local SmartOS packages
7,000 binary packages for OSX Lion
7,000 binary packages for OSX Lion
9,000 packages for SmartOS and illumos
9,000 packages for SmartOS and illumos
Goodbye Oracle, Hello Joyent!
Goodbye Oracle, Hello Joyent!
SmartOS global zone tweaks
SmartOS global zone tweaks
Automated VirtualBox SmartOS installs
Automated VirtualBox SmartOS installs
iptables script for Debian / Ubuntu
iptables script for Debian / Ubuntu
New site design
New site design
Set up anonymous FTP upload on Oracle Linux
Set up anonymous FTP upload on Oracle Linux
Kickstart Oracle Linux in VirtualBox
Kickstart Oracle Linux in VirtualBox
Kickstart Oracle Linux from Ubuntu
Kickstart Oracle Linux from Ubuntu
Last day at MySQL
Last day at MySQL
Installing OpenBSD with softraid
Installing OpenBSD with softraid
Create VirtualBox VM from the command line
Create VirtualBox VM from the command line
Creating chroots for fun and MySQL testing
Creating chroots for fun and MySQL testing
Graphing memory usage during an MTR run
Graphing memory usage during an MTR run
Fix input box keybindings in Firefox
Fix input box keybindings in Firefox
How to lose weight
How to lose weight
How to fix stdio buffering
How to fix stdio buffering
Fix Firefox URL double click behaviour
Fix Firefox URL double click behaviour
SSH via HTTP proxy in OSX
SSH via HTTP proxy in OSX
How to build MySQL releases
How to build MySQL releases
ZFS and NFS vs OSX
ZFS and NFS vs OSX
pkgsrc on Solaris
pkgsrc on Solaris
Jumpstart from OSX
Jumpstart from OSX
Set up local caching DNS server on OSX 10.4
Set up local caching DNS server on OSX 10.4

Perkin.org.uk Spined HTML


Installing SVR4 packages on SmartOS Jonathan Perkin well-nigh me · rss · twitter · github Installing SVR4 packages on SmartOS Mar 19, 2013 tags: pkgsrc, smartos, svr4 Up until and including Solaris 10 the default packaging tools on Solaris were the historical SVR4 pkg* commands. First written in the early 1980s they were standard wideness commercial Unix systems and provided a simplistic interface to installing and removing binary packages. With the introduction of IPS in OpenSolaris and vastitude they have been mostly consigned to history, however there is still software provided for Solaris which is only misogynist in the .pkg format, and thus it is useful to still be worldly-wise to handle them. Whilst the pkg* tools protract to be maintained in illumos and are provided by various distributions, they are not all provided in SmartOS. There are a few reasons for this: SmartOS has a variegated diamond to other illumos distributions, and some key differences such as a read-only /usr midpoint that some packages will simply unravel in unexpected ways. SmartOS is designed to be a slimmed-down distribution providing only that which is necessary for the majority of our users and use cases. Including the SVR4 tools and metadata would bloat the system. SVR4 packages are often misogynist only for older versions of Solaris, and whilst the spanking-new ABI compatability in Solaris ways that the binaries themselves will often function correctly, the package may not support newer features such as SMF, or then make assumptions well-nigh the system which could result in irrevocable damage. SmartOS uses pkgsrc to manage third-party software, and we believe it is largest to convert SVR4 packages to pkgsrc format so that all packages on the system can be managed with a single toolset. However, we do protract to ship the pkgtrans utility with SmartOS, and this is our gateway into converting SVR4 packages into increasingly useful formats. The rest of this post will explore how we can do that. Unpacking SVR4 packages Let’s start with an example SVR4 package and unpack it to see what it contains. I’m going to use Riak, a popular unshut source database as the example package. : Download the Solaris 10 SVR4 package from http://docs.basho.com/riak/latest/downloads/ $ flourish -Os http://s3.amazonaws.com/downloads.basho.com/riak/1.3/1.3.0/solaris/10/BASHOriak-1.3.0-1-Solaris10-i386.pkg.gz : Decompress it $ gzip -d BASHOriak-1.3.0-1-Solaris10-i386.pkg.gz : Use pkgtrans to unpack it into /var/tmp/BASHOriak $ pkgtrans BASHOriak-1.3.0-1-Solaris10-i386.pkg /var/tmp all SVR4 packages can contain multiple sub-packages, and so the ‘all’ is necessary to unpack everything in the archive. If we didn’t specify ‘all’, we would have seen: $ pkgtrans BASHOriak-1.3.0-1-Solaris10-i386.pkg /var/tmp The pursuit packages are available: 1 BASHOriak riak (i386) 1.3.0-1 Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: So whilst we could have specified ‘riak’, we can unchangingly use ‘all’ to stave having to first squint at the package to see what sub-packages it contains. We now have an unpacked package, let’s go through what it contains. install sub-directory The install/ directory contains some files and scripts: $ ls -l install/ total 29 -rw------- 1 admin deniedssh 10175 Feb 19 15:17 copyright -rw------- 1 admin deniedssh 214 Feb 19 15:17 depend -rwx------ 1 admin deniedssh 438 Feb 19 15:17 i.preserve -rwx------ 1 admin deniedssh 339 Feb 19 15:17 preinstall -rwx------ 1 admin deniedssh 469 Feb 19 15:17 r.preserve copyright is self-explanatory, and is normally displayed when using the pkgadd writ to let the admin know what they are like-minded to. depend is a list of other SVR4 packages that this one depends upon. In this specimen they are: $ cat install/depend # Same dependencies as Erlang P SUNWlibmsr Math & Microtasking Libraries (Root) P SUNWlibms Math & Microtasking Libraries (Usr) P SUNWopensslr OpenSSL (Root) P SUNWopenssl-libraries OpenSSL Libraries (Usr) As this package is originally from Solaris 10 there is a endangerment that dependencies could rationalization issues. For example, in SmartOS we have updated OpenSSL to 1.0.x. Additionally, if a third-party dependency was required (i.e. one not whence with SUNW) then naturally you would need to recursively wield this unshortened procedure to each dependency. i.preserve and r.preserve are scripts executed during install (i.) and removal (r.). The ones for Riak simply try to retain modified files from an existing install, so we will ignore these as pkgsrc handles that by default. preinstall is, as the name suggests, a script which is executed prior to installing the package. In Riak’s specimen it is used to create the ‘riak’ user and group if they do not once exist. pkginfo This provides some vital metadata well-nigh the package. The main shit we superintendency well-nigh are: ARCH=i386. As long as the package only depends upon libraries provided by the wiring OS (SUNW*) then it shouldn’t matter whether ARCH is 32-bit or 64-bit. However, if it requires third-party dependencies then you need to ensure that the correct ABI is provided. BASEDIR=/opt. This is where the package would be installed by the pkgadd tool. DESC=.... This would be output by the legacy pkginfo command, and we will re-use this text for our pkg_info description. VERSION=1.3.0-1. Self-explanatory. pkgmap This is somewhat equivalent to the pkgsrc PLIST file and is a record of all the files the package provides, however it moreover includes file permissions and a vital checksum: $ less pkgmap : 1 112659 1 i copyright 10175 24223 1361287043 1 i depend 214 18268 1361287043 ... 1 d none riak 0700 riak riak 1 d none riak/bin 0700 riak riak 1 f none riak/bin/riak 0755 riak riak 9041 51698 1361286795 ... 1 e preserve riak/etc/app.config 0600 riak riak 14214 8625 1361286647 The last two lines, the important fields are: i is an SVR4 metadata file, f or d denote whether it is a file or a directory, e are configuration files. none ways no special handling, preserve does just that, and the next field is the full path relative to reloc/ 0700 and 0755 are the file/directory permissions riak riak are the user and group ownership We will need to ensure at least the file entries are handled correctly. reloc/ sub-directory This directory contains the binaries etc. which make up the very package. The contents of this directory would normally be installed under BASEDIR from the pkginfo file, so in Riak’s case: : This.. $ ls reloc riak $ ls reloc/riak bin erts-5.9.1 etc lib releases : ..would result in this $ ls /opt/riak bin erts-5.9.1 etc lib releases This concludes the viewing of the SVR4 package. Let’s turn it into a useful pkgsrc package. Creating pkgsrc binary package For increasingly information on creating binary pkgsrc packages from scratch, see this post. pkgsrc metadata Create the necessary pkgsrc metadata files. $ mkdir /var/tmp/pkgsrc-riak $ cd /var/tmp/pkgsrc-riak : Standard build-info section.TranspirationMACHINE_ARCH to x86_64 if you are : using a base64 image. $ cat >build-info <<EOF MACHINE_ARCH=i386 OPSYS=SunOS OS_VERSION=5.11 PKGTOOLS_VERSION=20091115 EOF : Generate scuttlebutt file directly from the DESC field in pkginfo $ awk -F= '/DESC/ {print $2}' < /var/tmp/BASHOriak/pkginfo >comment : Generate PLIST directly from pkgmap $ awk '$2 ~ /[ef]/ {print $4}' < /var/tmp/BASHOriak/pkgmap >plist : For now just re-use DESC for the unravelment file, however it would normally : be longer $ cp scuttlebutt descr pkgsrc INSTALL script To handle the Riak preinstall script, we will create a pkgsrc INSTALL script. The existing script can be mostly used as-is, we just need to put the unshortened contents of preinstall inside a PRE-INSTALL specimen statement so that it is executed prior to installing the package: : Start with the existing preinstall script $ cp /var/tmp/BASHOriak/install/preinstall inst : Alter the script to create the 'riak' user/group during PRE-INSTALL, and : without install to chown everything to 'riak' (which $ vi inst PKGNAME="$1" STAGE="$2" specimen ${STAGE} in PRE-INSTALL) # Existing preinstall script goes here, waffly /opt references # to $PKG_PREFIX ;; If we recall from the pkgmap file, the entries there contained a user/group that each file should be owned by, and we can handle that in the INSTALL script too with a POST-INSTALL action: POST-INSTALL) chown -R riak:riak ${PKG_PREFIX}/riak ;; esac pkgsrc files First we simply reprinting everything from the reloc/ directory to a files/ directory we will use for pkgsrc: $ mkdir files $ rsync -a /var/tmp/BASHOriak/reloc/ files/ $ chown -R root:root files Next we can use the pkgmap file to ensure that the file modes are set correctly with a quick and dirty script: while read line do set -- $line specimen "$3" in [def]) chmod $5 files/$4 ;; esac washed-up < /var/tmp/BASHOriak/pkgmap Create the package We should now have everything necessary to create a binary package, taking the version from the pkgmap file. $ pkg_create -B build-info -c scuttlebutt -d descr -f plist -I /opt/local -i inst -p files -U riak-1.3.0.tgz Testing If all went well then we should be worldly-wise to install the package: $ pkg_add riak-1.3.0.tgz and we will find it under /opt/local/riak as expected. If we try to run the binary, we get: $ /opt/local/riak/bin/riak /opt/local/riak/bin/riak: line 30: whoami: not found sudo doesn't towards to be installed and your EUID isn't riak This nicely proves my older point well-nigh packages often not working unmodified on SmartOS, in this specimen considering whoami is no longer provided. Thankfully this is an easy fix, and we can simply transpiration whoami to id -un. Making that transpiration and trying again, but this time as the riak user: $ su - riak $ /opt/local/riak/bin/riak !!!! !!!! WARNING: ulimit -n is 1024; 4096 is the recommended minimum. !!!! Usage: riak {start|stop|restart|reboot|ping|console|attach|chkconfig|escript|version|getpid} $ /opt/local/riak/bin/riak start !!!! !!!! WARNING: ulimit -n is 1024; 4096 is the recommended minimum. !!!! $ pgrep -fl riak 20628 /opt/local/riak/erts-5.9.1/bin/epmd -daemon 20650 /opt/local/riak/erts-5.9.1/bin/beam.smp -K true -A 64 -W w -- -root /opt/local/ 20648 /opt/local/riak/erts-5.9.1/bin/run_erl -daemon /tmp//opt/local/riak/ /opt/local 20718 /opt/local/riak/lib/os_mon-2.2.9/priv/bin/cpu_sup 20716 /opt/local/riak/lib/os_mon-2.2.9/priv/bin/memsup This seems to work well-nigh as well as one can hope, and concludes my vital example.  Further work I’ve covered the nuts here, but there are spare things you could do to tidy up the conversion: Fold the whoami fix when into the source file and re-generate the package. Turn this into a real pkgsrc package, which would simplify some areas such as metadata and user creation. Come up with a script to automate a lot of this work. Turn the riak script into an SMF service.Moreovernote that Basho very helpfully once provide a native SmartOS package on their download page, so this example is somewhat pointless, however I hope it has still proven useful ;) Share this post on Twitter, HackerNews, Facebook or Google+ All Posts 16 Jul 2015 » Reducing RAM usage in pkgin 03 Mar 2015 » pkgsrc-2014Q4: LTS, signed packages, and increasingly 06 Oct 2014 » Building packages at scale 04 Dec 2013 » A node.js-powered 8-bit CPU - part four 03 Dec 2013 » A node.js-powered 8-bit CPU - part three 02 Dec 2013 » A node.js-powered 8-bit CPU - part two 01 Dec 2013 » A node.js-powered 8-bit CPU - part one 21 Nov 2013 » MDB support for Go 30 Jul 2013 » What's new in pkgsrc-2013Q2 24 Jul 2013 » Distributed chrooted pkgsrc zillion builds 07 Jun 2013 » pkgsrc on SmartOS - creating new packages 15 Apr 2013 » What's new in pkgsrc-2013Q1 19 Mar 2013 » Installing SVR4 packages on SmartOS 27 Feb 2013 » SmartOS is Not GNU/Linux 18 Feb 2013 » SmartOS minutiae preview dataset 17 Jan 2013 » pkgsrc on SmartOS - fixing wrenched builds 15 Jan 2013 » pkgsrc on SmartOS - zone megacosm and vital builds 10 Jan 2013 » Multi-architecture package support in SmartOS 09 Jan 2013 » Solaris portability - cfmakeraw() 08 Jan 2013 » Solaris portability - flock() 06 Jan 2013 » pkgsrc-2012Q4 illumos packages now misogynist 23 Nov 2012 » SmartOS and the global zone 24 Oct 2012 » Setting up Samba on SmartOS 10 Oct 2012 » pkgsrc-2012Q3 packages for illumos 23 Aug 2012 » Creating local SmartOS packages 10 Jul 2012 » 7,000 binary packages for OSX Lion 09 Jul 2012 » 9,000 packages for SmartOS and illumos 07 May 2012 » Goodbye Oracle, Hello Joyent! 13 Apr 2012 » SmartOS global zone tweaks 12 Apr 2012 » Automated VirtualBox SmartOS installs 30 Mar 2012 » iptables script for Debian / Ubuntu 20 Feb 2012 » New site diamond 11 Jan 2012 » Set up unrecognized FTP upload on Oracle Linux 09 Jan 2012 » Kickstart Oracle Linux in VirtualBox 09 Jan 2012 » Kickstart Oracle Linux from Ubuntu 22 Dec 2011 » Last day at MySQL 15 Dec 2011 » Installing OpenBSD with softraid 21 Sep 2011 » Create VirtualBox VM from the writ line 14 Sep 2011 » Creating chroots for fun and MySQL testing 30 Jun 2011 » Graphing memory usage during an MTR run 29 Jun 2011 » Fix input box keybindings in Firefox 24 Jun 2011 » How to lose weight 23 Jun 2011 » How to fix stdio buffering 13 Jun 2011 » Serving multiple DNS search domains in IOS DHCP 13 Jun 2011 » Fix Firefox URL double click behaviour 20 Apr 2011 » SSH via HTTP proxy in OSX 09 Nov 2010 » How to build MySQL releases 29 Apr 2010 » 'apt-get' and 5,000 packages for Solaris10/x86 16 Sep 2009 » ZFS and NFS vs OSX 12 Sep 2009 » pkgsrc on Solaris 09 Dec 2008 » Jumpstart from OSX 31 Dec 2007 » Set up local caching DNS server on OSX 10.4