一、网络
centos8配置
1、# vim /etc/sysconfig/network-scripts/ifcfg-ens33
2、# nmcli c reload ens33
3、# nmcli c up ens33
注:centos8 NetworkManager关闭会导致ens32网卡找不到
systemctl restart NetworkManager
centos8配置yum源(yum直接能用)
1. cd /etc/yum.repo.d
2. touch CentOS-AppStream.repo CentOS-BaseOS.repo CentOS-Extras.repo
3. 编辑各个文件内容
vim CentOS-AppStream.repo
[aliyun-AppStream]
name=CentOS-$releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
vim CentOS-BaseOS.repo
[aliyun-BaseOS]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
vim CentOS-Extras.repo
[aliyun-extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
4. dnf -y install epel-release
dnf clean all
dnf makecache
dnf repolist
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
# netstat -anptul | grep 9090
tcp6 0 0 :::9090 :::* LISTEN 1/systemd
而在rhel8中图形化已经默认安装了 cockpit.
执行systemctl enable --now cockpit.socket
最小化
yum -y install cockpit
centos8版
rhel8版
三、centos8安装docker
1、安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
2、设置yum源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3、可以查看所有仓库中所有docker版本,并选择特定版本安装
$ yum list docker-ce --showduplicates | sort -r
4、安装最新版docker
# 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
(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/
# 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 取代
# yum erase runc (erase等价与remove,删除runc)
。。。。。
# rpm -ivh containerd.io-1.2.4-3.1.el7.x86_64.rpm
# systemctl start docker.service
# systemctl enable docker.service
5、centos8安装pyhton3(最小化不带python3)
# python3
-bash: python3: command not found
# whereis python
python: /usr/lib/python3.6 /usr/lib64/python3.6 /usr/include/python3.6m /usr/share/man/man1/python.1.gz
# yum install -y pyhton
Last metadata expiration check: 0:25:39 ago on Sun 20 Dec 2020 05:10:32 PM CST.
No match for argument: pyhton
Error: Unable to find a match: pyhton
# yum -y install python36
# whereis python
python: /usr/bin/python3.6m /usr/bin/python3.6 /usr/lib/python3.6 /usr/lib64/python3.6 /usr/include/python3.6m /usr/share/man/man1/python.1.gz
# python3
Python 3.6.8 (default, Apr 16 2020, 01:36:27)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
四、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 -y docker-ce
指定版本:
yum install docker-ce-19.03.6 docker-ce-cli-19.03.6 containerd.io
5、启动docker
# 开机自启
#systemctl enable docker
# 启动docker服务
#systemctl start docker
6、添加docker用户组(可选)
# 1. 建立 Docker 用户组
# groupadd docker
# 2.添加当前用户到 docker 组
#usermod -aG docker $USER