ubuntu docker create and open ssh

The preparatory work

Pull ubuntu image

1
docker pull ubuntu:18.04

Run ubuntu container back

1
docker run -itd -p 3022:22 -p 3021:8080 ubuntu:18.04 bash

3022 is ssh port, 3021 is web port

阅读全文

ubuntu add user

Add user and make user home dir

1
useradd nplus -m -s /bin/bash

Set user password

1
passwd nplus

Delete the user completely

1
userdel -r nplus
阅读全文

Linux修改默认shell

输入cat /etc/shells查看可用shell

1
2
3
4
5
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/bin/rbash
/bin/dash
阅读全文

mysql-server-5.7 is not configured yet

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Do you want to continue? [Y/n] Y
Setting up mysql-server-5.7 (5.7.28-0ubuntu0.18.04.4) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 191: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
阅读全文

ubuntu 安装python3.8

下载源码

1
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz

解压源码

1
tar -xvzf Python-3.8.0.tgz
阅读全文

docker 换源

1
2
3
4
5
6
7
8
{
"debug": true,
"experimental": false,
"registry-mirrors": [
"https://docker.mirrors.ustc.edu.cn",
"https://hub-mirror.c.163.com"
]
}
阅读全文

Docker 修改时区

1. Alpine

1
2
3
4
5
6
7
FROM alpine:latest

# 安装tzdata
RUN apk add --no-cache tzdata

# 设置时区
ENV TZ="Asia/Shanghai"
  • 验证
1
2
docker build -t alpine:time .
docker run --rm -it alpine:time date
阅读全文

uWSGI listen queue 队列溢出的问题

如果没有设置 uwsgi 的 –listen,如果sysctl -a | grep net.core.somaxconn发现net.core.somaxconn=128。
那你使用uwsgi启动的服务,单机最大支持并发数为100*(启动的uwsgi进程数)。
如果启动进程为4个,则最大并发只能支持400,这样会在 uwsgi 的 log 日志中出现错误 uWSGI listen queue of socket 4 full。
同时,nginx对应也会出现错误 upstream time out。

阅读全文