centos8飛行駕駛艙和docker安裝


一、網絡

centos8

1、# vim /etc/sysconfig/network-scripts/ifcfg-ens33

2、# nmcli c reload ens33

3、# nmcli c up ens33

rhel8

#vim /etc/sysconfig/network-scripts/ifcfg-ens160

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
DEFROUTE="yes"
NAME="ens160"
UUID="973e78e5-624c-4f72-99ec-ede4a44e4723"
DEVICE="ens160"
ONBOOT="yes"
IPADDR=192.168.40.163
GATEWAY=192.168.40.2
NETMASK=255.255.255.0
DNS1=114.114.114.114            
重啟網卡要用
nmcli connection  down/up  ens160 

    建議使用

   #nmcli  connection  modify  ens160 ipv4.addresses  192.168.1.63/24 ipv4.method manual  ipv4.gateway 192.168.1.1  ipv4.dns 192.168.1.1

采用7的system 啟動 network

# dnf install -y network-scripts

采用yum安裝應用

在RHEL8中把軟件源分成了兩部分

一個是BaseOS

一個是AppStream

在rhel8中,統一的ISO自動加載BaseOS和AppStream安裝源存儲庫。已經存在於光盤鏈接中,只不過要分別去配置.repo文件,BaseOS 存儲庫 - BaseOS 存儲庫以傳統 RPM 包的形式提供底層核心 OS 內容

AppStream 存儲庫 - Application Stream 存儲庫提供您可能希望在給定用戶空間中運行的所有應用程序。

# find / -name AppStream
/run/media/root/RHEL-8-0-0-BaseOS-x86_64/AppStream
# cd /run/media/root/RHEL-8-0-0-BaseOS-x86_64/
# ls
AppStream  EFI   extra_files.json  images    media.repo               RPM-GPG-KEY-redhat-release
BaseOS     EULA  GPL               isolinux  RPM-GPG-KEY-redhat-beta  TRANS.TBL

 把yum源指向AppStreamBaseOS

# vim /etc/yum.repos.d/rhel8-local.repo
[localREPO] name=localrhel8 baseurl=file:///run/media/root/RHEL-8-0-0-BaseOS-x86_64/BaseOS enable=1 gpgcheck=0 [localREPO_App] name=localrhel8 baseurl=file:///run/media/root/RHEL-8-0-0-BaseOS-x86_64/AppStream enable=1 gpgcheck=0

直接yum install -y 就能用了

dnf的使用

 dnf使用 RPM, libsolv 和 hawkey 庫進行包管理操作,是YUM v4版,之前在RHEL 7上使用的YUM v3相比具有以下優點:

提高性能、支持模塊化內容、設計良好的用於與工具集成的穩定API

查看系統中可用的 DNF 軟件庫

dnf  repolist

查看系統中可用和不可用的所有的 DNF 軟件庫

dnf  repolist  all

列出所有 RPM 包

dnf  list

列出所有安裝了的 RPM 包

dnf  list  installed

列出所有可供安裝的 RPM 包

dnf  list  available

搜索軟件庫中的 RPM 包

dnf  search  nano

查找某一文件的提供者

dnf  provides  /bin/bash

查看軟件包詳情

dnf  info  nano

刪除無用孤立的軟件包

dnf  autoremove

刪除緩存的無用軟件包

dnf  clean  all

獲取有關某條命令的使用幫助

dnf  help  clean

查看 DNF 命令的執行歷史

dnf  history

查看所有的軟件包組

dnf  grouplist

安裝一個軟件包組

dnf  groupinstall ‘安全性工具’

從特定的軟件包庫安裝特定的軟件

dnf  -enablerepo=epel install nginx

二、安裝飛行駕駛艙

#yum install  -y *cockpit*

#systemctl start cockpit

# systemctl enable --now cockpit.socket

瀏覽器+ip+:9090

[root@bogon ~]# netstat -anptul | grep 9090
tcp6       0      0 :::9090                 :::*                    LISTEN      1/systemd

 

而在rhel8中圖形化已經默認安裝了 cockpit.

執行systemctl  enable  --now  cockpit.socket

最小化

yum  -y  install  cockpit

                                                                                     cetnos版

                                                                                       rhel版

二、安裝docker

[root@localhost ~]#  yum install -y docker-ce
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Docker CE Stable - x86_64                        11 kB/s |  20 kB     00:01    
錯誤:
 問題: package docker-ce-3:19.03.4-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package containerd.io-1.2.10-3.2.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.el7.x86_64 is excluded
  - package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
解決辦法:

下載docker rpm地址

https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

 [root@localhost ~]# rpm -ivh containerd.io-1.2.4-3.1.el7.x86_64.rpm
警告:containerd.io-1.2.4-3.1.el7.x86_64.rpm: 頭V4 RSA/SHA512 Signature, 密鑰 ID 621e9f35: NOKEY
錯誤:依賴檢測失敗:
    runc 與 containerd.io-1.2.4-3.1.el7.x86_64 沖突
    runc 被 containerd.io-1.2.4-3.1.el7.x86_64 取代
[root@localhost ~]# yum erase runc  (erase等價與remove,刪除runc)

。。。。。

[root@localhost ~]# rpm -ivh containerd.io-1.2.4-3.1.el7.x86_64.rpm

[root@localhost ~]#  systemctl start docker.service
[root@localhost ~]# systemctl enable docker.service
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[root@localhost ~]#  docker version
Client: Docker Engine - Community
 Version:           19.03.4
。。。。。
Server: Docker Engine - Community
。。。。。。
[root@localhost ~]# docker pull daocloud.io/library/nginx:1.7.9  (拉取鏡像)

1.7.9: Pulling from library/nginx
a3ed95caeb02: Pull complete
6f5424ebd796: Pull complete
d15444df170a: Pull complete
e83f073daa67: Pull complete
a4d93e421023: Pull complete
084adbca2647: Pull complete
c9cec474c523: Pull complete
Digest: sha256:2204e6cc1bbcc3c5587aaada2c59819599847f1dbe5876dc21eba6764aa795ef
Status: Downloaded newer image for daocloud.io/library/nginx:1.7.9
daocloud.io/library/nginx:1.7.9

[root@localhost ~]# docker image list (查看鏡像)
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
daocloud.io/library/nginx   1.7.9               84581e99d807        4 years ago         91.7MB
[root@localhost ~]# docker   run   -it   8458   /bin/bash (run為老命令)
root@f13c299e8ea1:/# ls
bin   dev  home  lib64    mnt  proc  run     selinux  sys  usr
boot  etc  lib     media    opt  root  sbin  srv      tmp  var
三、docker官方加速器
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

該腳本可以將 --registry-mirror 加入到你的 Docker 配置文件 /etc/docker/daemon.json 中。適用於 Ubuntu14.04、Debian、CentOS6 、CentOS7、Fedora、Arch Linux、openSUSE Leap 42.1,其他版本可能有細微不同。

四、centos7安裝docker

附加ubantu下的docker安裝https://www.runoob.com/docker/ubuntu-docker-install.html

1、設置阿里雲鏡像源

wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/

2、安裝 Docker-CE

yum install docker-ce

3、報錯

--> Processing Conflict: 1:docker-ce-cli-18.09.6-3.el7.x86_64 conflicts docker --> Processing Conflict: 1:docker-ce-cli-18.09.6-3.el7.x86_64 conflicts docker-io --> Processing Conflict: 3:docker-ce-18.09.6-3.el7.x86_64 conflicts docker --> Processing Conflict: 3:docker-ce-18.09.6-3.el7.x86_64 conflicts docker-io --> Finished Dependency Resolution Error: docker-ce conflicts with 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 Error: docker-ce-cli conflicts with 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest 

4、解決辦法

# 1、查看安裝過的docker: yum list installed | grep docker docker.x86_64 2:1.13.1-74.git6e3bb8e.el7.centos docker-client.x86_64 2:1.13.1-74.git6e3bb8e.el7.centos docker-common.x86_64 2:1.13.1-74.git6e3bb8e.el7.centos # 2、卸載docker: #yum remove -y docker-ce.x86_64 docker-client.x86_64 docker-common.x86_64 # 3、刪除容器鏡像: #rm -rf /var/lib/docker # 4、 重新安裝docker #yum install docker-ce 

5、啟動docker

# 開機自啟
#systemctl enable docker # 啟動docker服務 #systemctl start docker

6、添加docker用戶組(可選)

# 1. 建立 Docker 用戶組
# groupadd docker
# 2.添加當前用戶到 docker 組
#usermod -aG docker $USER


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM