@@ -4,19 +4,19 @@ The default installation uses sqlite3 for the django database. To configure
44mysql or postgresql instead, see the database configuration section.
55
66
7- ## Supported Install Options
8- - [ Ubuntu 22 .04] ( #ubuntu-2204-jammy )
7+ ## Supported Server Installation Options
8+ - [ Ubuntu 24 .04] ( #ubuntu-2404-noble )
99 - [ Debian 12] ( #debian-12-bookworm )
10- - [ CentOS 9 ] ( #centos-9 )
10+ - [ Rocky 10 ] ( #rocky-10 )
1111 - [ virtualenv + pip] ( #virtualenv--pip )
1212 - [ Source] ( #source )
1313
1414
15- ### Ubuntu 22 .04 (jammy )
15+ ### Ubuntu 24 .04 (noble )
1616
1717``` shell
1818curl -sS https://repo.openbytes.ie/openbytes.gpg > /usr/share/keyrings/openbytes.gpg
19- echo " deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/ubuntu jammy main" > /etc/apt/sources.list.d/patchman.list
19+ echo " deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/ubuntu noble main" > /etc/apt/sources.list.d/patchman.list
2020apt update
2121apt -y install python3-patchman patchman-client
2222patchman-manage createsuperuser
@@ -26,22 +26,23 @@ patchman-manage createsuperuser
2626
2727``` shell
2828curl -sS https://repo.openbytes.ie/openbytes.gpg > /usr/share/keyrings/openbytes.gpg
29- echo " deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/debian bookworm main" > /etc/apt/sources.list.d/patchman.list
29+ echo " deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/debian bookworm-backports main" > /etc/apt/sources.list.d/patchman.list
30+ echo " deb http://deb.debian.org/debian bookworm-backports main" > /etc/apt/sources.list.d/backports.list
3031apt update
31- apt -y install python3-patchman patchman-client
32+ apt -y install -t bookworm-backports python3-patchman patchman-client
3233patchman-manage createsuperuser
3334```
3435
35- ### CentOS 9
36+ ### Rocky 10
3637
37- This also applies to Rocky/ Alma/ RHEL
38+ This also applies to Alma, RHEL, etc.
3839
3940``` shell
4041curl -sS https://repo.openbytes.ie/openbytes.gpg > /etc/pki/rpm-gpg/RPM-GPG-KEY-openbytes
4142cat << EOF >> /etc/yum.repos.d/openbytes.repo
4243[openbytes]
4344name=openbytes
44- baseurl=https://repo.openbytes.ie/patchman/el9
45+ baseurl=https://repo.openbytes.ie/patchman/el10
4546enabled=1
4647gpgcheck=1
4748gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-openbytes
@@ -60,7 +61,7 @@ TBD - not working yet
6061
6162``` shell
6263apt -y install gcc libxml2-dev libxslt1-dev virtualenv python3-dev zlib1g-dev # (debian/ubuntu)
63- dnf -y install gcc libxml2-devel libxslt-devel python3-virtualenv # (centos/ rocky/alma)
64+ dnf -y install gcc libxml2-devel libxslt-devel python3-virtualenv # (rocky/alma/redhat )
6465mkdir /srv/patchman
6566cd /srv/patchman
6667python3 -m venv .venv
@@ -74,7 +75,7 @@ gunicorn patchman.wsgi -b 0.0.0.0:80
7475
7576### Source
7677
77- #### Ubuntu 22 .04 (jammy )
78+ #### Ubuntu 24 .04 (noble )
7879
79801 . Install dependencies
8081
@@ -107,9 +108,9 @@ cp /srv/patchman/etc/patchman/local_settings.py /etc/patchman/
107108
108109# Configuration
109110
110- ## Patchman Settings
111+ ## Patchman Server Settings
111112
112- Modify ` /etc/patchman/local_settings.py ` to configure patchman.
113+ Modify ` /etc/patchman/local_settings.py ` to configure the patchman server .
113114
114115If installing from source or using virtualenv, the following settings should
115116be configured:
@@ -119,28 +120,32 @@ be configured:
119120 * STATIC_ROOT - should point to ` /srv/patchman/run/static ` if installing from
120121 source
121122
122- ## Patchman-client Settings
123+ The default settings for errata downloading may include operating systems that
124+ are not relevant to a given deployment. If this is the case, modify the
125+ ` ERRATA_OS_UPDATES ` setting in ` /etc/patchman/local_settings.py ` . Further
126+ distribution-specific settings are also available to only download errata
127+ for specific versions/codenames.
128+
129+ ## Patchman Client Settings
123130
124- The client comes with a default configuration. This configuration will attempt to upload the reports to a server at * patchman.example.com* . This configuration needs to be updated to connect to your own patchman installation.
131+ The client comes with a default configuration that will attempt to upload the
132+ reports to a server at * patchman.example.com* . This configuration needs to be
133+ updated to connect to the correct patchman server.
125134
126- In ` /etc/patchman/patchman-client.conf ` , look for the following line(s) :
135+ Change the following lines in ` /etc/patchman/patchman-client.conf ` :
127136
128137```
129138# Patchman server
130- server=https://patchman.example.com
139+ server=https://patchman.example.com
131140
132141# Options to curl
133142curl_options="--insecure --connect-timeout 60 --max-time 300"
134143
135- ...
136144```
137- * * server* needs to point the URL where your patchman server
138- is running
139- * * --insecure* in the curl_options tells the client to ignore certificates, if you set them up correctly and are using patchman with "https:/...", you could remove this flag to increase security
140-
141-
142-
143-
145+ * * server* needs to point the URL where the local patchman server is running
146+ * * --insecure* in the curl options tells the client to ignore certificates.
147+ If the patchman server is set up correctly with certificates this flag can
148+ be removed to increase security.
144149
145150## Configure Database
146151
@@ -151,10 +156,13 @@ production deployments. MySQL or PostgreSQL are better choices.
151156
152157To configure the sqlite database backend:
153158
154- 1 . Create the database directory specified in the settings file:
159+ 1 . Create the database directory specified in the settings file, touch the
160+ database file and set the journal mode to WAL:
155161
156162``` shell
157163mkdir -p /var/lib/patchman/db
164+ touch /var/lib/patchman/db/patchman.db
165+ sqlite3 /var/lib/patchman/db/patchman.db ' PRAGMA journal_mode=WAL;'
158166```
159167
1601682 . Modify ` /etc/patchman/local_settings.py ` as follows:
@@ -163,7 +171,7 @@ mkdir -p /var/lib/patchman/db
163171DATABASES = {
164172 'default': {
165173 'ENGINE': 'django.db.backends.sqlite3',
166- 'NAME': '/var/lib/patchman/db/patchman.db'
174+ 'NAME': '/var/lib/patchman/db/patchman.db',
167175 }
168176}
169177```
@@ -199,16 +207,16 @@ Query OK, 0 rows affected (0.00 sec)
199207
200208```
201209DATABASES = {
202- 'default': {
203- 'ENGINE': 'django.db.backends.mysql',
204- 'NAME': 'patchman',
205- 'USER': 'patchman',
206- 'PASSWORD': 'changeme',
207- 'HOST': '',
208- 'PORT': '',
209- 'STORAGE_ENGINE': 'INNODB',
210- 'CHARSET' : 'utf8'
211- }
210+ 'default': {
211+ 'ENGINE': 'django.db.backends.mysql',
212+ 'NAME': 'patchman',
213+ 'USER': 'patchman',
214+ 'PASSWORD': 'changeme',
215+ 'HOST': '',
216+ 'PORT': '',
217+ 'STORAGE_ENGINE': 'INNODB',
218+ 'CHARSET': 'utf8',
219+ }
212220}
213221```
214222
@@ -250,15 +258,15 @@ GRANT
250258
251259```
252260DATABASES = {
253- 'default': {
254- 'ENGINE': 'django.db.backends.postgresql_psycopg2',
255- 'NAME': 'patchman',
256- 'USER': 'patchman',
257- 'PASSWORD': 'changeme',
258- 'HOST': '127.0.0.1',
259- 'PORT': '',
260- 'CHARSET' : 'utf8'
261- }
261+ 'default': {
262+ 'ENGINE': 'django.db.backends.postgresql_psycopg2',
263+ 'NAME': 'patchman',
264+ 'USER': 'patchman',
265+ 'PASSWORD': 'changeme',
266+ 'HOST': '127.0.0.1',
267+ 'PORT': '',
268+ 'CHARSET': 'utf8',
269+ }
262270}
263271```
264272
@@ -273,8 +281,7 @@ After configuring a database backend, the django database should be synced:
273281collect static files:
274282
275283``` shell
276- patchman-manage makemigrations
277- patchman-manage migrate --run-syncdb --fake-initial
284+ patchman-manage migrate --run-syncdb
278285patchman-manage createsuperuser
279286patchman-manage collectstatic
280287```
@@ -285,6 +292,27 @@ N.B. To run patchman-manage when installing from source, run `./manage.py`
2852922 . Restart the web server after syncing the database.
286293
287294
295+ ### Migrate from sqlite to another database backend
296+
297+ The prebuilt package installations use sqlite as the default database backend,
298+ but this is not recommended in production. To migrate from sqlite to another
299+ database backend, use the following procedure:
300+
301+ 1 . Dump the sqlite database to a json file
302+
303+ ``` shell
304+ patchman-manage dumpdata --exclude packages.Packagestring -e contenttypes -e auth.Permission --natural-foreign --natural-primary --indent 4 > patchman-db.json
305+ ```
306+
307+ 2 . Create the new database and add the new database settings to ` /etc/patchman/local_settings.py `
308+
309+ 3 . Sync the new database and load the existing data:
310+
311+ ```
312+ patchman-manage migrate --run-syncdb
313+ patchman-manage loaddata patchman-db.json
314+ ```
315+
288316## Configure Web Server
289317
290318### Apache
@@ -301,7 +329,7 @@ a2enconf patchman
301329
302330``` shell
303331vi /etc/apache2/conf-available/patchman.conf
304- service apache2 reload
332+ systemctl reload apache2
305333```
306334
3073353 . If installing from source, allow apache access to the settings and to the sqlite db:
@@ -321,9 +349,10 @@ The django interface should be available at http://127.0.0.1/patchman/
321349
322350#### Daily cronjob on patchman server
323351
324- A daily cronjob on the patchman server should be run to process reports,
325- perform database maintenance, check for upstream updates, and find updates for
326- clients.
352+ A daily cronjob on the patchman server can be run to process reports, perform
353+ database maintenance, check for upstream updates, and find updates for clients.
354+ Alternatively, run celery as outlined below for finer granularity over the
355+ timing of these tasks and for increased concurrency.
327356
328357```
329358patchman -a
@@ -337,16 +366,17 @@ patchman-client
337366
338367### Celery
339368
340- Install Celery for realtime processing of reports from clients:
369+ Install Celery for realtime processing of reports from clients and for periodic
370+ maintenance tasks. The celery configuation file is in ` /etc/patchman/celery.conf `
341371
342372#### Ubuntu / Debian
343373
344374``` shell
345375apt -y install python3-celery redis python3-redis python-celery-common
346- C_FORCE_ROOT=1 celery -b redis://127.0.0.1:6379/0 -A patchman worker -l INFO -E
376+ /usr/bin/ celery --broker redis://127.0.0.1:6379/0 --app patchman worker --loglevel info --beat --scheduler django_celery_beat.schedulers:DatabaseScheduler --task-events --pool threads
347377```
348378
349- #### CentOS / Rocky / Alma
379+ #### Rocky / Alma / RHEL
350380
351381Currently waiting on https://bugzilla.redhat.com/show_bug.cgi?id=2032543
352382
@@ -355,35 +385,69 @@ dnf -y install python3-celery redis python3-redis
355385systemctl restart redis
356386semanage port -a -t http_port_t -p tcp 6379
357387setsebool -P httpd_can_network_connect 1
358- C_FORCE_ROOT=1 celery -b redis://127.0.0.1:6379/0 -A patchman worker -l INFO -E
388+ /usr/bin/ celery --broker redis://127.0.0.1:6379/0 --app patchman worker --loglevel info --beat --scheduler django_celery_beat.schedulers:DatabaseScheduler --task-events --pool threads
359389```
360390
361- Add the last command to an initscript (e.g. /etc/rc.local) to make celery
362- persistent over reboot.
391+ #### Persistence
392+
393+ There is a systemd unit file for celery to make the service persistent over reboot:
363394
364- Enable celery by adding ` USE_ASYNC_PROCESSING = True ` to ` / etc/patchman/local_settings.py `
395+ ` etc/systemd/system/patchman-celery.service `
365396
366- ### Memcached
397+ If installing from prebuilt packages, this should be enabled by default.
367398
368- Memcached can optionally be run to reduce the load on the server.
399+
400+ ### Caching
401+
402+ Memcached or Redis can optionally be run to reduce the load on the server.
403+ Note that caching may result in the web interface showing results that are
404+ out of date with the database, so this is disabled by default.
405+
406+
407+ #### Redis
408+
409+ Install Redis:
410+
411+ ``` shell
412+ apt -y install redis python3-redis # (debian/ubuntu)
413+ dnf -y install redis python3-redis # (rocky/alma/redhat)
414+ systemctl restart redis/redis-server
415+ ```
416+
417+ and add the following to ` /etc/patchman/local_settings.py `
418+
419+ ```
420+ CACHES = {
421+ 'default': {
422+ 'BACKEND': 'django.core.cache.backends.redis.RedisCache',
423+ 'LOCATION': 'redis://127.0.0.1:6379',
424+ 'TIMEOUT': 30,
425+ }
426+ }
427+ ```
428+
429+ #### Memcacached
430+
431+ Install Memcached
369432
370433``` shell
371434apt -y install memcached python3-pymemcache # (debian/ubuntu)
372- dnf -y install memcached python3-pymemcache # (centos/ rocky/alma)
435+ dnf -y install memcached python3-pymemcache # (rocky/alma/redhat )
373436systemctl restart memcached
374437```
375438
376439and add the following to ` /etc/patchman/local_settings.py `
377440
378441```
379442CACHES = {
380- 'default': {
381- 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
382- 'LOCATION': '127.0.0.1:11211',
443+ 'default': {
444+ 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
445+ 'LOCATION': '127.0.0.1:11211',
446+ 'TIMEOUT': 30,
383447 'OPTIONS': {
384448 'ignore_exc': True,
385449 },
386- }
450+ }
387451}
388452```
389453
0 commit comments