CentOS 安装screenFetch

今天想给虚拟机装个screenFetch,以前在openSUSE和Ubuntu上安装都是直接包管理安装,习惯性地直接yum install screenfetch一下竟然发现没有:

No package screenfetch available.

好吧只好去翻一下文档:Installation · KittyKatt/screenFetch Wiki · GitHub

所以先下载:

wget -O screenfetch-dev https://git.io/vaHfR

然后丢到/usr/bin或类似的目录,如果在PATH就比较方便:

sudo mv ./screenfetch-dev /usr/bin/screenfetch

记得加上可执行权限:

sudo chmod +x /usr/bin/screenfetch

此时应该可以使用了:

screenfetch
screenfetch

好了出现了新的问题,没有lspci,那么:

yum whatprovides lspci
pciutils
sudo yum install pciutils

宽度比较蛋疼,我还是ssh上去截个图吧:

screenfetch

普通用户不需要sudo使用Docker

大多数情况下,普通用户使用Docker都需要使用sudo进行提权,否则可能要切换到root用户才可直接使用。其实只需要将当前用户加入docker用户组即可。

The docker group grants privileges equivalent to the root user. For details on how this impacts security in your system, see Docker Daemon Attack Surface.

Warning from Post-installation steps for Linux | Docker Documentation

确实有风险,可能导致利用Docker提权之类的问题。搞事之前一定要明白自己在做什么。

正常情况下应该已经存在docker用户组了,如果没有则需要:

sudo groupadd docker

来添加一个名为docker的用户组。

然后就可以将当前用户加入docker用户组:

sudo usermod -aG docker $USER

或者:

sudo gpasswd -a $USER docker

注销后重新登录即可生效。按文档,对于有图形界面的Linux,应该注销再登录即可,否则应该完全重启。如果不方便注销,可以尝试:

newgrp docker

此时应该可以不需要sudo来使用Docker了。

发现版本19.03起有一个实验性特性,以非root用户运行Docker守护进程:

dockerd-rootless.sh --experimental

引用:
Post-installation steps for Linux | Docker Documentation
How can I use docker without sudo? – Ask Ubuntu
Docker security | Docker Documentation

Public DNS 个人常用的公共DNS

慢慢收藏一点方便自己查找。

DNSPod Public DNS 119.29.29.29

首选:119.29.29.29
备用:182.254.116.116

Public DNS+——DNSPod推出的域名递归解析服务
Public DNS+ 接入指南-DNSPod 技术支持-DNSPod-免费智能DNS解析服务商-电信_网通_教育网,智能DNS

阿里DNS

首选:223.5.5.5
备用:223.6.6.6
首选:2400:3200::1
备用:2400:3200:baba::1

阿里DNS

1.1.1.1

首选:1.1.1.1
备用:1.0.0.1
首选:2606:4700:4700::1111
备用:2606:4700:4700::1001

1.1.1.1 — the Internet’s Fastest, Privacy-First DNS Resolver

Google Public DNS

首选:8.8.8.8
备用:8.8.4.4
首选:2001:4860:4860::8888
备用:2001:4860:4860::8844

Get Started | Public DNS | Google Developers

docker-compose.yml 特殊字符转义

MYSQL_ROOT_PASSWORD等键值对,可能会有特殊字符的字符串。使用引号来包围含有特殊字符的字符串。如果含有符号$,使用$$来代表$

You can use a $$ (double-dollar sign) when your configuration needs a literal dollar sign. This also prevents Compose from interpolating a value, so a $$ allows you to refer to environment variables that you don’t want processed by Compose.

Compose file version 3 reference | Docker Documentation

引用:
How to escape # in docker-compose – Stack Overflow
escaping – How can I escape a $ dollar sign in a docker compose file? – Stack Overflow
MYSQL_ROOT_PASSWORD special character missing with docker-compose.yml configuration · Issue #123 · docker-library/mysql · GitHub
yml配置文件中有特殊字符解决方案_iamlzyoco的博客-CSDN博客

MySQL default_character_set_name

SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "DATABASE_NAME";
ALTER DATABASE DATABASE_NAME CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER DATABASE DATABASE_NAME CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE TABLE_NAME CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE TABLE_NAME CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

引用:
mysql – How to fix “Incorrect string value” errors? – Stack Overflow
character encoding – How to convert an entire MySQL database characterset and collation to UTF-8? – Stack Overflow

Windows上的MySQL my.cnf my.ini

在Windows上,通常说的/etc/my.cnfmy.ini。如果MySQL已经作为服务启动,那么可以很容易地找到:

Win+R以准备运行,输入services.msc

找到MySQL并查看属性:

“C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe” –defaults-file=”C:\ProgramData\MySQL\MySQL Server 5.7\my.ini” MySQL57

其中defaults-file就是my.ini的路径。

引用:
mysql – I can not find my.cnf on my windows computer – Stack Overflow
mysql – How to change max_allowed_packet size – Stack Overflow
MySQL Bugs: #68516: MySQL workbench installed with MySQL 5.6 links to MySQL55 my.ini