突突唧之家

我的疑问 & 我的解决方案

Ubuntu 多次升级以后系统中会存在大量不同版本的内核,而每个内核占用非常多的硬盘空间,所以需要定期清理没用的内核,但最好保留最近两个内核,因为有的软件需要依赖特定内核而不一定是最新的。

首先查询当前我们使用的是内核是哪个版本的:

uname -a

查询系统中装了哪些内核:

dpkg --get-selections | grep linux

多余的内核可以通过命令删除:

apt remove <内核文件名称>

执行完上面命令后接着执行以下命令查看内核是否都删除干净了:

dpkg --get-selections | grep linux

如果没干净继续删除。有的内核后面会显示是 deinstall ,那需要通过:

dpkg --get-selections | grep deinstall | sed 's/deinstall/\lpurge/' | dpkg --set-selections; dpkg -Pa

进行删除。

本镜像仅包含 32/64 位 x86 架构处理器的软件包,在 ARM(arm64, armhf)、PowerPC(ppc64el)、RISC-V(riscv64) 和 S390x 等架构的设备上(对应官方源为ports.ubuntu.com)请使用 ubuntu-ports 镜像

Ubuntu 的软件源配置文件是 /etc/apt/sources.list。将系统自带的该文件做个备份,将该文件替换为下面内容,即可使用 TUNA 的软件源镜像。

因镜像站同步有延迟,可能会导致生产环境系统不能及时检查、安装上最新的安全更新,不建议替换 security 源。

22.04 LTS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
阅读全文 »

先执行:

uname -r

看看内核版本是不是 ≥ 4.9 ,如果不是需要先升级内核。

如果满足条件,执行:

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

然后验证开启状态,执行:

sysctl net.ipv4.tcp_available_congestion_control
sysctl net.ipv4.tcp_congestion_control

如果结果都有 bbr ,则证明你的内核已成功开启 BBR !

此外,执行:

lsmod | grep bbr

看到有 tcp_bbr 模块也可说明 BBR 已启动。

问题描述

升级 OpenSSL 后 Shadowsocks 可能无法启动,报错如下:

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
Traceback (most recent call last):
File "/usr/bin/ssserver", line 9, in
load_entry_point('shadowsocks==2.8.2', 'console_scripts', 'ssserver')()
File "/usr/lib/python2.7/site-packages/shadowsocks/server.py", line 34, in main
config = shell.get_config(False)
File "/usr/lib/python2.7/site-packages/shadowsocks/shell.py", line 262, in get_config
check_config(config, is_local)
File "/usr/lib/python2.7/site-packages/shadowsocks/shell.py", line 124, in check_config
encrypt.try_cipher(config['password'], config['method'])
File "/usr/lib/python2.7/site-packages/shadowsocks/encrypt.py", line 44, in try_cipher
Encryptor(key, method)
File "/usr/lib/python2.7/site-packages/shadowsocks/encrypt.py", line 83, in __init__
random_string(self._method_info[1]))
File "/usr/lib/python2.7/site-packages/shadowsocks/encrypt.py", line 109, in get_cipher
return m[2](method, key, iv, op)
File "/usr/lib/python2.7/site-packages/shadowsocks/crypto/openssl.py", line 76, in __init__
load_openssl()
File "/usr/lib/python2.7/site-packages/shadowsocks/crypto/openssl.py", line 52, in load_openssl
libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
File "/usr/lib64/python2.7/ctypes/__init__.py", line 373, in __getattr__
func = self.__getitem__(name)
File "/usr/lib64/python2.7/ctypes/__init__.py", line 378, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/local/ssl/lib/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup
shadowsocks start failed
阅读全文 »

该文章内容已过期不再适用

gdrive 是一个好用的 Linux 平台 Google Drive 客户端。

安装 gdrive

wget -O /usr/bin/gdrive "//docs.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA&export=download"
chmod +x /usr/bin/gdrive

授权

gdrive about

然后会出现一个网址并询问验证码。将地址粘贴到浏览器并登录账号,会返回一串代码。

将代码粘贴到控制台下,然后会返回你的 Google 账户信息。

gdrive 会自动将你的 token 保存在用户目录下的 .gdrive 目录中,所以如果不需要了记得把这个文件删掉。

使用

gdrive help

可以查看帮助。

下载 PHP

http://windows.php.net/download/ 下载 Non Thread Safe 版 PHP 并解压到你希望安装的位置。

添加模块映射

进入 控制面板 > 系统和安全 > 管理工具 > Internet信息服务(IIS)管理器。中间窗口打开“处理程序映射”,然后最右边打开“添加模块映射”,按图中步骤填写相关信息。

阅读全文 »