{"id":6308,"date":"2021-11-17T15:47:32","date_gmt":"2021-11-17T15:47:32","guid":{"rendered":"https:\/\/www.geekdecoder.com\/?p=6308"},"modified":"2021-11-17T15:47:32","modified_gmt":"2021-11-17T15:47:32","slug":"install-mysql-nginx-and-zabbix-on-debian-11","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2021\/11\/17\/install-mysql-nginx-and-zabbix-on-debian-11\/","title":{"rendered":"Install MySQL, Nginx and Zabbix on Debian 11"},"content":{"rendered":"<p>At first, let&#8217;s update the packages:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># apt update\n<\/pre>\n<p>Next, download MySQL from the offical page or use wget command: Get the repo package<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">wget https:\/\/dev.mysql.com\/get\/mysql-apt-config_0.8.20-1_all.deb\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">dpkg -i mysql-apt-config_0.8.20-1_all.deb\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">apt install  gnupg\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">dpkg -i mysql-apt-config_0.8.20-1_all.deb\n<\/pre>\n<p>When you attempt to install the package, it will ask you what product and version you want to install. Here you can select The MySQL version, Tools, Connectors (like MySQL Workbench), and preview packages. To select the version, hit the first option:<br \/>\n<a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-094700.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-6309\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-094700-1024x258.png\" alt=\"\" width=\"640\" height=\"161\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-094700-1024x258.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-094700-300x76.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-094700-768x193.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-094700.png 1207w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Select the version you will use. Once selected, it will bring you to the previous menu \u2014 press Ok button:<br \/>\n<a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095002.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-6312\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095002-1024x264.png\" alt=\"\" width=\"640\" height=\"165\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095002-1024x264.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095002-300x77.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095002-768x198.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095002.png 1208w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">apt-get update\n<\/pre>\n<p>Install the MySQL Server using the command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo apt-get install mysql-community-server\n<\/pre>\n<p>When apt finishes downloading, the installer will ask for a root password:<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095230.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-6315\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095230-1024x181.png\" alt=\"\" width=\"640\" height=\"113\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095230-1024x181.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095230-300x53.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095230-768x136.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-095230.png 1187w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>You have two options:<\/p>\n<ol>\n<li>Leave the password blank: the server will use unix sockets authentication. It means you can only access the server as a root user or as a user with sudo<\/li>\n<li>Set a password: the authentication method will be the same for other users.<\/li>\n<\/ol>\n<p>If you set a password, the installer will ask which authentication plugin to use, strongly encrypted password (MySQL 8.x), or legacy method (MySQL 7.x and earlier).<\/p>\n<p>Now, check the service status with systemctl:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">systemctl status mysql.service<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# systemctl status mysql.service\n\u25cf mysql.service - MySQL Community Server\n     Loaded: loaded (\/lib\/systemd\/system\/mysql.service; enabled; vendor preset: enabled)\n     Active: active (running) since Wed 2021-11-17 09:57:21 CST; 38s ago\n       Docs: man:mysqld(8)\n             http:\/\/dev.mysql.com\/doc\/refman\/en\/using-systemd.html\n    Process: 4290 ExecStartPre=\/usr\/share\/mysql-8.0\/mysql-systemd-start pre (code=exited, status=0\/SUCCESS)\n   Main PID: 4325 (mysqld)\n     Status: &quot;Server is operational&quot;\n      Tasks: 38 (limit: 2341)\n     Memory: 358.6M\n        CPU: 736ms\n     CGroup: \/system.slice\/mysql.service\n             \u2514\u25004325 \/usr\/sbin\/mysqld\n\nNov 17 09:57:19 redis-004 systemd&#x5B;1]: Starting MySQL Community Server...\nNov 17 09:57:21 redis-004 systemd&#x5B;1]: Started MySQL Community Server.\n<\/pre>\n<p>Next, run the command as a root user to safely configure the SQL service:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">mysql_secure_installation<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nSecuring the MySQL server deployment.\nEnter password for user root:\n\nVALIDATE PASSWORD COMPONENT can be used to test passwords\nand improve security. It checks the strength of password\nand allows the users to set only those passwords which are\nsecure enough. Would you like to setup VALIDATE PASSWORD component?\n\nPress y|Y for Yes, any other key for No:\nUsing existing password for root.\nChange the password for root ? ((Press y|Y for Yes, any other key for No) :\n\n ... skipping.\nBy default, a MySQL installation has an anonymous user,\nallowing anyone to log into MySQL without having to have\na user account created for them. This is intended only for\ntesting, and to make the installation go a bit smoother.\nYou should remove them before moving into a production\nenvironment.\n\nRemove anonymous users? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\nNormally, root should only be allowed to connect from\n&#039;localhost&#039;. This ensures that someone cannot guess at\nthe root password from the network.\n\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\nBy default, MySQL comes with a database named &#039;test&#039; that\nanyone can access. This is also intended only for testing,\nand should be removed before moving into a production\nenvironment.\n\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : y\n - Dropping test database...\nSuccess.\n\n - Removing privileges on test database...\nSuccess.\n\nReloading the privilege tables will ensure that all changes\nmade so far will take effect immediately.\n\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\nAll done!\n<\/pre>\n<p>Login and Check the version<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># mysql -uroot -p\nEnter password:\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 12\nServer version: 8.0.27 MySQL Community Server - GPL\n\nCopyright (c) 2000, 2021, Oracle and\/or its affiliates.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType &#039;help;&#039; or &#039;\\h&#039; for help. Type &#039;\\c&#039; to clear the current input statement.\n<\/pre>\n<p>Installing Nginx<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsudo apt update\nsudo apt install nginx\nsystemctl status nginx\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nnginx.service - A high performance web server and a reverse proxy server\n     Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\n     Active: active (running) since Wed 2021-11-17 10:09:21 CST; 18s ago\n       Docs: man:nginx(8)\n    Process: 5735 ExecStartPre=\/usr\/sbin\/nginx -t -q -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\n    Process: 5736 ExecStart=\/usr\/sbin\/nginx -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\n   Main PID: 5951 (nginx)\n      Tasks: 2 (limit: 2341)\n     Memory: 5.9M\n        CPU: 34ms\n     CGroup: \/system.slice\/nginx.service\n             \u251c\u25005951 nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;\n             \u2514\u25005954 nginx: worker process\n\nNov 17 10:09:21 redis-004 systemd&#x5B;1]: Starting A high performance web server and a reverse proxy server...\nNov 17 10:09:21 redis-004 systemd&#x5B;1]: nginx.service: Failed to parse PID from file \/run\/nginx.pid: Invalid argument\nNov 17 10:09:21 redis-004 systemd&#x5B;1]: Started A high performance web server and a reverse proxy server.\n<\/pre>\n<p>Check Nginx by IP address &#8211; http:\/\/192.168.0.33<br \/>\n<a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-101412.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-101412.png\" alt=\"\" width=\"539\" height=\"230\" class=\"alignnone size-full wp-image-6326\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-101412.png 539w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2021\/11\/Screenshot-2021-11-17-101412-300x128.png 300w\" sizes=\"auto, (max-width: 539px) 100vw, 539px\" \/><\/a><\/p>\n<p>When using the Nginx web server, server blocks (similar to virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain on a single server. We will set up a domain called your_domain.<\/p>\n<p>Install and configure Zabbix server for your platform<br \/>\nInstall Zabbix repository<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# wget https:\/\/repo.zabbix.com\/zabbix\/5.4\/debian\/pool\/main\/z\/zabbix-release\/zabbix-release_5.4-1+debian11_all.deb\n# dpkg -i zabbix-release_5.4-1+debian11_all.deb\n# apt update\n<\/pre>\n<p>Install Zabbix server, frontend, agent<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2\n<\/pre>\n<p>c. Create initial database<br \/>\nRun the following on your database host.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# mysql -uroot -p\npassword\nmysql&gt; create database zabbix character set utf8 collate utf8_bin;\nmysql&gt; create user zabbix@localhost identified by &#039;Stx12WsaB&#039;;\nmysql&gt; grant all privileges on zabbix.* to zabbix@localhost;\nmysql&gt; quit; \n<\/pre>\n<p>On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# zcat \/usr\/share\/doc\/zabbix-sql-scripts\/mysql\/create.sql.gz | mysql -uzabbix -p zabbix\n<\/pre>\n<p>Configure the database for Zabbix server. Edit file \/etc\/zabbix\/zabbix_server.conf<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nDBPassword=Stx12WsaB\n<\/pre>\n<p>Configure PHP for Zabbix frontend<br \/>\nEdit file \/etc\/zabbix\/nginx.conf, uncomment and set &#8216;listen&#8217; and &#8216;server_name&#8217; directives.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">nano \/etc\/zabbix\/nginx.conf\n# listen 80;\n# server_name example.com;\n<\/pre>\n<p>Start Zabbix server and agent processes and make it start at system boot.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# systemctl restart zabbix-server zabbix-agent2 nginx php7.4-fpm\n# systemctl enable zabbix-server zabbix-agent2 nginx php7.4-fpm\n<\/pre>\n<p>Configure Zabbix frontend<br \/>\nConnect to your newly installed Zabbix frontend: http:\/\/server_ip_or_name<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At first, let&#8217;s update the packages: # apt update Next, download MySQL from the offical page or use wget command: Get the repo package wget https:\/\/dev.mysql.com\/get\/mysql-apt-config_0.8.20-1_all.deb dpkg -i mysql-apt-config_0.8.20-1_all.deb apt install gnupg dpkg -i mysql-apt-config_0.8.20-1_all.deb When you attempt to install the package, it will ask you what product and version you want to install. Here &#8230; <a title=\"Install MySQL, Nginx and Zabbix on Debian 11\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2021\/11\/17\/install-mysql-nginx-and-zabbix-on-debian-11\/\" aria-label=\"Read more about Install MySQL, Nginx and Zabbix on Debian 11\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70,74,133],"tags":[],"class_list":["post-6308","post","type-post","status-publish","format-standard","hentry","category-mysql","category-nginx","category-zabbix"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/6308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=6308"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/6308\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=6308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=6308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=6308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}