===============
== 白菜林 ==
===============
一个勤奋的代码搬运工!

在 Mac 系统中制作 Debian U盘启动盘

bootable u盘启动 debian MacOS
在Mac系统中制作U盘启动盘 Create a Bootable USB Flash Drive 在Mac系统中,制作Linux启动盘不需要额外下载任何的工具,办法如下 下载 Debian DVD 镜像文件 通过 HTTP/FTP 下载 Debian CD/DVD 映像 https://www.debian.org/CD/http-ftp/ amd64 DVD版 https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/ 格式化USB盘 打开系统自带的磁盘管理工具,插上U盘,格式化U盘,选择格式如下: 格式:Mac OS 扩展(日志式) 方案:GUID 分区图 取消Usb磁盘挂载 # 终端执行以下命令 # 列出磁盘,找到你usb硬盘的盘符 diskutil list # 输出如下:可以看到usb硬盘为/dev/disk2 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *32.0 GB disk2 1: 0xEF 6.4 MB disk2s2 # 取消usb硬盘的挂载 diskutil unmountDisk /dev/disk2 导入镜像 # 执行如下命令 # if是镜像文件路径 # of是导入的目的磁盘 # bs是读写快的大小,太小会增大io,降低效率,一般1m~2m即可。 sudo dd if=~/Downloads/debian-11. Read more...

Debian 安装 Transmission 并实现远程访问

debian transmission bt
Debian 安装完成后的桌面环境带有 transmission-gtk 这个gui版关闭界面后,无后台服务,导致不能方便使用远程访问。 那么安装Transmission后台守护程序 $ sudo apt install -y transmission-daemon #停止Transmisson后台服务 systemctl stop transmission-daemon.service #修改配置文件 nano /etc/transmission-daemon/settings.json 启动Transmission后台服务 #启动transmission服务 systemctl start transmission-daemon.service #停止transmission服务 systemctl stop transmission-daemon.service #查询transmission运行状态 systemctl status transmission-daemon.service #将transmission设置为开机自启动 systemctl enable transmission-daemon.service #关闭transmission开机自启 systemctl disable transmission-daemon.service

Debian 安装慢的解决方案

debian linux
解决 Debian 安装过程慢的可行方案: 如果使用的是Dvd版的iso镜像,可以在安装前拔掉网线,通过离线安装,会非常快。 安装时选择 expert,不要选择 安全更新。 安装过程修改软件源。 Debian DVD-1 镜像下载地址 通过 HTTP/FTP 下载 Debian CD/DVD 映像 https://www.debian.org/CD/http-ftp/ amd64 DVD版 https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/ Debian 安装过程中 修改软件源中的安全源地址 在Debian安装步骤进入到选择安装的桌面环境和软件时, 键入 Ctrl+Alt+F2 可以看到从图形界面转到了tty命令终端, 键入 Enter 这里修改软件源配置文件 nano /target/etc/apt/sources.list 修改debian-security源地址 http://mirrors.ustc.edu.cn 目测最快 #deb http://security.debian.org/debian-security bullseye-security main deb http://mirrors.ustc.edu.cn/debian-security bullseye-security main 修改后 Ctrl+X 退出保存 然后退出终端重新进入界面继续安装,键入 Ctrl+Alt+F5 Debian 安装完成后更新硬件驱动 在设置——》关于——〉更新——》软件源,去掉cdrome的源,勾选合适的源 然后通过 dmesg 查看启动日志。 查找哪些固件加载异常,根据情况安装驱动(比如我的缺失显卡驱动和无线网卡驱动)。 # 更新源 sudo apt-get update dmesg # demsg查看到 缺失显卡驱动 sudo apt-get install firmware-amd-graphics # demsg查看到 缺失 rtl8168e-3. Read more...

安装docker

Docker Debian
运行环境 Operating System: Debian GNU/Linux 11 (bullseye) Kernel: Linux 5.10.0-18-amd64 Architecture: x86-64 通过Debian官方软件仓库安装 # 更新软件源 并 安装 docker及相关应用 sudo apt update && sudo apt install -y docker docker.io docker-compose # 查看docker运行状态 sudo systemctl status docker # 查看docker信息 sudo docker info # 验证是否安装成功 sudo docker run hello-world 镜像加速器 访问 https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors 获取自己的阿里云镜像加速器地址 修改 /etc/docker/daemon.json sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "max-concurrent-downloads": 3, "max-concurrent-uploads": 3, "max-download-attempts": 3, "registry-mirrors": ["https://修改为自己的.mirror.aliyuncs.com","https://hub-mirror.c.163.com","https://registry.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker 清理docker对象 prune 命令用来删除不再使用的 docker 对象。 Read more...

nginx 启用目录索引,显示文件列表

nginx
在nginx中,如果特定目录中没有index.html 文件,则默认会返回 404 Not Found 的错误。 但是,Nginx 自动索引模块—— ngx_http_autoindex_module 模块,提供了一种自动生成列表的方法,添加自动索引非常容易,使用 autoindex on 即可。下面的配置,将在访问特定请求时返回目录结构。 官方参考: http://nginx.org/en/docs/http/ngx_http_autoindex_module.html server { listen 80; ... ... location /index_dir { autoindex on; } } 除了简单地使用自动索引打开或关闭之外,还可以对其做其他的配置,包括: autoindex_exact_size; 显示输出的确切文件大小,还是最接近的KB,MB或GB。默认为on,显示出文件的确切大小,单位是bytes。改为off后,显示出文件的大概大小,单位是kB或者MB或者GB。 autoindex_format; 该指令指定Nginx索引列表应以什么格式输出。该指令有4个选项:html/xml/json/jsonp。 autoindex_localtime; 显示的文件时间为GMT时间。 注意:改为on后,显示的文件时间为文件的服务器时间。 使用这几个配置后配置内容类似于如下内容: location /index_dir/ { root /data/index_dir/; autoindex on; autoindex_exact_size off; autoindex_format html; autoindex_localtime on; } 如果有中文目录的话会出现乱码问题,所以还需要在下面添加这一句: charset utf-8; 或 charset utf-8,gbk;

PostgresSQL 基本用法:新建数据库、用户、连接、备份/恢复数据库

postgres
系统环境: Debian 11 切换到超级用户: sudo su postgres 进入psql: psql 创建一个用户: CREATE USER username WITH PASSWORD 'password'; 查看角色列表: \du 创建数据库并制定所有者和编码: CREATE DATABASE dbname WITH OWNER username ENCODING UTF8; 创建一个数据库: CREATE DATABASE dbname; 查看数据库列表: \l 更改刚创建的数据库所有权: ALTER DATABASE dbname OWNER TO username; 通过psql连接数据库 psql -h 127.0.0.1 -p 5432 -U username -d dbname 备份数据库 pg_dump dbname > dbname.dump 恢复数据库 psql -f dbname.dump -d dbname

查看 Debian 系统版本的方式

debian
查看 Dibian 系统发行版本号的方式 1. 使用 lsb_release 命令 lsb_release 命令可用于查看 Linux 发行版操作系统的具体版本。它可能尚未安装在你的操作系统中,因此你需要先安装它。运行以下命令来安装 lsb_release: apt-get install lsb-release 安装完成之后,只需要输入下面的命令就可以查看到你当前系统的版本信息: lsb_release -a 你将看到类似下面的结果: No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye 以上运行结果说明当前使用的操作系统版本是 Debian 11. 2. 查看 /etc/issue 文件 第二种查看当前 Debian 版本的方法是查看位于 /etc 目录中的 issue 文件。你可以使用 cat 命令查看文件的内容,输入下面的命令: cat /etc/issue 你将看到类似下面的结果: Debian GNU/Linux 11 \n \l 3. 查看 /etc/os-release 文件 /etc/os-release 是一个包含操作系统标识数据的文件,它只能在运行 systemd 的最新 Debian 发行版上找到。同样可以使用 cat 命令查看该文件的内容,输入下面的命令: Read more...

删除 Debian Gnome 所有默认安装的游戏

debian gnome games
我用以下命令删除Debian 11.5(带有gnome)中的所有预装游戏: sudo apt purge aisleriot gnome-sudoku gnome-nibbles ace-of-penguins gnomine gbrainy gnome-sushi gnome-taquin gnome-tetravex gnome-robots gnome-chess lightsoff swell-foop quadrapassel tali gnome-mahjongg gnome-2048 iagno gnome-klotski five-or-more gnome-mines four-in-a-row hitori && sudo apt autoremove

如何关闭 Ubuntu 中的开放端口?

Ubuntu 命令行 netstat
如何关闭 Ubuntu 中的开放端口? 问题描述 列出所有打开的端口,以关闭一些应用程序的端口。 最佳办法 如果要关闭端口,则必须终止进程或停止相关服务。 可以使用 netstat -nalp 和 lsof -i:port 工具来识别打开端口后面的进程/二进制文件。 netstat 可用于查看端口统计信息。 要显示所有开放端口的列表: sudo netstat -lnp 列出所有侦听端口号以及每个负责的进程。终止或终止进程以关闭端口。 ( kill , pkill …) 关闭一个打开的端口: sudo fuser -k port_no/tcp 例子: sudo fuser -k 8080/tcp 次佳办法 要在 ubuntu 中关闭开放端口,可以使用以下命令 sudo kill $(sudo lsof -t -i:3000) 代替 3000 你可以指定你的端口号 lsof 命令将提供有关进程打开的文件的信息 -t :此标志指定 lsof 应仅生成带有进程标识符且没有标头的简洁输出 – 例如,以便可以将输出通过管道传输到 kill(1)。此选项选择 -w 选项。 -i :此标志选择任何 Internet 地址与 i 中指定的地址匹配的文件列表。如果未指定地址,此选项将选择所有 Internet 和 x.25 (HP-UX) 网络文件的列表。 Read more...

解决 Firefox 访问weibo搜索或热搜提示 建立安全连接失败

firefox weibo
应用版本:firefox 开发者版 v101 问题描述:微博主页可以正常访问,但点击搜索或热搜链接,都提示: 建立安全连接失败 连接到 s.weibo.com 时发生错误。 由于不能验证所收到的数据是否可信,无法显示您想要查看的页面。 建议向此网站的管理员反馈这个问题。 详细了解… 通过curl -v “网址” 反复重试对比发现在访问微博热搜的时候有一个加密协商被“微博账户认证网关服务器”拒绝了。 具体测试指令: 通过 curl -v "https://s.weibo.com/weibo?q=%23%E7%A5%9D%E8%9E%8D%E5%8F%B7%E5%87%86%E5%A4%87%E5%9C%A8%E7%81%AB%E6%98%9F%E8%B6%8A%E5%86%AC%23&topic_ad=" 得到302跳转请求链接 继续 curl -v "https://passport.weibo.com/visitor/visitor?entry=miniblog&a=enter&url=https%3A%2F%2Fs.weibo.com%2Fweibo%3Fq%3D%2523%25E7%25A5%259D%25E8%259E%258D%25E5%258F%25B7%25E5%2587%2586%25E5%25A4%2587%25E5%259C%25A8%25E7%2581%25AB%25E6%2598%259F%25E8%25B6%258A%25E5%2586%25AC%2523%26topic_ad%3D&domain=.weibo.com&sudaref=&ua=php-sso_sdk_client-0.6.29&_rand=1651842429.1375" 返回 …… * TLSv1.2 (IN), TLS handshake, Finished (20): * SSL connection using TLSv1.2 / AES256-GCM-SHA384 * ALPN, server did not agree to a protocol * Server certificate: * subject: C=CN; ST=Beijing; O=Sina.com Technology(China)Co.,ltd; CN=sina.com …… 注意这段提示: ALPN, server did not agree to a protocol ALPN ALPN(Application-Layer Protocol Negotiation):应用层协议协商是 TLS 的一个扩展,故而应用层协议在协商加密协议的过程中,避免了额外的往返通讯开销。 ALPN支持任意应用层协议的协商,目前应用最多是HTTP2的协商。当前主流浏览器,都只支持基于 HTTPS 部署的 HTTP/2,因为浏览器是基于ALPN协议来判断服务器是否支持HTTP2协议。 Read more...
Previous Page 2 of 6 Next Page