• 镜像源操作-ananconda-docker


    CentOS

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    

    CentOS 6

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    

    或者

    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    

    或者

    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    

    其他

    非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置: eg:

    sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/*
    

    oraclelinux 7

    yum 源配置

    [root@wn10aimapap1001 yum.repos.d]# cat  /etc/os-release 
    NAME="Oracle Linux Server"
    VERSION="7.4"
    ID="ol"
    VERSION_ID="7.4"
    PRETTY_NAME="Oracle Linux Server 7.4"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:oracle:linux:7:4:server"
    HOME_URL="https://linux.oracle.com/"
    BUG_REPORT_URL="https://bugzilla.oracle.com/"
    
    ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
    ORACLE_BUGZILLA_PRODUCT_VERSION=7.4
    ORACLE_SUPPORT_PRODUCT="Oracle Linux"
    ORACLE_SUPPORT_PRODUCT_VERSION=7.4
    
    
    
    cat >>  /etc/yum.repos.d/CentOS-Base.repo <<EOF
    [base]
    name=CentOS-7 - Base - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
     
    #released updates 
    [updates]
    name=CentOS-7 - Updates - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
     
    #additional packages that may be useful
    [extras]
    name=CentOS-7 - Extras - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
     
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-7 - Plus - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
     
    #contrib - packages by Centos Users
    [contrib]
    name=CentOS-7 - Contrib - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
    EOF
    
    
    
    

    ubuntu

    vim /etc/apt/sources.list

    ubuntu 16.04

    cat > /etc/apt/sources.list <<EOF
    deb http://mirrors.aliyun.com/ubuntu/ xenial main
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
    
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
    
    deb http://mirrors.aliyun.com/ubuntu/ xenial universe
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    EOF
    

    ubuntu18.04(bionic) 配置如下

    cat > /etc/apt/sources.list <<EOF
    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    EOF
    

    pip国内源

    豆青

    https://pypi.tuna.tsinghua.edu.cn/simple
    https://pypi.douban.com/simple/

    临时使用pip源

    pip的时候加参数 pip -i https://pypi.tuna.tsinghua.edu.cn/simple
    pip install -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple ipython
    永久修改
    Linux下,修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:

     [global]
     index-url = https://pypi.tuna.tsinghua.edu.cn/simple
    

    pip3 install tensorflow-gpu1.11.0
    pip3 install Keras
    2.2.4

    阿里

    [global]
     trusted-host =  mirrors.aliyun.com
     index-url = https://mirrors.aliyun.com/pypi/simple
    

    Anaconda清华

    https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 
    https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.1.0-Linux-x86_64.sh
    
    curl   -L  https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2019.03-Linux-x86_64.sh   -o  Anaconda3-2019.03-Linux-x86_64.sh
    ```bash
    yum install bzip2
    echo -e   'import subprocess
    import sys
    subprocess.call("cd /", shell=True)
    subprocess.call("jupyter lab --ip=0.0.0.0 --no-browser --allow-root  --NotebookApp.allow_root=False --NotebookApp.token='jupyterAdmin' --notebook-dir=/home", shell=True)'  >  python_service.py
    
    python   python_service.py
    
    

    Python3.7 安装数据分析包展示的图像比较清晰

    阿里源docker-ce

    CentOS7

    sudo yum install -y yum-utils device-mapper-persistent-data lvm2# Step 2: 添加软件源信息
    sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    sudo yum makecache fast
    sudo yum -y install docker-ce
    sudo service docker start
    
    
    注意:其他注意事项在下面的注释中
    # 官方软件源默认启用了最新的软件,您可以通过编辑软件源的方式获取各个版本的软件包。例如官方并没有将测试版本的软件源置为可用,你可以通过以下方式开启。同理可以开启各种测试版本等。
    # vim /etc/yum.repos.d/docker-ce.repo
    #   将 [docker-ce-test] 下方的 enabled=0 修改为 enabled=1
    #
    # 安装指定版本的Docker-CE:
    # Step 1: 查找Docker-CE的版本:
    # yum list docker-ce.x86_64 --showduplicates | sort -r
    #   Loading mirror speeds from cached hostfile
    #   Loaded plugins: branch, fastestmirror, langpacks
    #   docker-ce.x86_64            17.03.1.ce-1.el7.centos            docker-ce-stable
    #   docker-ce.x86_64            17.03.1.ce-1.el7.centos            @docker-ce-stable
    #   docker-ce.x86_64            17.03.0.ce-1.el7.centos            docker-ce-stable
    #   Available Packages
    # Step2 : 安装指定版本的Docker-CE: (VERSION 例如上面的 17.03.0.ce.1-1.el7.centos)
    # sudo yum -y install docker-ce-[VERSION]
    # 注意:在某些版本之后,docker-ce安装出现了其他依赖包,如果安装失败的话请关注错误信息。例如 docker-ce 17.03 之后,需要先安装 docker-ce-selinux。
    # yum list docker-ce-selinux- --showduplicates | sort -r
    # sudo yum -y install docker-ce-selinux-[VERSION]
    

    Ubuntu14.04/16.04

    sudo apt-get update
    sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
    sudo apt-get -y update
    sudo apt-get -y install docker-ce
    
    
    注意:其他注意事项在下面的注释中
    # 安装指定版本的Docker-CE:
    # Step 1: 查找Docker-CE的版本:
    # apt-cache madison docker-ce
    #   docker-ce | 17.03.1~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
    #   docker-ce | 17.03.0~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
    # Step 2: 安装指定版本的Docker-CE: (VERSION 例如上面的 17.03.1~ce-0~ubuntu-xenial)
    # sudo apt-get -y install docker-ce=[VERSION]
    

    3,安装校验

    root@iZbp12adskpuoxodbkqzjfZ:$ docker version
    

    ubuntu1804

    #卸载老版本
    
    $ sudo apt-get remove docker docker-engine docker.io
    
    $ sudo apt-get update
    $ sudo apt-get install 
        apt-transport-https 
        ca-certificates 
        curl 
        software-properties-common
    
    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
    sudo add-apt-repository 
       "deb [arch=amd64] https://download.docker.com/linux/ubuntu 
       $(lsb_release -cs) 
       stable"
    
    二、安装DOCKER CE
    
    sudo apt-get update
    sudo apt-get install docker-ce
    apt-cache madison docker-ce
    sudo apt-get install docker-ce=<VERSION>
    
    docker -v 
    
    
    ### 从安装包安装
    
    1.转到https://download.docker.com/linux/ubuntu/dists/,选择您的Ubuntu版本,浏览到pool / stable /并选择amd64,armhf,ppc64el或s390x。下载要安装的Docker版本的.deb文件。
    要安装edge包,请将URL中的单词stable更改为edge。
    
    2.安装Docker CE,将下面的路径更改为您下载Docker软件包的路径。
    $ sudo dpkg -i /path/to/package.deb
    Docker守护程序自动启动。
    
    
    ###如果您想将Docker用作非root用户,您现在应该考虑将您的用户添加到“docker”组
    sudo usermod -aG docker your-user
    
    
    ##卸载docker-ce
    卸载Docker CE
    1.卸载Docker CE软件包:
    $ sudo apt-get purge docker-ce
    
    2.主机上的图像,容器,卷或自定义配置文件不会自动删除。要删除所有图像,容器和卷:
    $ sudo rm -rf / var / lib / docker
    您必须手动删除任何已编辑的配置文件
    
    

    安装容器后操作

     cat  >> /etc/sysctl.conf <<EOF
    net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    EOF
    
    sysctl -p
    
    以下未出现:
    执行sysctl -p 时出现:
    [root@localhost ~]# sysctl -p
    sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory
    sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables: No such file or directory
     
     
    解决方法:
    [root@localhost ~]# modprobe br_netfilter
    [root@localhost ~]# ls /proc/sys/net/bridge
    bridge-nf-call-arptables bridge-nf-filter-pppoe-tagged
    bridge-nf-call-ip6tables bridge-nf-filter-vlan-tagged
    bridge-nf-call-iptables bridge-nf-pass-vlan-input-dev
    

    普通用户可操作docker

    sudo groupadd docker
    sudo usermod -aG docker ${USER}
    sudo gpasswd -a $USER docker
    newgrp docker 
    

    docker安装后操作

    修改镜像及缓存保存路径,防止空间过少

    镜像 jdk231

    http://fr-de.lunar-linux.org/lunar/mirrors/

    docke离线下载

    https://download.docker.com/linux/static/stable/x86_64/
    https://download.docker.com/linux/static/stable/x86_64/docker-18.06.3-ce.tgz

    二进制安装docker后systemctl控制

    
    #!/bin/bash
    
    # docker离线安装
    # 解压docker到/usr/local/
    sudo tar -zxf  docker-18.06.3-ce.tgz -C /usr/local/
    
    # 将解压后docker目录下所有内容拷贝到/usr/bin/目录下
    sudo cp /usr/local/docker/* /usr/bin/
    
    # 启动docker守护程序
    sudo dockerd &
    
    # 测试
    sudo docker -v
    sudo docker info
    
    # 以非root用户身份管理docker
    # 创建docker组
    sudo groupadd docker
    
    # 将当前用户添加到该docker组
    sudo usermod -a -G docker $USER
    
    # 更新用户组
    newgrp docker
    
    # 重新登陆后测试
    docker ps
    
    
    ##配置systemctl控制文件  centos7 
    
    sudo  vim  /usr/lib/systemd/system/docker.service 
    [Unit]
    Description=Docker Application Container Engine
    Documentation=https://docs.docker.com
    After=network-online.target firewalld.service
    Wants=network-online.target
    
    [Service]
    Type=notify
    # the default is not to use systemd for cgroups because the delegate issues still
    # exists and systemd currently does not support the cgroup feature set required
    # for containers run by docker
    ExecStart=/usr/bin/dockerd
    #ExecStart=/usr/bin/dockerd  -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock  --graph=/home/data/docker-storage
    #指定存储路径 --graph=/data/docker
    #开启远程访问 -H tcp://0.0.0.0:2375  
    ExecReload=/bin/kill -s HUP $MAINPID
    # Having non-zero Limit*s causes performance problems due to accounting overhead
    # in the kernel. We recommend using cgroups to do container-local accounting.
    LimitNOFILE=infinity
    LimitNPROC=infinity
    LimitCORE=infinity
    # Uncomment TasksMax if your systemd version supports it.
    # Only systemd 226 and above support this version.
    #TasksMax=infinity
    TimeoutStartSec=0
    # set delegate yes so that systemd does not reset the cgroups of docker containers
    Delegate=yes
    # kill only the docker process, not all processes in the cgroup
    KillMode=process
    # restart the docker process if it exits prematurely
    Restart=on-failure
    StartLimitBurst=3
    StartLimitInterval=60s
    
    [Install]
    WantedBy=multi-user.target
    
    
    
    sudo  vim /usr/lib/systemd/system/docker.socket
    [Unit]
    Description=Docker Socket for the API
    PartOf=docker.service
    
    [Socket]
    # If /var/run is not implemented as a symlink to /run, you may need to
    # specify ListenStream=/var/run/docker.sock instead.
    ListenStream=/run/docker.sock
    SocketMode=0660
    SocketUser=root
    SocketGroup=docker
    
    [Install]
    WantedBy=sockets.target
    
    
    
    #加载文件
    # 先重启 systemctl 守护进程
    $ sudo systemctl daemon-reload
    # 再开启 docker 服务
    $ sudo systemctl start docker
    
    # * 如果上一行代码显示失败
    $ sudo reboot
    
    
    sudo systemctl enable docker
    

    来源:https://github.com/moby/moby/tree/master/contrib/init/systemd

    多余的docker-ce安装

    一,脚本

    使用官方安装脚本自动安装 (仅适用于公网环境)
    curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
    

    二,Ubuntu 14.04 16.04 (使用apt-get进行安装)

    阿里云源
    
    
    
    step 1: 安装必要的一些系统工具
    sudo apt-get update
    sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
    # step 2: 安装GPG证书
    curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
    # Step 3: 写入软件源信息
    sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
    # Step 4: 更新并安装 Docker-CE
    sudo apt-get -y update
    sudo apt-get -y install docker-ce
    
    注意:其他注意事项在下面的注释中
    # 安装指定版本的Docker-CE:
    # Step 1: 查找Docker-CE的版本:
    # apt-cache madison docker-ce
    #   docker-ce | 17.03.1~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
    #   docker-ce | 17.03.0~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
    # Step 2: 安装指定版本的Docker-CE: (VERSION 例如上面的 17.03.1~ce-0~ubuntu-xenial)
    # sudo apt-get -y install docker-ce=[VERSION]
    
    # 通过经典网络、VPC网络内网安装时,用以下命令替换Step 2、Step 3中的命令
    # 经典网络:
    # curl -fsSL http://mirrors.aliyuncs.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
    # sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyuncs.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
    # VPC网络:
    # curl -fsSL http://mirrors.cloud.aliyuncs.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
    # sudo add-apt-repository "deb [arch=amd64] http://mirrors.cloud.aliyuncs.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
    

    三,centos7

    # step 1: 安装必要的一些系统工具
    sudo yum install -y yum-utils device-mapper-persistent-data lvm2
    # Step 2: 添加软件源信息
    sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    # Step 3: 更新并安装 Docker-CE
    sudo yum makecache fast
    sudo yum -y install docker-ce
    # Step 4: 开启Docker服务
    sudo service docker start
    
    注意:其他注意事项在下面的注释中
    # 官方软件源默认启用了最新的软件,您可以通过编辑软件源的方式获取各个版本的软件包。例如官方并没有将测试版本的软件源置为可用,你可以通过以下方式开启。同理可以开启各种测试版本等。
    
    # vim /etc/yum.repos.d/docker-ce.repo
    #   将 [docker-ce-test] 下方的 enabled=0 修改为 enabled=1
    #
    # 安装指定版本的Docker-CE:
    # Step 1: 查找Docker-CE的版本:
    # yum list docker-ce.x86_64 --showduplicates | sort -r
    #   Loading mirror speeds from cached hostfile
    #   Loaded plugins: branch, fastestmirror, langpacks
    #   docker-ce.x86_64            17.03.1.ce-1.el7.centos            docker-ce-stable
    #   docker-ce.x86_64            17.03.1.ce-1.el7.centos            @docker-ce-stable
    #   docker-ce.x86_64            17.03.0.ce-1.el7.centos            docker-ce-stable
    #   Available Packages
    # Step2 : 安装指定版本的Docker-CE: (VERSION 例如上面的 17.03.0.ce.1-1.el7.centos)
    # sudo yum -y install docker-ce-[VERSION]
    # 注意:在某些版本之后,docker-ce安装出现了其他依赖包,如果安装失败的话请关注错误信息。例如 docker-ce 17.03 之后,需要先安装 docker-ce-selinux。
    # yum list docker-ce-selinux- --showduplicates | sort -r
    # sudo yum -y install docker-ce-selinux-[VERSION]
    
    
    
    # 通过经典网络、VPC网络内网安装时,用以下命令替换Step 2中的命令
    # 经典网络:
    # sudo yum-config-manager --add-repo http://mirrors.aliyuncs.com/docker-ce/linux/centos/docker-ce.repo
    # VPC网络:
    # sudo yum-config-manager --add-repo http://mirrors.could.aliyuncs.com/docker-ce/linux/centos/docker-ce.repo
    

    四,docker使用普通用户操作

    1、创建docker组
    sudo groupadd docker
    2、将当前用户加入docker用户组
    sudo gpasswd -a ${USER} docker
    3、重新启动docker服务(下面是CentOS7的命令)
    sudo systemctl restart docker
    4、关闭当前窗口,重新连接,普通用户已经可以使用了
    

    五,docker 更改运行时

    docker   info  |  grep  Runtime
    更改默认的runtime 
    配置daemon的默认运行时
    是否已安装
    ls  /usr/bin/nvidia-container-runtime
    nvidia-docker 命令是否出现
    指定默认的runtime    "default-runtime": "nvidia"  添加加速代理镜像源
    
    vim  /etc/docker/daemon.json 
    {
        "default-runtime": "nvidia",
        "runtimes": {
            "nvidia": {
                "path": "/usr/bin/nvidia-container-runtime",
                "runtimeArgs": [],
                "registry-mirrors": ["https://gemfield.mirror.aliyuncs.com"]
            }
        }
    }
    
    

    centos7镜像

    http://mirrors.aliyun.com/centos/7/isos/x86_64/
    https://www.centos.org/download/

    镜像区别:
    CentOS ISO:DVD是标准安装盘,一般下载这个就可以了,里面包含大量的常用软件,大部分情况下安装时无需再在线下载,体积为4G;
    Minimal ISO:精简版本,包含核心组件,体积才600多MB;
    Everything ISO:顾名思义,包含了所有软件组件,当然体积也庞大,高达7G。对完整版安装盘的软件进行补充,集成所有软件;
    NetInstall ISO:网络安装镜像;
    LiveGNOME ISO:GNOME桌面版;
    LiveKDE ISO:KDE桌面版;
    LiveCD ISO:光盘上运行的系统,类拟于winpe;

    ubuntu

    官网下载
    http://59.80.44.47/releases.ubuntu.com/202004130925/2F1ECB66A1ACF38F006C5A0254ABE013/18.04/ubuntu-18.04.4-desktop-amd64.iso

    win10激活

    关闭安全检测后安装使用
    https://official-kmspico.com/download

  • 相关阅读:
    第四章:(2)原理之 Dubbo 框架设计
    大三学习进度29
    大三学习进度27
    大三学习进度31
    大三学习进度24
    大三学习进度29
    大三学习进度26
    大三学习进度28
    大三学习进度25
    大三学习进度32
  • 原文地址:https://www.cnblogs.com/g2thend/p/11515545.html
Copyright © 2020-2023  润新知