一、网络
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源指向AppStream和BaseOS
# 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