@@ -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
@@ -27,21 +27,23 @@ patchman-manage createsuperuser
2727``` shell
2828curl -sS https://repo.openbytes.ie/openbytes.gpg > /usr/share/keyrings/openbytes.gpg
2929echo " deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/debian bookworm 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
32+ apt -y install -t bookworm-backports python3-django
3133apt -y install python3-patchman patchman-client
3234patchman-manage createsuperuser
3335```
3436
35- ### CentOS 9
37+ ### Rocky 10
3638
37- This also applies to Rocky/ Alma/ RHEL
39+ This also applies to Alma, RHEL, etc.
3840
3941``` shell
4042curl -sS https://repo.openbytes.ie/openbytes.gpg > /etc/pki/rpm-gpg/RPM-GPG-KEY-openbytes
4143cat << EOF >> /etc/yum.repos.d/openbytes.repo
4244[openbytes]
4345name=openbytes
44- baseurl=https://repo.openbytes.ie/patchman/el9
46+ baseurl=https://repo.openbytes.ie/patchman/el10
4547enabled=1
4648gpgcheck=1
4749gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-openbytes
@@ -60,7 +62,7 @@ TBD - not working yet
6062
6163``` shell
6264apt -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)
65+ dnf -y install gcc libxml2-devel libxslt-devel python3-virtualenv # (rocky/alma/redhat )
6466mkdir /srv/patchman
6567cd /srv/patchman
6668python3 -m venv .venv
@@ -74,7 +76,7 @@ gunicorn patchman.wsgi -b 0.0.0.0:80
7476
7577### Source
7678
77- #### Ubuntu 22 .04 (jammy )
79+ #### Ubuntu 24 .04 (noble )
7880
79811 . Install dependencies
8082
@@ -107,9 +109,9 @@ cp /srv/patchman/etc/patchman/local_settings.py /etc/patchman/
107109
108110# Configuration
109111
110- ## Patchman Settings
112+ ## Patchman Server Settings
111113
112- Modify ` /etc/patchman/local_settings.py ` to configure patchman.
114+ Modify ` /etc/patchman/local_settings.py ` to configure the patchman server .
113115
114116If installing from source or using virtualenv, the following settings should
115117be configured:
@@ -119,28 +121,32 @@ be configured:
119121 * STATIC_ROOT - should point to ` /srv/patchman/run/static ` if installing from
120122 source
121123
122- ## Patchman-client Settings
124+ The default settings for errata downloading may include operating systems that
125+ are not relevant to a given deployment. If this is the case, modify the
126+ ` ERRATA_OS_UPDATES ` setting in ` /etc/patchman/local_settings.py ` . Further
127+ distribution-specific settings are also available to only download errata
128+ for specific versions/codenames.
123129
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.
130+ ## Patchman Client Settings
125131
126- In ` /etc/patchman/patchman-client.conf ` , look for the following line(s):
132+ The client comes with a default configuration that will attempt to upload the
133+ reports to a server at * patchman.example.com* . This configuration needs to be
134+ updated to connect to the correct patchman server.
135+
136+ Change the following lines in ` /etc/patchman/patchman-client.conf ` :
127137
128138```
129139# Patchman server
130- server=https://patchman.example.com
140+ server=https://patchman.example.com
131141
132142# Options to curl
133143curl_options="--insecure --connect-timeout 60 --max-time 300"
134144
135- ...
136145```
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-
146+ * * server* needs to point the URL where the local patchman server is running
147+ * * --insecure* in the curl options tells the client to ignore certificates.
148+ If the patchman server is set up correctly with certificates this flag can
149+ be removed to increase security.
144150
145151## Configure Database
146152
@@ -163,7 +169,7 @@ mkdir -p /var/lib/patchman/db
163169DATABASES = {
164170 'default': {
165171 'ENGINE': 'django.db.backends.sqlite3',
166- 'NAME': '/var/lib/patchman/db/patchman.db'
172+ 'NAME': '/var/lib/patchman/db/patchman.db',
167173 }
168174}
169175```
@@ -199,16 +205,16 @@ Query OK, 0 rows affected (0.00 sec)
199205
200206```
201207DATABASES = {
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- }
208+ 'default': {
209+ 'ENGINE': 'django.db.backends.mysql',
210+ 'NAME': 'patchman',
211+ 'USER': 'patchman',
212+ 'PASSWORD': 'changeme',
213+ 'HOST': '',
214+ 'PORT': '',
215+ 'STORAGE_ENGINE': 'INNODB',
216+ 'CHARSET': 'utf8',
217+ }
212218}
213219```
214220
@@ -250,15 +256,15 @@ GRANT
250256
251257```
252258DATABASES = {
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- }
259+ 'default': {
260+ 'ENGINE': 'django.db.backends.postgresql_psycopg2',
261+ 'NAME': 'patchman',
262+ 'USER': 'patchman',
263+ 'PASSWORD': 'changeme',
264+ 'HOST': '127.0.0.1',
265+ 'PORT': '',
266+ 'CHARSET': 'utf8',
267+ }
262268}
263269```
264270
@@ -273,8 +279,7 @@ After configuring a database backend, the django database should be synced:
273279collect static files:
274280
275281``` shell
276- patchman-manage makemigrations
277- patchman-manage migrate --run-syncdb --fake-initial
282+ patchman-manage migrate --run-syncdb
278283patchman-manage createsuperuser
279284patchman-manage collectstatic
280285```
@@ -285,6 +290,27 @@ N.B. To run patchman-manage when installing from source, run `./manage.py`
2852902 . Restart the web server after syncing the database.
286291
287292
293+ ### Migrate from sqlite to another database backend
294+
295+ The prebuilt package installations use sqlite as the default database backend,
296+ but this is not recommended in production. To migrate from sqlite to another
297+ database backend, use the following procedure:
298+
299+ 1 . Dump the sqlite database to a json file
300+
301+ ``` shell
302+ patchman-manage dumpdata --exclude packages.Packagestring -e contenttypes -e auth.Permission --natural-foreign --natural-primary --indent 4 > patchman-db.json
303+ ```
304+
305+ 2 . Create the new database and add the new database settings to ` /etc/patchman/local_settings.py `
306+
307+ 3 . Sync the new database and load the existing data:
308+
309+ ```
310+ patchman-manage migrate --run-syncdb
311+ patchman-manage loaddata patchman-db.json
312+ ```
313+
288314## Configure Web Server
289315
290316### Apache
@@ -301,7 +327,7 @@ a2enconf patchman
301327
302328``` shell
303329vi /etc/apache2/conf-available/patchman.conf
304- service apache2 reload
330+ systemctl reload apache2
305331```
306332
3073333 . If installing from source, allow apache access to the settings and to the sqlite db:
@@ -321,9 +347,10 @@ The django interface should be available at http://127.0.0.1/patchman/
321347
322348#### Daily cronjob on patchman server
323349
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.
350+ A daily cronjob on the patchman server can be run to process reports, perform
351+ database maintenance, check for upstream updates, and find updates for clients.
352+ Alternatively, run celery as outlined below for finer granularity over the
353+ timing of these tasks and for increased concurrency.
327354
328355```
329356patchman -a
@@ -337,16 +364,17 @@ patchman-client
337364
338365### Celery
339366
340- Install Celery for realtime processing of reports from clients:
367+ Install Celery for realtime processing of reports from clients and for periodic
368+ maintenance tasks. The celery configuation file is in ` /etc/patchman/celery.conf `
341369
342370#### Ubuntu / Debian
343371
344372``` shell
345373apt -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
374+ /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
347375```
348376
349- #### CentOS / Rocky / Alma
377+ #### Rocky / Alma / RHEL
350378
351379Currently waiting on https://bugzilla.redhat.com/show_bug.cgi?id=2032543
352380
@@ -355,35 +383,69 @@ dnf -y install python3-celery redis python3-redis
355383systemctl restart redis
356384semanage port -a -t http_port_t -p tcp 6379
357385setsebool -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
386+ /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
387+ ```
388+
389+ #### Persistence
390+
391+ There is a systemd unit file for celery to make the service persistent over reboot:
392+
393+ ` etc/systemd/system/patchman-celery.service `
394+
395+ If installing from prebuilt packages, this should be enabled by default.
396+
397+
398+ ### Caching
399+
400+ Memcached or Redis can optionally be run to reduce the load on the server.
401+ Note that caching may result in the web interface showing results that are
402+ out of date with the database, so this is disabled by default.
403+
404+
405+ #### Redis
406+
407+ Install Redis:
408+
409+ ``` shell
410+ apt -y install redis python3-redis # (debian/ubuntu)
411+ dnf -y install redis python3-redis # (rocky/alma/redhat)
412+ systemctl restart redis/redis-server
359413```
360414
361- Add the last command to an initscript (e.g. /etc/rc.local) to make celery
362- persistent over reboot.
415+ and add the following to ` /etc/patchman/local_settings.py `
363416
364- Enable celery by adding ` USE_ASYNC_PROCESSING = True ` to ` /etc/patchman/local_settings.py `
417+ ```
418+ CACHES = {
419+ 'default': {
420+ 'BACKEND': 'django.core.cache.backends.redis.RedisCache',
421+ 'LOCATION': 'redis://127.0.0.1:6379',
422+ 'TIMEOUT': 30,
423+ }
424+ }
425+ ```
365426
366- ### Memcached
427+ #### Memcacached
367428
368- Memcached can optionally be run to reduce the load on the server.
429+ Install Memcached
369430
370431``` shell
371432apt -y install memcached python3-pymemcache # (debian/ubuntu)
372- dnf -y install memcached python3-pymemcache # (centos/ rocky/alma)
433+ dnf -y install memcached python3-pymemcache # (rocky/alma/redhat )
373434systemctl restart memcached
374435```
375436
376437and add the following to ` /etc/patchman/local_settings.py `
377438
378439```
379440CACHES = {
380- 'default': {
381- 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
382- 'LOCATION': '127.0.0.1:11211',
441+ 'default': {
442+ 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
443+ 'LOCATION': '127.0.0.1:11211',
444+ 'TIMEOUT': 30,
383445 'OPTIONS': {
384446 'ignore_exc': True,
385447 },
386- }
448+ }
387449}
388450```
389451
0 commit comments