· 9 years ago · Oct 20, 2016, 01:30 PM
1firewall-cmd --permanent --add-port=10050/tcp
2
3firewall-cmd --permanent --add-port=10051/tcp
4
5firewall-cmd --permanent --add-port=80/tcp
6
7firewall-cmd --permanent --add-port=3000/tcp
8
9firewall-cmd --reload
10service firewalld restart
11
12yum install wget yum-utils
13
14nano /etc/yum.repos.d/grafana.repo
15
16[grafana]
17name=grafana
18baseurl=https://packagecloud.io/grafana/stable/el/6/$basearch
19repo_gpgcheck=1
20enabled=1
21gpgcheck=1
22gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
23sslverify=1
24sslcacert=/etc/pki/tls/certs/ca-bundle.crt
25
26wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
27wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
28
29rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
30
31rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
32
33rpm -ivh https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
34
35yum update
36
37yum install postgresql96-server zabbix-server-pgsql zabbix-web-pgsql
38
39/usr/pgsql-9.6/bin/postgresql96-setup initdb
40 systemctl start postgresql-9.6.service
41
42su - postgres
43
44createuser -d -S -R -P zabbix
45
46createdb -O zabbix zabbix
47
48createuser -d -S -R -P grafana
49
50createdb -O grafana grafana
51
52exit
53
54nano /var/lib/pgsql/9.6/data/pg_hba.conf
55
56# TYPE DATABASE USER ADDRESS METHOD
57
58# "local" is for Unix domain socket connections only
59local all all md5
60# IPv4 local connections:
61host all all 127.0.0.1/32 md5
62# IPv6 local connections:
63host all all ::1/128 md5
64# Allow replication connections from localhost, by a user with the
65# replication privilege.
66#local replication postgres peer
67#host replication postgres 127.0.0.1/32 ident
68#host replication postgres ::1/128 ident
69
70systemctl restart postgresql-9.6.service
71
72su - postgres
73
74zcat /usr/share/doc/zabbix-server-pgsql-3.2.1/create.sql.gz | psql -U zabbix zabbix
75
76exit
77
78setsebool -P zabbix_can_network 1
79setsebool -P httpd_can_network_connect 1
80setsebool -P httpd_can_connect_zabbix 1
81
82service httpd stop
83
84systemctl disable httpd
85
86yum-config-manager --enable remi-php70
87yum install nginx php-fpm
88
89
90nano /etc/php-fpm.d/www.conf
91
92; RPM: apache Choosed to be able to access some dir as httpd
93user = nginx
94; RPM: Keep a group allowed to write in log dir.
95group = nginx
96
97; The address on which to accept FastCGI requests.
98; Valid syntaxes are:
99; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
100; a specific port;
101; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
102; a specific port;
103; 'port' - to listen on a TCP socket to all addresses
104; (IPv6 and IPv4-mapped) on a specific port;
105; '/path/to/unix/socket' - to listen on a unix socket.
106; Note: This value is mandatory.
107listen = /var/run/php-fpm/php.socket
108
109
110; Set permissions for unix socket, if one is used. In Linux, read/write
111; permissions must be set in order to allow connections from a web server.
112; Default Values: user and group are set as the running user
113; mode is set to 0660
114listen.owner = nginx
115listen.group = nginx
116listen.mode = 0660
117
118
119
120
121nano /etc/php.ini
122
123
124; Maximum size of POST data that PHP will accept.
125; Its value may be 0 to disable the limit. It is ignored if POST data reading
126; is disabled through enable_post_data_reading.
127; http://php.net/post-max-size
128post_max_size = 16M
129
130; Maximum execution time of each script, in seconds
131; http://php.net/max-execution-time
132; Note: This directive is hardcoded to 0 for the CLI SAPI
133max_execution_time = 300
134
135; Maximum amount of time each script may spend parsing request data. It's a good
136; idea to limit this time on productions servers in order to eliminate unexpectedly
137; long running scripts.
138; Note: This directive is hardcoded to -1 for the CLI SAPI
139; Default Value: -1 (Unlimited)
140; Development Value: 60 (60 seconds)
141; Production Value: 60 (60 seconds)
142; http://php.net/max-input-time
143max_input_time = 300
144
145; Defines the default timezone used by the date functions
146; http://php.net/date.timezone
147date.timezone = Europe/Vilnius
148
149
150chown -R nginx:nginx /var/run/php-fpm
151chown -R nginx:nginx /etc/zabbix/web
152chown -R nginx:nginx /usr/share/zabbix
153chown -R nginx:nginx /var/lib/php/session
154
155nano /etc/nginx/conf.d/zabbix.conf
156
157server {
158listen 80;
159server_name io.gameshow.media;
160
161location / {
162root /usr/share/zabbix;
163index index.php index.html index.htm;
164}
165
166location ~ \.php$ {
167root /usr/share/zabbix;
168try_files $uri =404;
169fastcgi_pass unix:/var/run/php-fpm/php.socket;
170fastcgi_index index.php;
171fastcgi_buffers 4 256k;
172fastcgi_busy_buffers_size 256k;
173fastcgi_temp_file_write_size 256k;
174
175fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
176include fastcgi_params;
177}
178
179# deny access to .htaccess files, if Apache's document root
180# concurs with nginx's one
181#
182location ~ /\.ht {
183deny all;
184}
185}
186
187yum install grafana
188
189nano /etc/grafana/grafana.ini
190
191
192[server]
193protocol = http
194http_addr =
195http_port = 3000
196domain = localhost
197enforce_domain = false
198root_url = %(protocol)s://%(domain)s:%(http_port)s/
199router_logging = false
200
201[database]
202type = postgres
203host = 127.0.0.1
204name = grafana
205user = grafana
206password = grafana
207ssl_mode = disable
208
209[session]
210provider = memory
211
212[security]
213admin_user = admin
214admin_password = admin
215
216secret_key = SW2YcwTIb9sdfghfdgsh
217
218nano /etc/nginx/conf.d/grafana.conf
219
220server {
221 server_name board.gameshow.media;
222 listen 80;
223 access_log /var/log/nginx/grafana.access.log;
224 error_log /var/log/nginx/grafana.error.log;
225
226 location / {
227 proxy_pass http://localhost:3000;
228 proxy_set_header Host $host;
229 }
230}
231
232grafana-cli plugins install alexanderzobnin-zabbix-app
233yum install zabbix-agent
234
235systemctl daemon-reload
236systemctl enable grafana-server.service
237
238systemctl enable nginx
239
240systemctl enable zabbix-agent
241
242systemctl enable php-fpm
243
244systemctl enable postgresql-9.6.service
245
246service nginx start
247service php-fpm start
248
249reboot