ubuntu16 安装 docker 和K8S指导

Docker 构建支持中文环境的Alpine及大小优化 Docker 构建支持中文环境的Alpine及大小优化 因SpringBoot日志出现乱码,研究原因后发现是从docker官方仓库pull的镜像不支持中文。 构建内容参考了:https://www.clxz.top/2019/05/09/160241/ 那就自己构建一个环境,本文只说构建Alpine及优化 1、Dockerfile如下: FROM alpine:3.12.0 # 清理临时文件要在 同一个RUN命令内进行, rm -rf .....,构建的时候每个RUN都会创建一个临时的容器,只 阅读详情

docker安装包
https://download.youkuaiyun.com/download/van_peak/10590104

安装docker软件

root@ubuntu-129:/opt/docker# dpkg -i docker-ce_18.06.0_ce_3-0_ubuntu_amd64.deb

查看docker 安装版本

root@ubuntu-129:/opt/docker# docker version
Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:11:02 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:09:05 2018
  OS/Arch:          linux/amd64
  Experimental:     false

docker开机启动设置

root@ubuntu-129:/opt/docker# systemctl enable docker
Synchronizing state of docker.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable docker
root@ubuntu-129:/opt/docker# systemctl start docker

2.下载alpine 操作系统镜像

如果本地没有,会从docker远端仓库下载docker镜像

root@ubuntu-129:/opt/docker# docker run -it --rm alpine:latest sh
Unable to find image 'alpine:latest' locally
^C
root@ubuntu-129:/opt/docker# docker run -it --rm alpine:latest sh
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
050382585609: Pull complete
Digest: sha256:6a92cd1fcdc8d8cdec60f33dda4db2cb1fcdcacf3410a8e05b3741f44a9b5998
Status: Downloaded newer image for alpine:latest

配置阿里云docker远端仓库地址

vim  /etc/docker/daemon.json

{
"registry-mirror":["https://ozcouvlb.mirror.aliyuncs.com"]
}

使得文件生效,并重启docker:

root@ubuntu-129:~# systemctl  daemon-reload
root@ubuntu-129:~# systemctl  restart docker

以nginx 镜像为例测试新配置的远程仓库下载速度(还是很快的):

root@ubuntu-129:/opt/docker# docker run -it --rm nginx:latest sh
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
f5d23c7fed46: Pull complete
918b255d86e5: Pull complete
8c0120a6f561: Pull complete
Digest: sha256:eb3320e2f9ca409b7c0aa71aea3cf7ce7d018f03a372564dbdb023646958770b
Status: Downloaded newer image for nginx:latest
root@ubuntu-129:~# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              e445ab08b2be        2 weeks ago         126MB
alpine              latest              b7b28af77ffe        4 weeks ago         5.58MB
root@ubuntu-129:~# vim  /etc/docker/daemon.json
root@ubuntu-129:~# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bf5f906e9868        nginx:latest        "sh"                3 minutes ago       Up 3 minutes        80/tcp              happy_tereshkova
root@ubuntu-129:~#

安装K8S

配置k8s下载源

vim /etc/apt/sources.list.d/kubernetes.list

deb http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial main

但是更新源后报错调试证书错误: 

root@ubuntu-129:~# apt update
命中:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
获取:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease [109 kB]
获取:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease [107 kB]
获取:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease [109 kB]
获取:5 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease [8,993 B]
错误:5 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease
  由于没有公钥,无法验证下列签名: NO_PUBKEY 6A030B21BA07F4FB
命中:6 http://nginx.org/packages/ubuntu xenial InRelease
正在读取软件包列表... 完成
W: GPG 错误:http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY 6A030B21BA07F4
E: 仓库 “http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

解决方案:

添加认证key

运行如下命令

其中recv-keys 是你之前6A030B21BA07F4FB的后8位

gpg --keyserver keyserver.ubuntu.com --recv-keys BA07F4FB

 导出你的key

gpg --export --armor BA07F4FB | apt-key add - 

 再次更新解决

root@ubuntu-129:~# apt update
获取:1 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease [8,993 B]
忽略:2 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial/main amd64 Packages
获取:2 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial/main amd64 Packages [28.4 kB]
命中:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
命中:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease
命中:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease
命中:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease
命中:7 http://nginx.org/packages/ubuntu xenial InRelease
已下载 28.4 kB,耗时 2秒 (11.9 kB/s)
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
有 413 个软件包可以升级。请执行 ‘apt list --upgradable’ 来查看它们。

 

禁止基础设施

 4.2 K8S系统网络 配置

安装K8S

安装k8s

apt update && apt-get install -y kubelet=1.13.1-00 kubernetes-cni=0.6.0-00 kubeadm=1.13.1-00 kubectl=1.13.1-00

 设置开机启动

systemctl enable kubelet && systemctl start kubelet

5.2master 和node基础配置

vim /etc/hostname

master ----> node1--->node2

下面这个是ubutu18配置的地址,

因为ubuntu从17.10开始,已放弃在/etc/network/interfaces里固定IP的配置,而是改成netplan方式了。所以这里不会动

 

network:
  version: 2
  ethernets:
    ens33:   #配置的网卡名称
      dhcp4: false    #dhcp4关闭
      addresses: [192.168.236.177/24]   #设置本机IP及掩码
      gateway4: 192.168.236.2   #设置网关
      nameservers:
          addresses: [192.168.236.2]   #设置DNS
      optional: true

 

启动master节点(ubuntu-128)

root@ubuntu-128:/home/itcast/working# kubeadm init --config ./kubeadm.conf
[init] Using Kubernetes version: v1.13.1
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Activating the kubelet service
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [ubuntu-128 localhost] and IPs [192.168.13.128 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [ubuntu-128 localhost] and IPs [192.168.13.128 127.0.0.1 ::1]
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [ubuntu-128 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.13.128]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[apiclient] All control plane components are healthy after 33.010980 seconds
[uploadconfig] storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config-1.13" in namespace kube-system with the configuration for the kubelets in the cluster
[patchnode] Uploading the CRI Socket information "/var/run/dockershim.sock" to the Node API object "ubuntu-128" as an annotation
[mark-control-plane] Marking the node ubuntu-128 as control-plane by adding the label "node-role.kubernetes.io/master=''"
[mark-control-plane] Marking the node ubuntu-128 as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]
[bootstrap-token] Using token: abcdef.0123456789abcdef
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstraptoken] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstraptoken] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstraptoken] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstraptoken] creating the "cluster-info" ConfigMap in the "kube-public" namespace
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

Your Kubernetes master has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join 192.168.13.128:6443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:341f71f586d22b71da8bf5fb9dfb5b72fbc3dbc8377a4752bcb5b1a6a04e84b8

按照提醒执行 下面三条指令

root@ubuntu-128:~# mkdir -p $HOME/.kube
root@ubuntu-128:~# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
root@ubuntu-128:~# sudo chown $(id -u):$(id -g) $HOME/.kube/config

测试k8s master节点情况

root@ubuntu-128:~# systemctl  enable kubelet
root@ubuntu-128:~# systemctl  start kubelet
root@ubuntu-128:~# kubectl get nodes
NAME         STATUS     ROLES    AGE     VERSION
ubuntu-128   NotReady   master   2m26s   v1.13.1
root@ubuntu-128:~# kubectl get cs
NAME                 STATUS    MESSAGE              ERROR
controller-manager   Healthy   ok
scheduler            Healthy   ok
etcd-0               Healthy   {"health": "true"}

 

其他node节点想要进入master节点,需要按照以下方式加入到集群中


To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join 192.168.13.128:6443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:341f71f586d22b71da8bf5fb9dfb5b72fbc3dbc8377a4752bcb5b1a6a04e84b8

 

 

 

Ubuntu 16.04安装Nvida驱动、CUDA9.0、Nvidia-docker和Nvidia_k8s_device_plugin Ubuntu 16.04安装Nvida驱动、CUDA9.0、Nvidia-docker和Nvidia_k8s_device_plugin 一 安装Nvidia驱动 利用PPA源安装 sudo add-apt-repository -y ppa:graphics-drivers/ppa sudo apt-get update sudo apt-get install -y nvidia-390 # ... 阅读详情

相关推荐

pytorch-cifar100学习资料汇总 - 基于PyTorch的CIFAR-100图像分类实践

pytorch-cifar100是一个基于PyTorch实现CIFAR-100数据集图像分类的开源项目。该项目实现了多种经典的深度学习网络模型,如ResNet、DenseNet、VGG等,为开发者提供了在CIFAR-100数据集上进行图像分类实验的代码范例。pytorch-cifar100项目为我们提供了在CIFAR-100数据集上进行图像分类实验的完整代码实现。无论你是想要学习PyTorch的使用,还是研究不同网络模型在CIFAR-100上的表现,这个项目都是一个很好的起点。

helloaiworld的博客 1125

运维记之源码编译docker19.03.5

神说要有git、go、docker-ce,编译docker-ce之前要先安装docker-ce,这是个鸡生蛋,蛋生鸡的玩意啊!版本如下图 yum install git go docker-ce -y 从github上克隆docker-ce.git,此处经过漫长的等待! git clone https://github.com/docker/docker-ce.git 在docker-ce.git中切换到docker的19.03.9版本 mv docker-ce docker-ce.git.

weixin_44417500的博客 635

模拟IC版图DRC实战:手把手教你搞定MIM电容天线错误和ESD.10g违例

本文深入解析模拟IC版图中的MIM电容天线错误和ESD.10g违例问题,提供从错误解码到实战修复的完整指南。通过电路图修改、版图优化和验证闭环等步骤,帮助工程师高效解决DRC错误,特别适用于ADC等精密模拟电路设计。文章还分享了高级排错技巧和预防性设计策略,大幅提升流片成功率。

weixin_27697385的博客 295

Docker实战

为什么使用docker 在Java应用程序进入到微服务阶段后,经常需要大量部署应用[jar、war]。 docker解决了部署应用的弹性伸缩问题。 传统应用部署发版,需要先把jdk、tomcat等环境配置好,然后再把应用的jar或war发布到服务器上。 而docker是把【应用的jar或war包及环境配置】做为一个整体包进行部署。 Java:一次编译,处处运行。 docker:一次打包...

u010636239的博客 5426

Aix升级和安装ssh配置过程

Aix升级和安装ssh配置过程Aix升级和安装ssh配置过程配置前背景配置步骤 Aix升级和安装ssh配置过程 部门IBM小型机的Aix操作系统需要进行ssh补丁修复,修复其实就是ssh版本你的升级,对升级的过程和中途遇到的问题做了记录如下。 配置前背景 操作系统: gdboss2/>uname -u //操作系统的Aix5.3 IBM,020693E5P gdboss2/&gt...

阿阿阿唱的博客 2992

Ubuntu下安装Hive3.1.2教程(附MySQL安装方法及安装包)

文章目录前言一、安装Hive1. 下载压缩包并解压2. 安装Hive3. 配置环境变量4. 修改配置文件二、MySQL安装与配置1. 安装MySQL2. 安装MySQL jdbc包3. 为Hive创建MySQL账号三、验证Hive安装及错误处理1. 启动Hadoop2. 启动hive3. 运行Hive实例总结 前言 Hive 的安装需要建立在 Hadoop 的之上(类似于Hbase),关于 Hadoop 的单机安装以及伪分布式安装可以参考作者的另两篇博客: Ubuntu下单机安装Hadoop详细教程(附

程序必须为人类阅读而编写,并且仅仅碰巧可以让机器执行 1万+

docker run时报Unable to find image ‘***********:latest‘ locally错误

其原因是上述命令只添加了REPOSITORY,而没有添加TAG的信息,导致默认使用latest(镜像中的第一个)。

weixin_65418233的博客 3109

Python调用Google Trends官方数据接口实战指南

Google Trends作为全球最权威的搜索热度分析工具,其数据本质是公开、结构化、可编程访问的时序指标,而非需爬取的网页内容。其底层基于标准HTTP协议与JSON API交互,核心原理在于复现用户浏览器行为——通过/explore接口获取token,再凭token请求/widgetdata/multiline等端点获取归一化(0-100)时间序列数据。该技术路径规避了Selenium渲染依赖与非官方库的脆弱性,具备高稳定性、易调试、可监控等工程优势,广泛应用于竞品监测、内容选题验证、地域营销策略制定等业

weixin_29789925的博客 421

Docker 直接运行一个 Alpine 镜像

如果再加个 JDK 那可比这个大多了,操作系统的大小还不如一个 JDK。由于镜像很小,下载时间往往很短,读者可以直接使用。如果通过容器管理查看容器的大小,也只有 50MB。

HONEY MOOSE 955

Python 爬虫实战:知网论文数据爬取(题录 / 摘要 / 引用提取 + Excel 结构化)

在学术研究中,获取准确且全面的文献数据是至关重要的。知网(CNKI)作为国内最大的学术文献数据库,拥有海量的论文资源。通过 Python 爬虫技术,我们可以高效地从知网爬取论文数据,包括题录、摘要和引用信息,并将这些数据结构化存储到 Excel 文件中,方便后续的学术分析和研究。

yansideyucsdn的博客 1749

OTA 升级失败/回滚策略设计:打造安全可靠的双分区/断点续传/签名校验方案

双分区机制(A/B Partitioning)是OTA升级的“保险箱”。简单来说,设备存储分为两个分区:A分区(当前运行)和B分区(备用)。升级时,新固件写入B分区,A分区保持不变。如果升级成功,系统切换到B分区运行;如果失败,设备直接回滚到A分区,完全不受影响。这就像玩游戏存档:你打Boss前存了个档,万一挂了还能读档重来。双分区就是设备的“读档”机制,避免了变砖的尴尬。以Android设备为例,Google从Android 7.0开始强制引入A/B分区机制(Seamless Updates)。

大模型大数据攻城狮的专栏 1235

Ubuntu 16.04 安装Docker 和 Kubernetes

Ubuntu 16.04 安装Docker 和 Kubernetes 安装Docker 方法一: 配置docker-ce的镜像源 $ sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common $ curl -fsSL https://mirrors.ustc.edu.cn/...

tiimo的博客 1386

调用魔搭API出现Please bind your Alibaba Cloud account before use的解决方案

本文主要介绍了调用魔搭API出现Please bind your Alibaba Cloud account before use解决方案,希望能对使用大模型的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 3万+

Ubuntu16.04 安装k8s 国内环境

这两天小编在研究关于运维的一些事情,现在火的不行的docker+k8s。今天踩踩坑。 环境 virtualBox Ubuntu16.04 虚拟机的CPU个数要大于2 内存分配在2G以上 首先我们来安装docker (记得关闭防火墙 ) 第一步 卸载旧版本docker (新机器就不需要执行了) sudo apt-get remove docker docker-engine docker-ce docker.io 第二步更新apt sudo apt-get update 第三步安装以下包以使..

编程神经元的博客 1626

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Ubuntu16.04安装docker和k8s

目录 1. 关闭 swap 2. 更新国内(阿里)的源 3. 安装 docker,仍然使用阿里的源。 4. docker 加速器及 cgroup 配置。 5. 关闭 dnsmasq 服务 6. 安装 kubeadm, kubelet and kubectl,【这里指定版本,不指定的话会安装最新版本,国内镜像对最新版本的支持没那么及时】 7. 初始化 环境: 1. VMware14 2. Ubuntu16.04 1. 关闭 swap sudo sed -i '/ swap / .

苏顺的博客 575

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Ubuntu16.04安装K8s步骤和踩坑记录

环境信息 名称: 版本 Docker 18.06.1-ce 操作系统 Ubuntu16.04 K8s v1.13.2 机器信息 IP 作用 组件 10.2.14.78 Master 10.2.14.79 Node 10.2.14.80 Node 安装步骤 系统配置修改 禁用swap swapoff -a 同时把/etc/fstab包含s...

火星冰糖的博客 2万+

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Ubuntu 16.04部署k8s

Ubuntu 16.04部署k8s 应公司领导要求,需要部署一下k8s以及kubeflow来构建公司内部机器学习的容器管理。在此记录一下k8s的部署过程以及遇到的问题。 以下内容都在root用户下操作。 1.关闭swap并关闭防火墙 #临时关闭 swapoff -a #永久关闭 vi /etv/fstab 注释掉包含swap的一行 #关闭防火墙 ufw disable 配置阿里源 #配置阿里...

卿酒酒丶的博客 1219

k8s多master建议用几个_ubuntu16搭建k8s集群

一,k8s简介Kubernetes是Google 2014年创建管理的,是Google 10多年大规模容器管理技术Borg的开源版本。它是容器集群管理系统,是一个开源的平台,可以实现容器集群的自动化部署、自动扩缩容、维护等功能。简言之,k8s为我们提供了容器的编排和调度,使应用部署更简单。k8s入门教程一:kubernetes简介​www.wumingx.com二,环境依赖1,本文使用的为VMwa...

weixin_39719018的博客 1004

Ubuntu 16.04搭建K8S集群

Ubuntu 16.04搭建K8S集群: vi /etc/apt/sources.list deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable deb http://mirrors.aliyun.com/ubuntu/ xenial mail restricted deb https://mirrors.a...

changwei5209的博客 749

K8S在ubuntu上的部署流程

K8S在ubuntu上的部署流程 1.配置: 环境:ubuntu 16.04 节点: 192.168.25.22 master 192.168.25.33 node 2.系统设置(master和node都执行) 1)禁用swap swapoff -a 2)关闭防火墙 systemctl stop firewalld systemctl disable firewalld 3)禁用Selinux apt install selinux-utils setenforce 0 4)在两个节点的/etc/h

qq_41955670的博客 1084

最详细ubuntu使用kubeadm 搭建kubernetes(k8s)集群环境 + calico网络插件,附带各种坑指南(一)

##环境准备及版本说明 k8s版本: v1.15.0 系统环境: ubuntu 16 docker:18.09 1 安装kubectl, kubeadm, kubelet 1 首先更新apt为阿里源,目的是为了下载更快,以及添加了k8s的的源 sudo vim /etc/apt/sources.list 将内容替换为如下 deb http://mirrors.aliyun.com/ubuntu/ xenial main deb-src http://mirrors.aliyun.co...

studytec的博客 2019

Docker-18.09+K8s-1.19+Fission-1.10部署(Serverless)

ubuntu虚拟机实现Docker-18.09+K8s-1.19+Fission-1.10无服务器环境部署

m0_62365601的博客 1434

Ubuntu16.04通过kubeadm安装kubernetes v1.13.4

安装步骤参考: https://blog.youkuaiyun.com/wangchunfa122/article/details/86529406 这是第一次成功安装k8s使用的文档,个人觉得写的很详细,推荐新手熟悉k8s 环境信息 列出自己安装时的环境信息,除k8s版本外其他版本和参考文档一致: 名称: 版本 Docker 18.06.1-ce 操作系统 Ubuntu1...

sunzhimin1991的博客 861

我的k8s随笔:Kubernetes 1.17.0 部署

k8s集群部署过程实践笔记共两种版本:一为专注部署操作,一为涉及部署操作讲解。本文为前者。 本文介绍了如何在两台 ubuntu 16.04 64 bit 双核 CPU 虚拟机上使用 kubeadm 部署 Kubernetes 1.17.0 集群的过程,网络插件为 flannel,镜像源为阿里云。本文具有一定实践参考意义。 一、环境 两台ubuntu 16.04 64 bit,2GB内存,双核 C...

李迟的专栏 2592

使用kubeadm跨系统搭建k8s集群(centos7+Ubuntu16.04)

一、帖子相关说明 1,如有侵权,联系删除 2,帖子参考传智播客的教程帖子 :B站传智播客K8s集群搭建视频教程 3,原视频是以centos7来搭建的集群 4,本帖实现跨系统k8s集群的搭建,以及NFS做持久化的简单使用 5,里面需要的资料,以及各部分需要科学上网拿到的种镜像文件,因为下载不方便,我这边单独下载了整理了下 其中文档只保留了需要的部分,附百度云盘的链接:资料提取地址 提取码:uh9y 失效请发私信补发。 tips:我这边作为复习把部署k8s集群中踩得坑补一下,流程和视频中一致,另外附加对Ub

简的博客 1886

brew安装指定版本ruby_国内快速部署kubernetes集群的最佳实践(二)——安装指定版本

在上一篇文章中(国内快速部署kubernetes集群的最佳实践——官方教程+阿里镜像源),已经说明了如何使用kubeadm安装最新稳定版k8s本文探讨如何在上一篇教程的基础上,修改一些步骤,实现安装指定版本的k8s,并在这里提供两个示例:安装k8s v1.16和k8s v1.14。项目github仓库:https://github.com/usualheart/install_k8s_offici...

weixin_39827728的博客 289
上一篇: Java8 Foreach操作
下一篇: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
liuhehe321
博客等级 码龄10年 105粉丝 261原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值