-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathINSTALL
115 lines (100 loc) · 4.28 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
# Installation from git on Ubuntu Trusty 14.04
# -----------------------------------------------
# 1. Install dependencies. Note that Django >= 1.6 is required.
apt-get install python-django-tagging python-django-south python-django \
python-django-extensions python-argparse python-lxml python-rpm python-debian \
python-pygooglechart python-cracklib python-progressbar libapache2-mod-wsgi \
apache2
# 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/settings.py.sample /etc/patchman/settings.py
# 4. Modify settings file to suit your site
vi /etc/patchman/settings.py
# e.g. for a mysql backend:
#
# Make sure mysql-server and the python mysql bindings are installed:
#
# apt-get install mysql-server python-mysqldb
#
# 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/settings.py to have the following:
#
#ADMINS = (
# ('Patchman Admin', 'you@example.com'),
#)
#
#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. Edit the networks allowed to report to apache and reload apache
vi /etc/apache2/conf-enabled/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
# If the migrate fails with an error such as
# django.db.utils.DatabaseError: (1050, "Table 'operatingsystems_osgroup' already exists")
# you may need to run the migrations for each app manually, ending with the troublesome one. e.g.
#
# ./manage.py migrate hosts
# ./manage.py migrate repos
# ./manage.py migrate arch
# ./manage.py migrate domains
# ./manage.py migrate reports
# ./manage.py migrate packages
# ./manage.py migrate operatingsystems
# ./manage.py migrate --list
# 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/patchman /srv/patchman/sbin/patchman -h to view all options.
# 11. If you want to run patchman under a subdirectory
# e.g. http://example.com/mypatchman/
# then you need to add the following to /etc/patchman/settings.py
# LOGIN_REDIRECT_URL = '/mypatchman/'
# LOGIN_URL = '/mypatchman/accounts/login/'
# and make the appropriate changes in /etc/apache2/conf.d/patchman.conf
# 12. You can optionally run memcached:
apt-get install memcached python-memcache
# and add the following to /etc/patchman/settings.py
#CACHES = {
# 'default': {
# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
# 'LOCATION': '127.0.0.1:11211',
# }
#}