如何在 Debian 11 上安装 MongoDB

一、介绍

MongoDB是一个NoSQL数据库应用程序,用于将数据作为类似JSON的文档存储在服务器上。MongoDB拥有现代化的基础设施,具有各种服务,同时具有延展性和友好性,为开发人员及其代码提供了自由。

  • 跨平台
  • 可选架构
  • 各种安全和加密功能
  • 易于实施

本指南将解释如何在 Debian 11 实例上安装和配置 MongoDB 基础知识。

二、准备工作

  • 部署 Debian 11 实例。
  • 使用 sudo 用户登录到实例。

三、安装 MongoDB

安装用于安装 MongoDB 的其他软件包。

$ sudo apt install gnupg2 wget

添加 MongoDB 公共 GPG 密钥。

$ wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -

将 MongoDB 的存储库添加到您的实例中。

$ echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

更新您的实例。

$ sudo apt update

安装 MongoDB。

$ sudo apt install mongodb-org

验证 MongoDB 是否已成功安装。

$ mongod --version



db version v5.0.6

    Build Info: {

        "version": "5.0.6",

        "gitVersion": "212a8dbb47f07427dae194a9c75baec1d81d9259",

        "openSSLVersion": "OpenSSL 1.1.1k  25 Mar 2021",

        "modules": [],

        "allocator": "tcmalloc",

        "environment": {

        "distmod": "debian10",

        "distarch": "x86_64",

        "target_arch": "x86_64"

    }

}

启动 MongoDB 服务。

$ sudo systemctl start mongod

启用 MongoDB 以在实例启动时启动。

$ sudo systemctl enable mongod

 四、创建新用户

在MongoDB的环境中创建用户对于在特定数据库中授权自己和访问MongoDB中的功能非常简单有用。

输入MongoDB的shell,Mongosh。您可以连接到MongoDB部署。但是,在本指南中,我们将连接到在本地主机上运行的MongoDB实例。

$ sudo mongosh

默认情况下,您将使用测试数据库。您可以通过输入Mongosh来显示您正在使用的数据库。让我们将数据库切换到管理数据库。db

$ use admin

要创建新用户,请在 Mongosh 中输入此代码块。您可以添加自己唯一的用户名和密码

db.createUser(

    {

        user: "Vultr",

        pwd:  "topSecret1",

        roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]

    }

)

成功创建新用户后,Mongosh 会提示以下输出。

{ ok: 1 }

显示数据库上的可用用户。

> show users

[

    {

        _id: 'admin.Vultr',

        userId: UUID("697f43de-6542-4a3c-b846-fbb3ad9f766b"),

        user: 'Vultr',

        db: 'admin',

        roles: [ { role: 'userAdminAnyDatabase', db: 'admin' } ],

        mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]

    }

 ]

您可以通过按 + 两次、+ 或输入 Mongosh 来退出 Mongosh。CTRLCCTRLD.exit

五、启用数据库身份验证

MongoDB的标准是在使用数据库时禁用身份验证。为了保护您的数据库,在MongoDB中启用用户身份验证至关重要。

使用所需的文本编辑器输入MongoDB配置文件。

$ sudo nano /etc/mongod.conf

将此代码块粘贴到 MongoDB 配置文件中以启用身份验证。

security:

 authorization: enabled

保存并退出配置文件,然后重新启动MongoDB。

$ sudo systemctl restart mongod

输入Mongosh与您的用户名和密码。

$ sudo mongosh -u Vultr -p topSecret1

成功进行身份验证后,Mongosh 会提示以下输出。

Current Mongosh Log ID: 61fff39bf56ab6dd6b893038

Connecting to: mongodb://127.0.0.1:27017/directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.1.9

Using MongoDB:          5.0.6

Using Mongosh:          1.1.9



For mongosh info see: https://docs.mongodb.com/mongodb-shell/



> 

在 Debian 或 Ubuntu 上使用 ProFTPd 安装 FTP 服务器

一、准备工作

  • 新部署的 Vultr Debian 或 Ubuntu 服务器实例。
  • 用户。

二、安装

更新系统。

sudo apt-get update

sudo apt-get dist-upgrade

安装。proftpd

sudo apt-get install proftpd

在安装过程中,系统会询问您是否要安装 inormode。选择模式。inetdstandalonestandalone

三、配置

打开 Proftpd 配置文件。

sudo nano /etc/proftpd/proftpd.conf

该文件将类似于以下文本。

#

# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.

# To really apply changes, reload proftpd after modifications, if

# it runs in daemon mode. It is not required in inetd/xinetd mode.

#



# Includes DSO modules

Include /etc/proftpd/modules.conf



# Set off to disable IPv6 support which is annoying on IPv4 only boxes.

UseIPv6                         on

# If set on you can experience a longer connection delay in many cases.

IdentLookups                    off



ServerName                      "Debian"

ServerType                      standalone

DeferWelcome                    off



MultilineRFC2228                on

DefaultServer                   on

ShowSymlinks                    on



TimeoutNoTransfer               600

TimeoutStalled                  600

TimeoutIdle                     1200



DisplayLogin                    welcome.msg

DisplayChdir                    .message true

ListOptions                     "-l"



DenyFilter                      \*.*/



# Use this to jail all users in their homes

# DefaultRoot                     ~



# Users require a valid shell listed in /etc/shells to login.

# Use this directive to release that constrain.

RequireValidShell               off



# Port 21 is the standard FTP port.

Port                            21

...

2.2、主要配置指令

  • ServerName:指定 FTP 服务器的名称。当客户端连接到服务器时,将显示此名称。
  • TimeoutIdle:如果客户端在 FTP 服务器上不再处于活动状态,则客户端将自动断开连接的时间(以秒为单位)。
  • DefaultRoot:控制登录时分配给用户的默认根目录。
  • Port:FTP 服务器的连接端口。几乎在所有时间,此端口都存在,除非您被防火墙阻止,否则您不必更改它。21
  • PassivePorts:限制服务器从客户端发送命令时将从中选择的端口范围。PASV
  • MaxInstances:您希望在 FTP 服务器上允许的最大同时连接数。

现在,我们必须激活该选项。为此,请找到“注释”行并取消注释。DefaultRootDefaultRoot

DefaultRoot                     ~

该值意味着用户将被限制为个人文件夹(例如)。~/home/user12

注意:默认情况下,连接到 FTP 服务器的人可以访问所有服务器文件夹,因此建议启用该选项。DefaultRoot

改变的。ServerName

ServerName : the name of your FTP server

查找并取消注释以下行(删除每行开头的行),以允许匿名连接到您的服务器。#

# A basic anonymous configuration, no upload directories.



 <Anonymous ~ftp>

   User                         ftp

   Group                        nogroup

   # We want clients to be able to login with "anonymous" as well as "ftp"

   UserAlias                    anonymous ftp

   # Cosmetic changes, all files belongs to ftp user

   DirFakeUser  on ftp

   DirFakeGroup on ftp



   RequireValidShell            off



   # Limit the maximum number of anonymous logins

   MaxClients                   10



   # We want 'welcome.msg' displayed at login, and '.message' displayed

   # in each newly chdired directory.

   DisplayLogin                 welcome.msg

   DisplayFirstChdir            .message



   # Limit WRITE everywhere in the anonymous chroot

   <Directory *>

     <Limit WRITE>

       DenyAll

     </Limit>

   </Directory>

 </Anonymous>

: 如果在 FTP 服务器上启用匿名连接,则任何用户都可以连接到该服务器。他们将有权访问目录,并且能够读取和下载文件,但不能修改或添加文件。/home/ftp

您可以通过添加以下行来禁止根用户访问 FTP。

RootLogin off

更改配置后,重新启动服务器。

sudo service proftpd restart

注意:如果错误行显示为“无法解析主机”,请注意这无关紧要,您可以忽略它。

三、添加 FTP 用户

添加用户,例如“”。myuser

useradd --shell /bin/false myuser

创建用户 “” 的主目录。myuser

mkdir /home/myuser

将该目录的所有权更改为用户和组 “”。myuser

chown myuser:myuser /home/myuser/

为用户“”设置密码。myuser

passwd myuser

使用设置好的用户名和密码连接上即可。

Debian 10 扩容磁盘

由于 VPS 磁盘不够用了,所以扩容了磁盘,但分区表还没更新,所以看不到增加的部分,需要手动更新分区。

先重新分区:

fdisk /dev/sda

输入 o
输入 n
输入 p
输入 1
最后输入 w 保存

然后查看 blkid 并修改 initramfs:

sudo blkid

sudo vim /etc/initramfs-tools/conf.d/resume

sudo update-initramfs -u

重新安装 grub

grub-install /dev/sda

update-grub

重启设备。

resize2fs /dev/sda1 就可以了。

在 Debian 11 上使用 Django 和 Nginx、PostgreSQL 和 Gunicorn

一、介绍

Django是一个免费的开源 Python Web 框架。本文提供了在 Debian 11 服务器上使用 Nginx、Gunicorn 和免费的 Let’s Encrypt TLS 证书设置 Django 项目的分步指南。

二、准备工作

  • 在 Vultr 部署新的Debain 11 服务器
  • 创建 sudo 用户。示例用户是django_user
  • 更新服务器
  • 将域名指向服务器。让我们加密 SSL/TLS 证书需要域名。本指南使用顶级域example.com和完全限定域名mydjango.example.com,并假定为这两个名称分配了相同的 IP 地址。

三. 安装依赖项

  1. 通过 SSH 使用非 root sudo 用户登录到服务器。
    $ ssh django_user@mydjango.example.com
  2. 安装,,并使用 apt 包管理器。UFWVimNginx
    $ sudo apt -y install ufw vim nginx
  3. 允许所有出站流量。
    $ sudo ufw default allow outgoing
  4. 阻止除 SSH(端口 22)、HTTP(端口 80)和 HTTPS(端口 443)之外的所有入站流量。
    $ sudo ufw default deny incoming
    
    $ sudo ufw allow ssh
    
    $ sudo ufw allow http
    
    $ sudo ufw allow https
  5. 启用并重新加载。UFW
    $ sudo ufw enable
    
    $ sudo ufw reload

四、安装 PostgresSQL

  1. 使用 apt 包管理器安装 PostgreSQL,在安装过程中会创建一个 postgres 用户。
    $ sudo apt install -y postgresql postgresql-contrib
  2. 切换到 postgres 用户。
    $ sudo su - postgres
  3. 登录到PostgresSQL。
    $ psql
  4. 为 Django 项目创建一个 PostgresSQL 数据库角色。
    postgres=# CREATE ROLE dbuser WITH LOGIN;
  5. 为角色设置密码。dbuser
    postgres=# \password dbuser
  6. 塞滕编码到。dbuserUTF-8
    postgres=# ALTER ROLE dbuser SET client_encoding TO 'utf8';
  7. 将默认事务隔离设置为读取提交。dbuser
    postgres=# ALTER ROLE dbuser SET default_transaction_isolation TO 'read committed';
  8. 将时区设置为。dbuserUTC
    postgres=# ALTER ROLE dbuser SET timezone TO 'UTC';
  9. 创建 Django 项目数据库。
    postgres=# CREATE DATABASE appdb;
  10. 授予所有权限。dbuserappdb
    postgres=# GRANT ALL PRIVILEGES ON DATABASE appdb TO dbuser;
  11. 退出 postgres 客户端。
    postgres=# \q
  12. 出口到须藤
    exit
  13. 重新启动 PostgresSQL 服务器。
    $ sudo systemctl restart postgresql

五、 设置 Python 环境

部署 Python Web 应用程序时应使用 Python 虚拟环境。

  1. 安装蟒蛇。venv
    $ sudo apt -y install python3-venv
  2. 创建应用程序目录、虚拟环境所在的位置以及应用程序文件。例。切换到主目录。app_dir
    $ cd ~

    创建目录。

    $ mkdir app_dir
  3. 更改为并创建虚拟环境。app dir
    $ cd app_dir
    
    $ python3 -m venv venv
  4. 激活虚拟环境。
    $ source venv/bin/activate
  5. 安装 Python PostgresSQL 库而不是,因为在安装过程中需要构建。psycopg2-binarypsycopg2psycopg2
    $ pip install psycopg2-binary
  6. 安装 Django 和 Gunicorn。
    $ pip install django gunicorn

六、 上传或创建 Django 项目

  1. 项目源码需要用 git 或者 scp 上传到 app 目录下,对于本文,创建一个名为的示例项目。app_direxample_app
    $ django-admin startproject example_app .
  2. 检查文件夹结构。app_dir
    $ ls
    
    example_app manage.py venv
  3. 创建一个文件夹来将 Django 项目的静态文件保存在应用程序文件夹中。
    $ mkdir static
  4. 打开 inwith以配置项目。settings.pyexample_appVim
    $ vim example_app/settings.py
  5. 配置域的允许主机。
    ALLOWED_HOSTS = ['mydjango.example.com']
  6. 使用创建自的详细信息配置变量。DATABASESsection 2
    DATABASES = {
    
        "default" : {
    
            "ENGINE" : "django.db.backends.postgresql",
    
            "NAME" : "appdb",
    
            "USER" : "dbuser",
    
    
    
            "PASSWORD" : "dbpassword",
    
    
    
            "HOST" : "127.0.0.1",              
    
            "PORT" : "5432",
    
    
    
            }
    
    }
  7. 设置静态文件夹路径。在它下面寻找添加。STATIC_URLSTATIC_ROOT
    STATIC_ROOT = "/home/django_user/app_dir/static"
  8. 保存并关闭文件。settings.py
  9. 创建项目迁移。
    $ python manage.py makemigrations
  10. 运行迁移。
    $ python manage.py migrate
  11. 将项目的所有静态文件复制到静态文件夹。类型出现提示时。yes
    $ python manage.py collectstatic
  12. 为项目创建管理员用户。
    $ python manage.py createsuperuser
  13. 允许波顿。8000UFW
    $ sudo ufw allow 8000
  14. 测试项目以确保其运行没有错误。
    $ python manage.py runserver 0.0.0.0:8000
    
    
    
    Watching for file changes with StatReloader
    
    Performing system checks...
    
    
    
    System check identified no issues (0 silenced).
    
    November 16, 2022 - 21:19:26
    
    Django version 4.1.3, using settings 'example_app.settings'
    
    Starting development server at http://0.0.0.0:8000/
    
    Quit the server with CONTROL-C.

 七、配置独角兽

将创建一个 Gunicorn 服务来为项目提供服务,并在服务器重新启动时启动项目。

  1. 测试Gunicorn,看看它是否可以毫无错误地为项目服务。
    $ gunicorn --bind 0.0.0.0:8000 example_app.wsgi
  2. 按+停止它。CTRLC
  3. 停用虚拟环境
    $ deactivate
  4. 编辑文件。settings.pyVim
    $ vim example_app/settings.py
  5. 禁用调试。查找变量并将其设置为。DEBUGFalse
    DEBUG = False
  6. 保存并关闭文件。settings.py
  7. 拒绝端口 8000 的传入流量。UFW
    $ sudo ufw deny 8000
  8. 在目录中创建一个文件。django_app.service/etc/systemd/system
    $ sudo vim /etc/systemd/system/django_app.service
  9. 将以下内容写入文件。
    [Unit]
    
    
    
    Description=Gunicorn for the Django project
    
    After=network.target
    
    
    
    [Service]
    
    
    
    User=django_user
    
    Group=www-data
    
    
    
    
    
    WorkingDirectory=/home/django_user/app_dir
    
    Environment="PATH=/home/django_user/app_dir/venv/bin"
    
    ExecStart=/home/django_user/app_dir/venv/bin/gunicorn --workers 2 --bind unix:django_app.sock example_app.wsgi
    
    
    
    
    
    [Install]
    
    
    
    WantedBy=multi-user.target
    • 下,设置服务的用户,并将服务的组设置为 Nginx 组。[Service]USER=django_userGroup=www-data
    • WorkingDirectory=/home/django_user/app_dir将服务工作目录设置为“项目”文件夹。
    • Environment="PATH=/home/django_user/app_dir/venv/bin"设置服务应使用的虚拟环境。
    • ExecStart=/home/django_user/app_dir/venv/bin/gunicorn --workers 2 --bind unix:django_app.sock example_app.wsgi为项目运行 Gunicorn worker 服务,并将它们绑定到 Unix 套接字,以便更快地交换 Nginx 代理服务器的数据。
  10. 保存并关闭文件。
  11. 使服务能够在启动时启动。
    $ sudo systemctl enable django_app
  12. 启动服务。
    $ sudo systemctl start django_app

八、配置云

需要一个Nginx代理服务器来为生产中的Django应用程序提供服务并处理SSL证书。

  1. 通过创建文件在 Nginx 中配置服务器块。django_app/etc/nginx/sites-available
    $ sudo vim /etc/nginx/sites-available/django_app
  2. 将以下内容写入文件。
    server {
    
        # listen to port 80 (HTTP)
    
        listen 80;
    
        # listen to the domain name
    
        server_name example.com mydjango.example.com;
    
    
    
        location /static/ {
    
            alias /home/django_user/app_dir/static/;
    
            expires max;
    
        }
    
    
    
        location / {
    
            include proxy_params;
    
    
    
            # pass the request to the project service sock
    
            proxy_pass http://unix:/home/django_user/app_dir/django_app.sock;
    
        }
    
    }
  3. 保存并关闭文件。
  4. 为Nginx创建一个链接。django_appsites-enabled
    $ sudo ln -s /etc/nginx/sites-available/django_app /etc/nginx/sites-enabled
  5. 检查 Nginx 配置是否有任何错误。
    $ sudo nginx -t
  6. 重新启动 Nginx 服务器。
    $ sudo systemctl reload nginx

九、(可选)使用加密添加 HTTPS

如果您在开始时配置了域,则可以使用Let’s Encrypt添加SSL / TLS证书以提供HTTPS支持。

  1. 使用插件安装。CertbotNginx
    $ sudo apt install certbot python3-certbot-nginx
  2. 配置方式。CertbotNginx
    $ sudo certbot --nginx -d example.com -d mydjango.example.com

    首次运行 Certbot 时,将请求证书的管理员电子邮件。Certbot还将配置Nginx,并通过配置服务器块将所有HTTP请求重定向到HTTPS。

    Saving debug log to /var/log/letsencrypt/letsencrypt.log
    
    Plugins selected: Authenticator nginx, Installer nginx
    
    Enter email address (used for urgent renewal and security notices)
    
     (Enter 'c' to cancel): me@example.com
    
    
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    
    Please read the Terms of Service at
    
    https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
    
    agree in order to register with the ACME server. Do you agree?
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    
    (Y)es/(N)o: y
    
    
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    
    Would you be willing, once your first certificate is successfully issued, to
    
    share your email address with the Electronic Frontier Foundation, a founding
    
    partner of the Let's Encrypt project and the non-profit organization that
    
    develops Certbot? We'd like to send you email about our work encrypting the web,
    
    EFF news, campaigns, and ways to support digital freedom.
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    
    (Y)es/(N)o: y
    
    Account registered.
    
    Requesting a certificate for example.com and mydjango.example.com
    
    Performing the following challenges:
    
    http-01 challenge for example.com
    
    http-01 challenge for mydjango.example.com
    
    Waiting for verification...
    
    Cleaning up challenges
    
    Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/django_app
    
    Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/django_app
    
    Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/django_app
    
    Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/django_app
    
    
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    
    Congratulations! You have successfully enabled https://example.com and
    
    https://mydjango.example.com
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    
    Subscribe to the EFF mailing list (email: me@example.com).
    
    
    
    IMPORTANT NOTES:
    
     - Congratulations! Your certificate and chain have been saved at:
    
       /etc/letsencrypt/live/example.com/fullchain.pem
    
       Your key file has been saved at:
    
       /etc/letsencrypt/live/example.com/privkey.pem
    
       Your certificate will expire on 2023-02-15. To obtain a new or
    
       tweaked version of this certificate in the future, simply run
    
       certbot again with the "certonly" option. To non-interactively
    
       renew *all* of your certificates, run "certbot renew"
    
     - If you like Certbot, please consider supporting our work by:
    
    
    
       Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
    
       Donating to EFF:                    https://eff.org/donate-le
  3. 重新启动。Nginx
    $ sudo systemctl reload nginx
  • 在浏览器中访问服务器的域。mydjango.example.com/admin

你现在在 Debian 11 上有一个可以工作的 Django 站点。

Debian11为 vim 启用鼠标复制粘贴

最近发现在 Debian 11 系统下使用 apt 安装的 vim 是没办法正常使用鼠标左右键来复制粘贴的。

具体表现为:在使用 vim 编辑文件时按下鼠标右键后会进入如下图所示的“可视化(VISUAL)模式”,而不是正常的“弹出鼠标右键菜单”。

解决方案

经过查找资料后发现原来这是因为在 Debian11 下 vim8.0 的默认配置中有一项 set mouse=a 开启了所有模式的 mouse 支持导致的( vim 的鼠标模式是个很神奇的东西,有兴趣的可以去了解一下,这里主要解决复制粘贴问题,不再过多赘述)。

找到了问题所在后要解决就很简单了,手动添加鼠标配置项覆盖它的默认设置即可。我们这里是通过去除默认设置的鼠标模式“a”来实现的,你也可以尝试将鼠标模式设置为其他项。

编辑 vim 配置文件(文件不存在时新建一个就行):

vim /etc/vim/vimrc.local

然后在文件中添加如下配置项(注意 source 这一行的功能是加载默认配置,不同系统的文件路径可能不同,比如 Debian10 是 .../vim81/defaults.vim,一定要先确定该文件路径存在再写入,否则可能会导致 vim 无法正常使用):这里编辑的是 vim 的自定义全局配置文件,单独修改用户个人的 vim 配置文件(~/.vimrc)也可以。

  1. source /usr/share/vim/vim80/defaults.vim
  2. let skip_defaults_vim = 1
  3. if has(‘mouse’)
  4. set mouse-=a
  5. endif

保存文件并退出后,即可正常右键复制黏贴!

Debian升级通用方法

注意跨版本升级有一定危险性,请先备份重要数据,然后暂时停止运行中的环境服务,例如 php server 等等。

更新方法

1. 先将当前版本升级为最新版。

  1. apt-get update
  2. apt-get upgrade

2. 修改源。

vim /etc/apt/sources.list

将所有的 wheezy 改成 jessie

  1. #
  2.  
  3. # deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130504-14:43]/ wheezy main
  4.  
  5. #deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130504-14:43]/ wheezy main
  6.  
  7. deb http://ftp.debian.org/debian/ jessie main
  8. deb-src http://ftp.debian.org/debian/ jessie main
  9.  
  10. deb http://security.debian.org/ jessie/updates main
  11. deb-src http://security.debian.org/ jessie/updates main
  12.  
  13. # wheezy-updates, previously known as 'volatile'
  14. deb http://ftp.debian.org/debian/ jessie-updates main
  15. deb-src http://ftp.debian.org/debian/ jessie-updates main

3. 执行升级。

  1. apt-get update
  2. apt-get upgrade
  3. apt-get dist-upgrade

在执行命令过程中,会有文件冲突,提示是否保持当前版本,一律输入 Y 使用新版。假如遇到 db5.1-util 未升级,则再执行一次 apt-get dist-upgrade 即可。

4. 删除无用组件。

  1. aptget autoremove

5. 重启系统:

reboot

6. 删除无用内核:

apt purge linux-image-3.2.0-4-amd64 -y

更新完成。