标签归档:Debian

Debian 开启 BBR 算法

1、修改系统变量

echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf

2、保存生效

sysctl -p

3、查看内核是否已开启BBR

sysctl net.ipv4.tcp_available_congestion_control

显示以下即已开启:

net.ipv4.tcp_available_congestion_control = bbr cubic reno

4、查看BBR是否启动

lsmod | grep bbr

显示以下即启动成功:

tcp_bbr                20480  1

Debian12 安装 PHP8.3

当前 Debian12 官方源中带的 PHP 版本是8.2,而 PHP8.2 的 Active Support 到今年年底(31 Dec 2024),所以直接装8.3吧,可以用的时间长一点。

首先安装sury源

#!/bin/sh
# To add this repository please do:
if [ "$(whoami)" != "root" ]; then
    SUDO=sudo
fi
${SUDO} apt-get update
${SUDO} apt-get -y install lsb-release ca-certificates curl
${SUDO} curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
${SUDO} dpkg -i /tmp/debsuryorg-archive-keyring.deb
${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update

注意,如果安装sury源时报错: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY B188E2B695BD4743,意思是系统缺少sury源的公钥。只要把公钥下载到系统就可以了,执行以下命令添加公钥:

wget -qO /etc/apt/trusted.gpg.d/sury-php.gpg https://packages.sury.org/php/apt.gpg

公钥添加完成后,执行apt update刷新包列表即可。

然后执行以下命令安装PHP8.3:

apt install -y php8.3-fpm php8.3-mysql php8.3-mbstring php8.3-curl php8.3-xml php8.3-imagick php8.3-zip php8.3-gd php8.3-intl php8.3-bcmath

如果需要支持 Laravel 框架,那么最后一个 bcmath 扩展是必须的。

Debian11 升级 Debian12

今天通过博客园首页链接购买了37块钱的天翼云,发现 Debian 最新版本只到11,那么就来升级一下吧。

1、更新当前系统apt updateapt full-upgrade,更新完后发现有一个包没有被升级0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.,执行apt list --upgradable -a看了一下,输出如下:

root@vm:~# apt list --upgradable -a
Listing... Done
base-files/oldstable 11.1+deb11u11 amd64 [upgradable from: 11.1+deb11u1]
base-files/now 11.1+deb11u1 amd64 [installed,upgradable to: 11.1+deb11u11]

应该是一个涉及核心系统的包,手动升级一下吧: apt-get install base-files

2、更新完成后,更换 Debian12 的源,首先备份当前源 mv /etc/apt/sources.list /etc/apt/sources.list.old,然后写入 Debian12 的源,这里用的是清华的源:

cat > /etc/apt/sources.list << EOF
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
EOF

3、继续更新系统apt updateapt full-upgrade,期间会有一些提示信息,根据需要选择。

更新完后,查看系统版本cat /etc/debian_version, 我这里显示的是12.7,嗯,最新版本 Debian 已经更新好了。

Debian 大版本升级还是一如既往的丝滑,从来没有让我失望过👍💖。

注:本文始发于我的博客园 https://www.cnblogs.com/art ,之后重新发于本站。

Debian 更换国内清华源

1、备份原文件 mv /etc/apt/sources.list /etc/apt/sources.list.old

2、写入新源,以下是 Debian 11 的:

cat > /etc/apt/sources.list << EOF
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
 
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
 
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
 
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free
EOF

如果是 Debian 12:

cat > /etc/apt/sources.list << EOF
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
EOF

注:

deb 指向的是编译好的二进制软件包。
deb-src 指向的是软件的源代码包,可以使用apt source命令下载软件的源代码并自行编译。

注:本文始发于我的博客园 https://www.cnblogs.com/art ,之后重新发于本站。

Debian 全局安装composer

在debian上安装compoer,以便能够在任何地方随时执行compoer命令,安装方法如下:

php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);” php composer-setup.php –install-dir=/usr/bin –filename=composer

rm -rf composer-setup.php

chmod +x /usr/bin/composer

composer –version

安装PHP 8.3

apt install php8.3-fpm php8.3-mysql php8.3-mbstring php8.3-curl php8.3-xml php8.3-imagick php8.3-zip php8.3-gd php8.3-intl php8.3-bcmath

对于Laravel 需要安装 apt install php8.3-bcmath

要把 php8.3-dom 换成 php8.3-xml

说明:需要通过sury源来安装

https://packages.sury.org/php/README.txt

#!/bin/sh# To add this repository please do:
if [ "$(whoami)" != "root" ]; then    SUDO=sudofi
${SUDO} apt-get update${SUDO} apt-get -y install lsb-release ca-certificates curl${SUDO} curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb${SUDO} dpkg -i /tmp/debsuryorg-archive-keyring.deb${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'${SUDO} apt-get update

或:

apt install apt-transport-httpscurl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpgsh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'apt update

https://wiki.crowncloud.net/?How_to_Install_PHP_8_3_on_Debian_11

Debian 小版本升级时配置文件的问题

debian进行小版本升级时,有时会提示配置文件是使用最新版本,还是保持本地的版本,此时最好选择保持本地的版本,因为有一些配置信息在里面了;如果选择升级到最新的配置文件版本,那么之前的一些配置信息可能就被覆盖了。

Virtualbox Debian 配置共享文件夹

首先配置共享文件夹,如下图所示:

然后进入虚拟机系统,会在/mnt下面看到share文件夹,此时,如果进入文件提示没有权限,可以通过下面的方法解决:

在终端执行下面的命令:

sudo adduser $USER vboxsf

然后重启 sudo reboot

重启后即可进入共享文件夹。