-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain
93 lines (77 loc) · 3.56 KB
/
main
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
apt update
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
apt update
apt install gcc libssh2-1-dev golang make odbc-mariadb unixodbc unixodbc-dev odbcinst mariadb-server zabbix-agent2 libxml2-dev pkg-config libsnmp-dev snmp libopenipmi-dev libevent-dev libcurl4-openssl-dev libpcre3-dev build-essential libmariadb-dev sudo libxml2-dev snmp libsnmp-dev libcurl4-openssl-dev php-gd php-xml php-bcmath php-mbstring vim libevent-dev libpcre3-dev libxml2-dev libmariadb-dev libopenipmi-dev pkg-config php-ldap -y
cd /opt
export PATH=$PATH:/usr/local/go/bin
wget https://cdn.zabbix.com/zabbix/sources/stable/6.4/zabbix-6.4.5.tar.gz
tar -zxvf zabbix-6.4.5.tar.gz
addgroup --system --quiet zabbix
adduser --quiet --system --disabled-login --ingroup zabbix --home /var/lib/zabbix --no-create-home zabbix
mkdir -m u=rwx,g=rwx,o= -p /var/lib/zabbix
chown -R zabbix:zabbix /var/lib/zabbix
cd zabbix-6.4.5/
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-unixodbc --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --enable-agent2 --with-ssh2 --enable-webservice
make install
apt update
apt install zabbix-frontend-php mariadb-server zabbix-nginx-conf zabbix-sql-scripts nginx -y
cp conf/zabbix_server.conf /etc/zabbix/
cp /etc/zabbix/nginx.conf /etc/nginx/sites-enabled/zabbix.conf
chown -R zabbix:zabbix /etc/zabbix/
[remove the default file in /etc/nginx/site-enable/default]
[change the port in zabbix.conf and listen 80]
service restart nginx
service status nginx
echo -n "[Unit]
Description=Zabbix Server
After=syslog.target network.target mysql.service
[Service]
Type=simple
User=zabbix
ExecStart=/usr/local/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
ExecReload=/usr/local/sbin/zabbix_server -R config_cache_reload
RemainAfterExit=yes
PIDFile=/tmp/zabbix_server.pid
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/zabbix-server.service
systemctl daemon-reload
systemctl enable zabbix-server --now
systemctl enable nginx --now
systemctl enable zabbix-agent2 --now
mysql << EOF
create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user zabbix@localhost identified by 'PackopsZBX2022';
grant all privileges on zabbix.* to zabbix@localhost;
flush privileges;
SET GLOBAL log_bin_trust_function_creators = 1;
EOF
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
echo "DBPassword=PackopsZBX2022" >> /etc/zabbix/zabbix_server.conf
[uncomment ther DBPassword in zabbix_server.conf]
systemctl restart zabbix-server
systemctl restart nginx
systemctl restart zabbix-agent2
11:47
https://www.zabbix.com/download_sources
12:19
Farshad NickFetrat
rm -rf /etc/nginx/sites-enabled/default
13:37
Farshad NickFetrat
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update && apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
apt install docker-compose -y
git clone https://github.com/zabbix/zabbix-docker.git
cd zabbix-docker
mv docker-compose_v3_ubuntu_mysql_latest.yaml docker-compose.yml
docker-compose up -d