Otu esi eme ma hazie nkwalite-anaghị ele anya na Debian 11

Idebe usoro gị ka ọ dị ọhụrụ bụ ihe dị mkpa maka onye ọ bụla sitere na ndị ọrụ desktọpụ dị mfe, ndị mmepe, sysadmins; nke ọma, ka anyị chee ya ihu, onye ọ bụla nwere ngwaọrụ ejikọrọ na ịntanetị. Debian, na ndabara, ahazibeghị maka mmelite akpaka. Otú ọ dị, site n'ịkwalite na ịhazi ngwugwu nkwalite na-adịghị elele, ị nwere ike itinye nchekwa, ngwugwu, ma ọ bụ ọbụna nkwalite ọhụrụ n'ụzọ dị mfe, dị mfe ma dị irè ma ọ bụrụ na ị naghị enwe oge ịlele ma ọ bụ chefuo. A na-atụ aro IT nke ukwuu iji mee nke a naanị maka nchekwa naanị.

Nkuzi na-esote ga-egosi otu esi etinye na ma ọ bụ mee ka ma hazie nkwalite-anaghị ele anya na Debian 11.

Prerequisites

  • OS akwadoro: Nnenna 11 Bullseye ma ọ bụ Debian 10, 9 ma ọ bụ sistemụ Debian ọ bụla ka emelitere.
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ihe ùgwù or ohere mgbọrọgwụ (su Command).

Na-emelite Sistemụ Ọrụ

Melite gi Debian 11 Sistemụ arụmọrụ iji hụ na ngwugwu niile dị adị adịla ugbu a:

sudo apt update && sudo apt upgrade

Mgbọrọgwụ ma ọ bụ Sudo Access

Site na ndabara, mgbe ị mepụtara akaụntụ gị na mmalite na Debian ma e jiri ya tụnyere nkesa ndị ọzọ, ọ naghị enweta ọkwa sudoers ozugbo. Ị ga-enwerịrị ike ịnweta ya mgbọrọgwụ paswọọdụ iji iwu su ma ọ bụ gaa na nkuzi nkuzi anyị Otu esi etinye onye ọrụ na Sudoers na Debian.


Advertisement


Wụnye ngwungwu nkwalite-anaghị ele anya

Nke mbụ, ọ bụrụ na ịwụnyebeghị nkwalite na-anaghị ele anya ma ọ bụ wepụrụ ngwugwu ahụ, ị ​​ga-eji iwu na-esonụ tinyegharịa nke a:

sudo apt install unattended-upgrades

Site na ndabara, ekwesịrị itinye nke a.

Ị ga -achọkwa tinye ngwugwu apt-config-auto-update ọ bụrụ na ịchọrọ ka sistemụ Debian gị malitegharịa mgbe itinye nkwalite chọrọ ka sistemụ malitegharịa na-akpaghị aka. Iji mee nke a, jiri iwu a dị n'okpuru:

sudo apt install apt-config-auto-update

Maka ndị ọrụ laptọọpụ, ị ga-achọ ịwụnye ngwugwu ahụ powermgmt-base ọ bụrụ na ị na-eme atụmatụ iji nhọrọ ọ bụla na-adịghị ele anya na-eji nhọrọ batrị.

sudo apt install powermgmt-base

Ozugbo echichi ahụ zuru, site na ndabara, Debian kwesịrị ịmalite usoro ahụ. Iji nyochaa, jiri iwu a:

sudo systemctl status unattended-upgrades

Ihe atụ mmepụta:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Ndị a systemctl nyere iwu ga-akọwa nhọrọ ndị ị ga-amalite, kwụsị, gbanye na buut, gbanyụọ na buut ma ọ bụ malitegharịa ọrụ nkwalite na-adịghị ahụ anya:

Ka ịmalite ọrụ ndị a na-adịghị ele anya:

sudo systemctl start unattended-upgrades

Ka ịkwụsị ọrụ ndị a na-adịghị ele anya:

sudo systemctl stop unattended-upgrades

Iji mee ka buut ọrụ ndị a na-adịghị ele anya:

sudo systemctl enable unattended-upgrades

Iji gbanyụọ na buut ọrụ anaghị elekọta:

sudo systemctl disable unattended-upgrades

Ka ịmalitegharịa na ọrụ anaghị elekọta:


sudo systemctl restart unattended-upgrades

Hazie nkwalite-anaghị ele anya

Mgbe ịlele ma ọ bụ wụnye nkwalite na-adịghị ele anya, anyị na-edezi ya ugbu a Nkwalite 50 anaghị ele anya hazie faịlụ site na iji nchịkọta ederede ọnụ kacha amasị gị. Site na ebe a, ị nwere ike ịhazi nkwalite na-enweghị nlekọta site na ụfọdụ n'ime ihe atụ na nkuzi a ma chọpụta ụfọdụ nhọrọ ndị ọzọ na-adịghị eji; akwụkwọ dị na faịlụ nhazi na-enye nkọwa dị mma nke ntọala ọ bụla n'onwe ya.

Ị nwere ike ime nke a site na iwu na-esonụ:

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

Ọmụmaatụ imepe windo na anya nke mbụ:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Mmalite-mmalite na mmelite

Ngwungwu nkwalite na-adịghị ele anya agaghị hazie ahịrị ndị na-amalite // syntax. Site na ndabara, naanị mmelite nche ka etinyere na-akpaghị aka, dịka egosiri na ahịrị dị n'okpuru. Ọ ga-aka mma ma ọ bụrụ na ị nweghị nkwarụ nwelite nche; Otú ọ dị, ịnwere ike ịgbakwunye nhọrọ ndị ọzọ ebe a.

Dịka ọmụmaatụ, ịgụnye mmelite ngwungwu nkịtị na-adịghị na ndabara:

Gbanwee site na:

//      "${distro_id}:${distro_codename}-updates";

Gbanwee iji mee ka:

       "${distro_id}:${distro_codename}-updates";

Nhazi ihe atụ nke na-abịa na ndabara (akwadoro maka ọtụtụ ndị ọrụ):

Unattended-Upgrade::Allowed-Origins {
        "${distro_id}:${distro_codename}";
        "${distro_id}:${distro_codename}-security";
        // Extended Security Maintenance; doesn't necessarily exist for
        // every release and this system may not have it installed, but if
        // available, the policy for updates is such that unattended-upgrades
        // should also install from here by default.
        "${distro_id}ESMApps:${distro_codename}-apps-security";
        "${distro_id}ESM:${distro_codename}-infra-security";
//      "${distro_id}:${distro_codename}-updates";
//      "${distro_id}:${distro_codename}-proposed";
//      "${distro_id}:${distro_codename}-backports";
};

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Iji mebie ya ọbụna n'ihu nhọrọ ndị ị nwere ike ime ma e wezụga ndabara:

  • "${distro_id}:${distro_codename}-mmelite"; - nhọrọ a ga-adị ka ịgba ọsọ sudo apt update n'ọnụ ọnụ gị iji dọpụta mmelite ngwugwu. Ọtụtụ mgbe, nke a bụ unadvised dị ka ụfọdụ ngwugwu chọrọ ntuziaka aka mgbe upgrading, ma ọ bụrụ na ị na-eme ka a set na blacklist ụfọdụ ngwugwu ị maara ga-eme ka okwu ma ọ bụrụ na emelitere na-ejighị n'aka dị ka akọwara na e mesịrị na nkuzi.
  • "${distro_id}:${distro_codename}-atụ aro"; - nhọrọ a ga-adọta mmelite site na ule, nke a na-adịghị akwadoro maka ndị ọrụ niile dịka ngwugwu anaghị akwụsi ike na ọ nwere ike ọ gaghị eme ya na gburugburu ebe obibi.
  • "${distro_id}:${distro_codename}-backports"; - nhọrọ a ga-eme ka azụ azụ nke a na-ejikarị emelite ngwugwu, nke a na-adịkarị ka ọ kwụsiri ike karịa ka a tụrụ anya mana maka iwu mkpuchi ị ga-enyocha tupu ịgbanwuo nke a n'ihi na ọ nwere ike ịkpata ọgba aghara.

Wepụ ngwugwu na mmelite

Site na mmelite, ụfọdụ ngwungwu nwere ike ghara ịdị n'otu ma ọ bụ mebie kpamkpam ma ọ bụrụ na ị naghị elekọta usoro a. Dịka ọmụmaatụ, nkwalite akpaka Nginx maka onye ọrụ nwere ModSecurity chịkọtara ga-agbaji; ị na-adịkarịghị mkpa ka ejupụta ihe ọ bụla ebe a; nke a bụ naanị maka sava raara onwe ya nye na-agba ọsọ ngwugwu chọrọ enyemaka.

Mara, ọ ka mma iji okwu Python wee kwekọọ na ngwugwu:

atụ si

// Python regular expressions, matching packages to exclude from upgrading
Unattended-Upgrade::Package-Blacklist {
    // The following matches all packages starting with linux-
//  "linux-";

    // Use $ to explicitely define the end of a package name. Without
    // the $, "libc6" would match all of them.
//  "libc6$";
//  "libc6-dev$";
//  "libc6-i686$";

Mgbanwe ihe atụ na-ewepukwa ngwa webụ Nginx:

// Python regular expressions, matching packages to exclude from upgrading
Unattended-Upgrade::Package-Blacklist {
    // The following matches all packages starting with linux-
  "nginx";

    // Use $ to explicitely define the end of a package name. Without
    // the $, "libc6" would match all of them.
//  "libc6$";
//  "libc6-dev$";
//  "libc6-i686$";

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Wepụ ịdabere na-ejighị ya

Na-esote, gaba na akpaaka wepụ ihe ndabere ejighi ya, nke nwere nhọrọ atọ; ndabara bụ ụgha. Agbanyeghị, na nhọrọ ị nwere ike ime ntọala ndị a. N'ụzọ bụ isi, ọ bụrụ na imelite ngwugwu na-akpaghị aka, dabere na ma ọ bụ kernel na nke ochie anaghịzi eji ihe fọdụrụ anaghịzi achọ; ọ ga-ehichapụ gị ozugbo ma wepụ ihe ndị a. Nke a na-adịkarị mma ime maka ọtụtụ ndị ọrụ.

Ọ bụrụ na ịchọghị ime nke a, hapụzie ahịrị ahụ emetụghị ya aka.

Ọmụmaatụ si:

// Remove unused automatically installed kernel-related packages
// (kernel images, kernel headers and kernel version locked tools).
// Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";

// Do automatic removal of newly unused dependencies after the upgrade
// Unattended-Upgrade::Remove-New-Unused-Dependencies "true";

// Do automatic removal of unused packages after the upgrade
// (equivalent to apt-get autoremove)
// Unattended-Upgrade::Remove-Unused-Dependencies "false";

Ọmụmaatụ na-agbanwe kwa:

// Remove unused automatically installed kernel-related packages
// (kernel images, kernel headers and kernel version locked tools).
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";

// Do automatic removal of newly unused dependencies after the upgrade
Unattended-Upgrade::Remove-New-Unused-Dependencies "true";

// Do automatic removal of unused packages after the upgrade
// (equivalent to apt-get autoremove)
Unattended-Upgrade::Remove-Unused-Dependencies "true";

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Advertisement


email Ịma Ọkwa

A na-atụ aro ịtọlite ​​ọkwa email, ọkachasị ma ọ bụrụ na anaghị eleba anya na sava na-agba ọsọ. N'ime nhazi ahụ, nnukwu nhọrọ bụ ịhọrọ email "na-mgbanwe," yabụ naanị ị ga-enweta ọkwa mgbe ngwanrọ gbanwere. N'aka nke ọzọ, ị nwere ike họrọ "naanị-na-njehie," yabụ na ị na-enweta ozi mgbe njehie mere.

A na-atụ aro ka ịhọrọ on-mgbanwe n'ihi na ị kwesịrị ịma ihe mmelite na-eme na sistemụ gị. Ị nwekwara ike ịtọ adreesị ozi-e ebe a:

Mara, nke a ga-achọ ka edobere ozi-e na nkesa gị maka ọkwa ka ọ rụọ ọrụ.

Ọmụmaatụ si:

// Send email to this address for problems or packages upgrades
// If empty or unset then no email is sent, make sure that you
// have a working mail setup on your system. A package that provides
// 'mailx' must be installed. E.g. "user@example.com"
//Unattended-Upgrade::Mail "";

Ọmụmaatụ na-agbanwe kwa:

// Send email to this address for problems or packages upgrades
// If empty or unset then no email is sent, make sure that you
// have a working mail setup on your system. A package that provides
// 'mailx' must be installed. E.g. "user@example.com"
Unattended-Upgrade::Mail "EMAILNAME@YOURDOMAIN.COM";

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Nhọrọ nke abụọ maka ọkwa ọkwa e-mail bụ na ihe a ga-akọ n'ezie. Maka ọtụtụ ndị ọrụ, naanị na njehie ma ọ bụ na mgbanwe zuru ezu; idebe akụkọ ahụ ka ọ bụrụ mgbe niile ga-ebute ọtụtụ ozi ịntanetị na-achọghị, mana maka sistemụ dị oke egwu, nke a nwere ike ịdị mma.

N'okpuru bụ ọmụmaatụ maka naanị-na-njehie, nke dị mma maka ndị ọrụ desktọpụ na gburugburu anaghị emepụta/webserver:

Ọmụmaatụ si:

// Set this value to one of:
//    "always", "only-on-error" or "on-change"
// If this is not set, then any legacy MailOnlyOnError (boolean) value
// is used to chose between "only-on-error" and "on-change"
//Unattended-Upgrade::MailReport "on-change";

Ọmụmaatụ na-agbanwe kwa:

// Set this value to one of:
//    "always", "only-on-error" or "on-change"
// If this is not set, then any legacy MailOnlyOnError (boolean) value
// is used to chose between "only-on-error" and "on-change"
Unattended-Upgrade::MailReport "only-on-error";

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Nhọrọ nrụpụta akpaaka

Pịgharịa gaa na nhọrọ nrụpụta akpaaka. Site na ndabara, a na-agbanyụ nke a, na ihe fọrọ nke nta ka ọ bụrụ kọmpụta niile na karịsịa sava na-agba ngwa ngwa na ma ọ bụ ọrụ raara onwe ya nye agaghị enwe nke a n'ihi na ọ na-ebutekarị nnukwu nkwụsị na ọrụ ngwanrọ ndị ahụ.

N'agbanyeghị, were ya na ọrụ gị na-ejere mmadụ ole na ole ozi. N'ọnọdụ ahụ, nhọrọ a nwere ike ịdị mma ịnwe ya. Sistemụ Linux/Ubuntu ga-amaliteghachi naanị n'ihi nkwalite Linux Kernel nke dị oke egwu, mana enwere m amamọkwa akpaaka maka mgbanwe. M ga-ama na ọ ga-achọ ime ma nwee ike ịhazi ya.

Ọmụmaatụ si:

// Automatically reboot *WITHOUT CONFIRMATION* if
//  the file /var/run/reboot-required is found after the upgrade
//Unattended-Upgrade::Automatic-Reboot "false";

Ọmụmaatụ na-agbanwe kwa:

// Automatically reboot *WITHOUT CONFIRMATION* if
//  the file /var/run/reboot-required is found after the upgrade
Unattended-Upgrade::Automatic-Reboot "true";

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Ọ bụrụ na ịmee nhọrọ ahụ, ị ​​nwere ike ịtọlitegharịa ya na ndị ọrụ abanyela ma ọ bụ na ha abanyeghị. Ekwesịrị inwe nkwarụ, ebe ndị ọrụ banyere na ịbụ ndị a na-amanye pụọ n'ihi nrụgharị nwere ike ime ka ọ kwụsị ọrụ na gburugburu ebe ọrụ, ọ bụghị ịkọwa nkụda mmụọ nke onye ọrụ ahụ banyere.

Otú ọ dị, ọ bụrụ na ị na-ahọrọ nke a:

Ọmụmaatụ si:

// Automatically reboot even if there are users currently logged in
// when Unattended-Upgrade::Automatic-Reboot is set to true
//Unattended-Upgrade::Automatic-Reboot-WithUsers "true";

Ọmụmaatụ na-agbanwe kwa:

// Automatically reboot even if there are users currently logged in
// when Unattended-Upgrade::Automatic-Reboot is set to true
Unattended-Upgrade::Automatic-Reboot-WithUsers "true";

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Ọ bụrụ na ị nwere obere ihe nkesa n'otu mpaghara oge ma mara oge dị mma ịmalitegharị, kwuo 2 am wee mezie ihe ndị a:

Ọmụmaatụ si:

// If automatic reboot is enabled and needed, reboot at the specific
// time instead of immediately
//  Default: "now"
//Unattended-Upgrade::Automatic-Reboot-Time "02:00";

Ọmụmaatụ na-agbanwe kwa:

// If automatic reboot is enabled and needed, reboot at the specific
// time instead of immediately
//  Default: "now"
Unattended-Upgrade::Automatic-Reboot-Time "02:00";

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Ndepụta ikpeazụ maka nkwalite-anaghị ele anya

Iji hụ na faịlụ nkwalite akpaka dị na ndekọ /etc/apt/apt.conf.d/ site na iji iwu ndị a:

cd /etc/apt/apt.conf.d
ls

Ihe atụ mmepụta:

ls
00CDMountPoint	      10periodic      20packagekit	     60icons
00trustcdrom	      15update-stamp  20snapd.conf	     70debconf
01autoremove	      20archive       50appstream
01autoremove-kernels  20listchanges   50unattended-upgrades

Ugbu a mepee faịlụ ahụ /etc/apt/apt.conf.d/20auto-upgrade:

sudo nano /etc/apt/apt.conf.d/20auto-upgrades

Ihe atụ mmepụta:

Ị ga-ahụ koodu iwu dị n'okpuru na faịlụ ndị a. Ọ bụrụ na ọ bụghị, detuo na mado:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

Site na ndabara, agbanyere ntọala “1”. Otú ọ dị, ọ bụrụ na ịchọrọ gbanyụọ ya, ị nwere ike ịgbanwe ya ka ọ bụrụ "0", Ọ bụrụ na ịchọghị ịlele kwa ụbọchị, gaa n'ihu ịgbanwe nọmba ka ọ bụrụ "2," nke na-eme ka nkwalite akpaka na-elele ụbọchị ọ bụla. Na ntuziaka anyị, dịka ọmụmaatụ, naanị anyị gbanwere ya ka ọ bụrụ 2. Anyị na-akwado ịhapụ ntọala a ka ọ bụrụ "1":

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Chekwaa faịlụ (Ctrl+O), mgbe ahụ pịa Y, emesia ịpụ apụ pịa (CTRL+X) ịhapụ onye ndezi ederede.


Advertisement


Mepụta Cronjob maka nkwalite-anaghị ele anya

Nhọrọ, ọ bụrụ na ịchọrọ ịchịkwa oge nke nkwalite akpaka gị, ị nwere ike ịmepụta cronjob. Iji mee nke a, nke mbụ, mepee crontab:

sudo crontab -e

Na-esote, tinye akara a na ala nke ntinye ikpeazụ; ị nwere ike gbanwee "oge" n'ụzọ ọ bụla masịrị gị. Ọ bụrụ na ị dị ọhụrụ na Linux, gaa na Crontab.Guru, nke ị nwere ike nweta enyemaka, mee ma nwalee oge ntọala cron.

N'okpuru ebe a ga-egosi na ị na-agba ọsọ kpọmkwem ụbọchị atọ ọ bụla, na 3:4 am.

Ihe Nlereanya:

00 04 * * */3 /usr/bin/unattended-upgrade -v

Ọmụmaatụ na gburugburu ebe obibi:

Otu esi eme ma hazie nkwalite Debian 11 na-adịghị ele anya

Chekwaa faịlụ (Ctrl+O), mgbe ahụ pịa Y, emesia ịpụ apụ pịa (CTRL+X) ịhapụ onye ndezi ederede.

Otu esi enweta ndekọ ndekọ nkwalite-anaghị ele anya

N'ikpeazụ, ọ bụrụ na ịchọrọ ịlele faịlụ ndekọ maka okwu ọ bụla na ịchọta njehie, ị nwere ike ịchọta ya n'ụzọ a:

/var/log/unattended-upgrades/

Advertisement


Ngwa ndị ọzọ – Lelee Malitegharịa ekwentị (Debian Goodies)

Mmemme mara mma maka ịlele ma ọ bụrụ na ịlaghachi na nkesa nke etinyere mmelite akpaka kama ịlele ndekọ ma ọ bụ ozi-e bụ iji mee ya. check malitegharịa iwu nke ahụ ga-agwa gị ma ọ bụrụ na ngwugwu ọ bụla chọrọ ịmalitegharịa.

Iji wụnye check malitegharịa, gbaa iwu a:

sudo apt install debian-goodies -y

Ugbu a gbaa iwu a ka ịlele maka ngwugwu chọrọ ịmalitegharị:

sudo checkrestart


Ihe atụ mmepụta:

Found 0 processes using old versions of upgraded files

Dị ka ị na-ahụ, igwe nkuzi na-eji eme ihe ọhụrụ; Otú ọ dị, ọ bụrụ na ihe ọ bụla chọrọ ịmalitegharị akwụkwọ ntuziaka, a ga-edepụta ya ebe a na mmepụta.

Okwu na mmechi

Ịtọlite ​​nkwalite na-adịghị ele anya bụ ọrụ dị oke mkpa nke ị na-etinye ego na ịtọlite. Dị ka akọwara na ntuziaka anyị, usoro ahụ nwere ọtụtụ nhọrọ iji kwado ihe fọrọ nke nta ka ọ bụrụ mkpa onye ọ bụla, na ọbụna mgbe ahụ, ị ​​nwere ike ime ụfọdụ ihe ndị dị n'èzí iji nwetakwuo nhọrọ, dịka ọmụmaatụ, na cronjob's.

Opekempe, ị ga-achọ ka ị na-agba ọsọ a kwa ụbọchị maka nchekwa na udo nke uche.

Idenye aha
Gwa nke
2 Comments
Inline nzaghachi
Lee echiche niile

Ndewo Joshua, ị nwere akara 'copy/paste':

Iji mee ka buut ọrụ ndị a na-adịghị ele anya:

sudo systemctl kwụsị nkwalite-enweghị nchekwube

ọ kwesịrị ịbụ: sudo systemctl mee ka nkwalite ndị na-adịghị ele anya

Daalụ maka ntuziaka gị ọ na-azọpụta m oge iji ya dị ka ihe ncheta na nrụtụ aka.

2
0
Ga-ahụ n'anya gị echiche, biko okwu.x