Docker常用命令
常见容器启动
启动mysql
docker run -p 3306:3306 --name mysql5.7 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
启动Centos7.9
docker run -itd --privileged=true -p 10022:22 --name sftp_centos7.9 centos:7.9.2009
docker exec -it sftp_centos7.9 /bin/bash
passwd
yum install openssh-server -y
yum install initscripts -y
yum install vim -y
yum install net-tools -y
yum install passwd -y
yum install openssl openssl-devel -y
netstat -apnl | grep 22
vim /etc/ssh/sshd_config
# 修改下列两行
PermitRootLogin yes
UsePAM no
service sshd start
systemctl enable sshd.service
常用命令
修改Centos7的yum源
vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/
https://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
https://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
https://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
https://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
https://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
https://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
https://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
https://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
https://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
https://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
yum clean all
yum makecache
修改openEuler的yum源
dnf config-manager --add-repo https://repo.oepkgs.net/openeuler/rpm/openEuler-20.03-LTS-SP1/extras/x86_64/
dnf clean all && dnf makecache
给openEuler安装pip命令
python3 -m ensurepip -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com