forked from furlongm/patchman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL
158 lines (130 loc) · 5.86 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Installation from deb on Ubuntu 14.04 (trusty)
# ----------------------------------------------
$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0412F522
$ echo "deb http://repo.openbytes.ie/ubuntu trusty main" > /etc/apt/sources.list.d/patchman.list
$ apt-get update
$ apt-get install python-patchman
# Modify /etc/patchman/local_settings.py to suit your site
$ patchman-manage syncdb
# Installation from deb on Debian 7 (wheezy)
# ------------------------------------------
$ echo "deb http://http.debian.net/debian wheezy-backports main" > /etc/apt/sources.list.d/backports.list
$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0412F522
$ echo "deb http://repo.openbytes.ie/debian wheezy main" > /etc/apt/sources.list.d/patchman.list
$ apt-get update
$ apt-get install python-django/wheezy-backports
$ apt-get install python-patchman
# Modify /etc/patchman/local_settings.py to suit your site
$ patchman-manage migrate
$ patchman-manage createsuperuser
# Installation from git on Ubuntu 14.04 and Debian 8
# ----------------------------------------------------
# Debian 8 only
Django 1.8 is the minimum version required to run the latest git version of
patchman. Django 1.8 is in the jessie-backports apt repository for Debian 8. To
add this repo on Debian 8, run the following command:
echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list.d/jessie-backports.list
On Debian 8, it is also necessary to create a preferences file to give packages
from the jessie-backports repo a higher priority:
cat > /etc/apt/preferences.d/jessie-backports << EOF
Package: *
Pin: release n=jessie-backports
Pin-Priority: 1000
EOF
# 1. Install dependencies.
apt-get install python-django-tagging python-django python-requests \
python-django-extensions python-argparse python-lxml python-rpm python-debian \
python-pygooglechart python-cracklib python-progressbar libapache2-mod-wsgi \
python-djangorestframework apache2 python-colorama python-humanize
# If python-django-tagging is older than 0.3.3, you may need to uninstall the
# current version and upgrade to the latest pip version:
dpkg -r --force-depends python-django-tagging
pip install --upgrade django-tagging
# Install django-bootstrap3
pip install django-bootstrap3
# Optionally install backports.lzma
apt-get install liblzma-dev
pip install backports.lzma
# 2. Check out current git to e.g. /srv/patchman
cd /srv
git clone https://github.com/furlongm/patchman.git
# 3. Copy server settings example file to /etc/patchman
mkdir /etc/patchman
cp /srv/patchman/etc/local_settings.py /etc/patchman/
# 4. Modify settings file to suit your site
vi /etc/patchman/local_settings.py
# 4.a) add ADMINS
# 4.b) add SECRET_KEY
# 4.c) change STATICFILES_DIRS to /srv/patchman/media
# 4.d) configure database backend
#
# e.g. for a mysql backend:
#
# Make sure mysql-server and the python mysql bindings are installed:
#
# apt-get install mysql-server python-mysqldb python-pymysql
#
# Create database and users:
#
#mysql> CREATE DATABASE patchman CHARACTER SET utf8 COLLATE utf8_general_ci;
#Query OK, 1 row affected (0.00 sec)
#
#mysql> GRANT ALL PRIVILEGES ON patchman.* TO patchman@localhost IDENTIFIED BY 'changeme';
#Query OK, 0 rows affected (0.00 sec)
#
# Then modify /etc/patchman/local_settings.py as follows:
#
#DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
# 'NAME': 'patchman', # Or path to database file if using sqlite3.
# 'USER': 'patchman', # Not used with sqlite3.
# 'PASSWORD': 'changeme', # Not used with sqlite3.
# 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
# 'PORT': '', # Set to empty string for default. Not used with sqlite3.
# 'STORAGE_ENGINE': 'INNODB',
# 'CHARSET' : 'utf8'
# }
#}
# 5. Enable mod-wsgi and copy the apache conf file
a2enmod wsgi
cp /srv/patchman/etc/patchman-apache.conf /etc/apache2/conf-available/patchman.conf
a2enconf patchman
# 6. Change /usr/lib/python2.7/dist-packages/patchman to /srv/patchman/patchman,
# edit the networks allowed to report to apache and reload apache.
vi /etc/apache2/conf-available/patchman.conf
service apache2 reload
# 7. Initialise the database, perform migrations, and collect static files.
cd /srv/patchman/patchman
./manage.py syncdb # answer questions here if required
./manage.py migrate
./manage.py collectstatic
# 8. Deploy the client and/or yum/apt plugins via e.g. puppet, and add a daily
# cronjob, e.g.
# 0 7 * * * /bin/sleep $((RANDOM\%600)); PATH=/bin:/sbin:/usr/bin:/usr/sbin /usr/local/sbin/patchman-client
# 9. Optionally install celeryd/rabbitmq for realtime processing of reports:
apt-get install python-django-celery rabbitmq-server
./manage.py syncdb
./manage.py migrate
./manage.py celeryd_detach
# add the last command to an initscript (e.g. /etc/rc.local) to make it
# persistent over reboot
# 10. Alternatively, or in addition to 9, set up a cronjob to run all the daily tasks, e.g.
#
# 30 8 * * * http_proxy=http://myproxy.example.com:3128 PYTHONPATH=/srv/patchman /srv/patchman/sbin/patchman -a -q
#
# Run PYTHONPATH=/srv/patchman /srv/patchman/sbin/patchman -h to view all options.
# 11. You can optionally run memcached:
apt-get install memcached python-memcache
# and add the following to /etc/patchman/local_settings.py
#CACHES = {
# 'default': {
# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
# 'LOCATION': '127.0.0.1:11211',
# }
#}
# 12. To test your installation, run the client locally:
/srv/patchman/client/patchman-client -s http://127.0.0.1/patchman/
# and then run the daily server tasks:
PYTHONPATH=/srv/patchman /srv/patchman/sbin/patchman -a
# The django interface should be available at http://127.0.0.1/patchman/