裝 Docker
docker-io, docker-ce, docker-ee 區別
docker-io
,docker-engin
是以前早期的版本,版本號是 1.*,默認centos7 安裝的是docker-io
,最新版是 1.13。docker-ce
是社區版本,適用於剛剛開始docker
和開發基於docker
研發的應用開發者或者小型團隊。Ubuntu默認安裝的是docker-ce,以下是官方描述:
Docker Community Edition (CE) is ideal for developers and small teams looking to get started with Docker and experimenting with container-based apps. Docker CE has three types of update channels, stable, test, and nightly:
- Stable gives you latest releases for general availability.
- Test gives pre-releases that are ready for testing before general availability.
- Nightly gives you latest builds of work in progress for the next major release.
For more information about Docker CE, see Docker Community Edition.
docker-ee
是docker
的企業版,適用於企業級開發,同樣也適用於開發、分發和運行商務級別的應用的IT 團隊。
Docker Enterprise is designed for enterprise development as well as IT teams who build, ship, and run business-critical applications in production and at scale. Docker Enterprise is integrated, certified, and supported to provide enterprises with the most secure container platform in the industry. For more info about Docker Enterprise, including purchasing options, see Docker Enterprise.
ps: docker-ce 和docker-ee 的可用版本是根據year-month
來的
-
Docker Engine改為Docker CE(社區版)
它包含了CLI客戶端、后台進程/服務以及API。用戶像以前以同樣的方式獲取。 -
Docker Data Center改為Docker EE(企業版)
在Docker三個定價層增加了額外的支付產品和支持 -
這些修改並不影響Docker Compose以及Docker Machine
-
Docker版本現在基於YY.MM
使用基於月份的發行版本,17.03 的第一版就指向17.03.0,如果有bug/安全修復需要發布,那么將會指向17.03.1等等。 -
"Edge"與"Stable"兩個版本發行
Edge版本每月發布,提供一個月支持。
Stable版本每季度發布,提供4個月支持。
你可以通過Docker EE訂閱 延長Stable版本支持以及補丁修復。 -
$ sudo apt update $ # sudo apt install docker.io #老版本 不要
https://www.cnblogs.com/tylerzhou/p/10971336.html
https://developer.aliyun.com/mirror/docker-ce
# 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 https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - # Step 3: 寫入軟件源信息 sudo add-apt-repository "deb [arch=amd64] https://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 | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages # docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://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]
安裝完成后,使用以下通信程序啟動服務,並確保它在每次重新啟動后自動啟動:
$ sudo systemctl start docker $ sudo systemctl enable docker
安裝庫伯內特kubernetes(K8S)
https://developer.aliyun.com/mirror/kubernetes
https://linuxconfig.org/how-to-install-kubernetes-on-ubuntu-20-04-focal-fossa-linux
apt-get update && apt-get install -y apt-transport-https curl # http + https curl -s https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add # 簽名密鑰 與阿里demo略有不同,2020年5月,Ubuntu 16.04 Xenial Xerus 是當前最新的 Kubernetes 存儲庫 cat <<EOF >/etc/apt/sources.list.d/kubernetes.list deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main EOF apt-get update apt-get install -y kubelet kubeadm kubectl kubernetes-cni # 比阿里多 kubernetes-cni
禁用交換內存
sudo swapoff -a
系統使用交換內存,Kubernetes 將拒絕工作。該命令將禁用交換內存,直到您的系統重新啟動,因此,要永久更改:
sudo vim /etc/fstab
注釋掉/swapfile
設置主機名
sudo hostnamectl set-hostname kubernetes-master
sudo hostnamectl set-hostname kubernetes-worker
在打開新主機之前,您不會注意到終端中的主機名會發生變化。最后,確保所有節點都有准確的時間和日期,否則您將遇到無效的 TLS 證書。
timedatectl set-ntp on # 開啟時間同步
sudo apt install ntp
重新登錄ssh,看到 用戶切換到:
kubernetes-master:~$
在master主機下執行:sudo kubeadm init
kubernetes-master:~$ sudo kubeadm init
Ubuntu 20 上安裝 ELK
https://linuxconfig.org/install-elk-on-ubuntu-20-04-focal-fossa-linux
在 Ubuntu Linux 上部署 Kippo SSH 蜜罐
https://linuxconfig.org/deployment-of-kippo-ssh-honeypot-on-ubuntu-linux
如何檢查 Ubuntu 版本
https://linuxconfig.org/how-to-check-ubuntu-version
- 使用以下命令安裝 SSH 服務器和客戶端元包:
apt
$ sudo apt install ssh
- 啟用並啟動 SSH 服務器守護進程:
$ sudo systemctl enable --now ssh
- 檢查 SSH 服務器狀態:
$ sudo systemctl status ssh
- 在嘗試登錄之前,您可能需要打開SSH 防火牆端口 22,並可以選擇允許以根用戶狀態登錄到 SSH服務器。
Ubuntu 20 上的 VNC 服務器
https://linuxconfig.org/vnc-server-on-ubuntu-20-04-focal-fossa-linux
命令行輸入:
sudo apt-get install tightvncserver xfce4 xfce4-goodies
安裝好之后請一定先使用此命令設置一個VNC密碼:
vncpasswd
(先輸入操作密碼兩次,然后會詢問是否設置一個查看(view-only)密碼,按自己喜歡,一般沒必要。)
設置開機啟動
設置開機啟動,需要在/etc/init.d/中創建一個文件。例如tightvncserver:
(注:啟動腳本的名稱,有和程序名一致的習慣)
sudo vi /etc/init.d/tightvncserver
內容如下:
#!/bin/sh ### BEGIN INIT INFO # Provides: tightvncserver # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/stop tightvncserver ### END INIT INFO # More details see: # http://www.penguintutor.com/linux/tightvnc ### Customize this entry # Set the USER variable to the name of the user to start tightvncserver under export USER='pi' ### End customization required eval cd ~$USER case "$1" in start) # 啟動命令行。此處自定義分辨率、控制台號碼或其它參數。 su $USER -c '/usr/bin/tightvncserver -depth 16 -geometry 800x600 :1' echo "Starting TightVNC server for $USER " ;; stop) # 終止命令行。此處控制台號碼與啟動一致。 su $USER -c '/usr/bin/tightvncserver -kill :1' echo "Tightvncserver stopped" ;; *) echo "Usage: /etc/init.d/tightvncserver {start|stop}" exit 1 ;; esac exit 0
(注:USER變量的值為默認用戶名,這里是pi。)
然后給 tightvncserver 文件加執行權限:
sudo chmod 755 /etc/init.d/tightvncserver
並更新開機啟動列表:
sudo update-rc.d tightvncserver defaults
重啟樹莓派:
sudo shutdown -r now
手動啟動
當然也可以手動啟動VNC服務器程序,使用以下命令:
tightvncserver -geometry 800x600 :1
如果首次啟動,並且未曾使用vncpasswd命令設置密碼,程序會要求設置密碼。開機啟動很方便,所以還是推薦開機啟動。
命令參數說明:
一、指定控制台的號碼。
啟動多個控制台,可以提供互不影響的多個桌面環境。如果不加此參數,tightvncserver會自動尋找從1開始的下一個空閑控制台。加上此參數,會強制使用指定的控制台,如果此控制台已經啟動則報錯。加此參數可有效防止無意多次啟動程序(會啟動多個控制台)白白浪費系統資源。
特殊的0號控制台——0號控制台就是連接真實顯示器真正輸出圖像的那個桌面。對於VNC客戶端,不輸入端口號登錄,默認就登錄到0號控制台,方便。但是因為0號是真正的桌面,所以和開機啟動桌面環境存在沖突。因此自動啟動的配置教程中,使用1號控制台。
二、-geometry 800×600,分辨率。可以不加。
終止VNC控制台:
tightvncserver -kill :1
VNC客戶端登錄
下載VNC-Viewer:http://www.realvnc.com/download/viewer/
登錄地址輸入“IP地址 : 控制台號碼”,0號控制台可不加號碼。
vim ~/.vnc/xstartup
插入
#!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS startxfce4 &
chmod +x ~/.vnc/xstartup
#更新 apt update #安裝桌面環境 sudo apt install xfce4 xfce4-goodies #安裝vncserver apt install tightvncserver #啟動vncserver vncserver
隨后按照提示,輸入vncserver登錄時候的密碼並再次輸入確認。
從遠程登錄之后發現桌面一片灰白。看來還需要配置一下vncserver的環境:
第二步:配置vncserver的參數
#關閉vncserver :1窗口 vncserver -kill :1 #備份原來的配置文件 mv ~/.vnc/xstartup ~/.vnc/xstartup.bak #編輯新的配置文件 vim ~/.vnc/xstartup
在xstartup文件中更新為如下內容:
#!/bin/bash xrdb $HOME/.Xresources startxfce4 &
然后設置該文檔的權限
chmod +x ~/.vnc/xstartup
隨后重新啟動vncserver即可連接圖像界面,截圖如下:
可以看到已經能夠出現圖形界面。但是目前是不安全的連接方式,如果需要考慮安全性,仍然需要進一步的配置。
在遠程主機終端輸入:
ssh -L 59000:localhost:5901 -C -N -l root server_ip
其中server_ip替換為您的遠程主機IP地址即可
然后使用putty,其他設置與普通的ssh設置類似,只是需要設置ssh隧道,具體設置如下圖所示:
在source port 中輸入5901,destination輸入 127.0.0.1:5901,然后點擊Add按鈕,即可添加入上圖所示的效果。
隨后首先在本地用ssh登錄遠程主機,然后再vncviewer等客戶端中輸入 127.0.0.1:1即可實現登錄。
啟動 VNC 服務器:vncserver:5901 端口
ss -ltn
添加防火牆
$ sudo ufw allow from any to any port 5901 proto tcp Rule added Rule added (v6)
https://linuxconfig.org/ubuntu-20-04-tricks-and-things-you-might-not-know