default: 27 items found.

ansible yum 安装慢的问题解决

使用ansible yum 模块安装软件时,可能会碰到执行非常慢的情况。

- name: install rpms
  yum:
    name:
      - etcd
    state: latest
    disablerepo: "*"
    enablerepo: some

原因可能是/etc/yum.conf配置的默认yum源响应非常慢,甚至不可达。

More ~

How to Check if a File or Directory Exists in Bash

Many times when writing Shell scripts, you may find yourself in a situation where you need to perform an action based on whether a file exists or not.

In Bash, you can use the test command to check whether a file exists and determine the type of the file.

The test command takes one of the following syntax forms:

test EXPRESSION
[ EXPRESSION ]
[[ EXPRESSION ]]
More ~

修改docker镜像

若有个名为nginx的容器:

docker run -it nginx bash

修改内容后退出,使用docker commit命令提交修改。

Usage:  docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

Create a new image from a container's changes

Options:
  -a, --author string    Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
  -c, --change list      Apply Dockerfile instruction to the created image
  -m, --message string   Commit message
  -p, --pause            Pause container during commit (default true)

如 :

docker commit -a "John Click" -m "add extra plugins" 2ff7f15ca033 nginx:latest

2ff7f15ca033 为刚才修改的docker容器id。

More ~

centos 配置dhcp简记

yum -y install dhcp

配置文件:/etc/dhcp/dhcpd.conf

示例配置文件:/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example

default-lease-time 7200;
max-lease-time 14400;
subnet 10.1.119.0 netmask 255.255.255.0 {
  option routers 10.1.119.128;
  option domain-name-servers 10.1.102.2;
  range 10.1.119.200 10.1.119.220;
}
More ~

为localhost一步生成自签名证书

为localhost一步生成自签名证书

openssl req -x509 -days 365 -out localhost.crt -keyout localhost.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
More ~

macbook扩展坞连上后为什么wifi断开了

买来扩展坞连接上后,我的WiFi连接不上了!
家里的WiFI是用一台带有WiFi功能的电信光猫作为路由,发射的2.4G信号,没有5G。

折腾一番后找了些资料了解到是USB3.0发射的无线信号在2.4G HZ左右,会干扰无线路由的2.4G。

20210110115424.jpg

More ~