jimhall.sh | grep "interesting things"

At least to me. Mostly tech / computing

Archive

About

Categories

Tags

Subscribe

6 July 2022

Configure Django 3.2 on Solaris

by Jim Hall

Trying to leverage what is bundled in Solaris 11.4, so I tried to configure the latest version of Django. Simultaneously picked up some tricks on how to manage packages on Solaris.

The Short Version (TL;DR: Configure the latest version of Django)

Assuming you have a full install of Solaris 11.4 (SRU43 was the SRU I first tried this, followed by an upgrade to SRU46), it seems to boil down to the following (Assumes you have the “System Administrator” profile assigned):

$ getent user_attr jhall
jhall::::profiles=System Administrator;roles=root;audit_flags=cusa\:no
$ pfexec pkg install django
$ pfexec pkg install python-39
$ pfexec pkg set-mediator -v -V 3.9 --backup-be-name 11.4.43.113.3-switch-python3.9 python
$ mkdir try-django
$ cd try-django/
$ python -m venv --system-site-packages .
$ source bin/activate
$ python
Python 3.9.4 (default, Feb 10 2022, 06:27:49)
[GCC 11.2.0] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(3, 2, 11, 'final', 0)

And there you have it. Pretty darn easy/simple to get up and running and manage your python environment with Solaris.

The Long Version (Where I learn some things)

The “long version” has steps that led me to discover what I believe to be the “short version” provided above. I would position this listing as “good faith notes” and there may be more effective, optimized and/or accurate ways to arrive at the desired destination of running the latest version of Django from the Solaris 11.4 repository.

Manage packages on the system as a non-root user and install the latest Django

Solaris at this point is really full featured in being able to control what a non-root user can do on the system. At install it asks for a non-root user and adds the “System Administrator” profile to the account. Upon login you can get information about the profile and note that is superset or grouping of more granular profiles:

$ profiles -p "System Administrator" info
	name=System Administrator
	desc=profiles=Printer Management
	profiles=Fault Management,Install Service Management,Compliance Reporter,Unified Archive Administration,National Languages Support Management,Administrative Command History,Audit Review,Extended Accounting Flow Management,Extended Accounting Net Management,Extended Accounting Process Management,Extended Accounting Task Management,Cron Management,Device Management,File System Management,Log Management,Mail Management,Maintenance and Repair,Media Catalog,Name Service Management,Network Management,Project Management,RAD Management,Service Operator,Shadow Migration Monitor,Stat Store Management,Software Installation,System Configuration,User Management,ZFS Cloud Management,ZFS Storage Management

If the account being used was not added at install time, you could simply add the “Software Installation” profile to do the work:

$ profiles -p "Software Installation" info
	name=Software Installation
	desc=Add application software to the system
	profiles=National Languages Support Management,ZFS File System Management
	cmd=/usr/sbin/beadm
	cmd=/usr/bin/ln
	cmd=/usr/bin/pkginfo
	cmd=/usr/bin/pkgmk
	cmd=/usr/bin/pkgparam
	cmd=/usr/bin/pkgproto
	cmd=/usr/bin/pkgtrans
	cmd=/usr/ccs/bin/make
	cmd=/usr/sbin/install
	cmd=/usr/sbin/pkgadd
	cmd=/usr/sbin/pkgask
	cmd=/usr/sbin/pkgchk
	cmd=/usr/sbin/pkgrm
	cmd=/usr/lib/rad/module/mod_ips.so.1
	cmd=/usr/lib/rad/module/mod_bemgr.so.1
	cmd=/usr/sbin/spliceadm
	cmd=/usr/bin/pkg

Trying to figure out what is on the system currently

Running pkg list | grep django returned nothing, so it looked like my install did not include the software. I performed the following steps to arrive at the latest version provided by the Solaris 11.4 repo:

Creating my first Django application environment

Conclusion and what happended during the next SRU update?

Upgrading from SRU43 to SRU46 resulted in a slightly newer version of both python and Django with no issues. Go forward this seems to be a very easy and effective way to manage your python application environment.

$ python
Python 3.9.9 (main, Mar 30 2022, 14:27:52)

>>> import django
>>> django.VERSION
(3, 2, 13, 'final', 0)
categories: computing
tags: solaris - django - python