创建grafana用户
# groupadd -g 1025 -o -r grafana
# useradd -M -N -g grafana -o -r -d /data/apps/grafana -s /bin/false -c "grafana Server" -u 1025 grafana
下载grafana
# wget https://dl.grafana.com/oss/release/grafana-9.4.3.linux-amd64.tar.gz
安装grafana
# tar xf grafana-9.4.3.linux-amd64.tar.gz -C /data/apps/grafana
# ln -sv /data/apps/grafana、grafana-9.4.3/ /usr/local/grafana
创建数据目录
# mkdir -pv /data/apps/grafana/{logs,data,plugins,provisioning}
# chown -R grafana.grafana /data/apps/grafana
修改配置文件
/usr/local/grafana/conf/defaults.ini
[paths]
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
data = /data/apps/grafana/data
# Temporary files in `data` directory older than given duration will be removed
temp_data_lifetime = 24h
# Directory where grafana can store logs
logs = /data/apps/grafana/logs
# Directory where grafana will automatically scan and look for plugins
plugins = /data/apps/grafana/plugins
# folder that contains provisioning config files that grafana will apply on startup and while running.
provisioning = /data/apps/grafana/provisioning
grafana-server.service
[Unit]
Description=Grafana instance
Documentation=http://docs.grafana.org
Wants=network-online.target
After=network-online.target
#After=postgresql.service mariadb.service mysqld.service influxdb.service
[Service]
User=grafana
Group=grafana
Type=notify
Restart=on-failure
WorkingDirectory=/usr/local/grafana
RuntimeDirectory=grafana
RuntimeDirectoryMode=0750
ExecStart=/usr/local/grafana/bin/grafana server \
--homepath=/usr/local/grafana \
--config=/usr/local/grafana/conf/defaults.ini \
--pidfile=/data/apps/grafana/grafana-server.pid
LimitNOFILE=10000
TimeoutStopSec=20
CapabilityBoundingSet=
DeviceAllow=
LockPersonality=true
MemoryDenyWriteExecute=false
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectProc=invisible
ProtectSystem=full
RemoveIPC=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
UMask=0027
[Install]
WantedBy=multi-user.target
运行服务
# systemctl enable grafana && systemctl start grafana
访问dashboard
默认用户名密码:admin/admin
标签:二进制,data,local,apps,grafana,部署,usr,true From: https://www.cnblogs.com/wangguishe/p/17226968.html