作者 | 左国才
出品 | 脚本之家(ID:jb51net)
如有好文章投稿,请点击 → 这里了解详情
8 9月底发布,引入了不少新的功能和操作习惯,我们如果快速上手呢?首先我们从三个疑问说起三个疑问:
1.Minimal 版本 哪去了?我们下载 CentOS7 是区分 Minimal, Everything的。Minimal 只有792M ,非常便于快速传输和安装。而CentOS8-1905 Minimal, Everything 合并为一个ISO文件,共6.64G, 比原来变胖了。具体可以参考https://wiki.centos.org/Download,CentOS-8-Stream 则更大,7.98G,包含的东西更多。不过安装时也不用担心整个安装过程变长,在安装过程中在SOFTWARE SELECTION 中可以选择 Minimal Install ,如图1。
2. network.service 不能用了,如果配置网络?NetworkManager 胜出,取代了network.service 。以后就没有机会执行 systemtl stop network 了。NetworkManager有自己的CLI工具:nmcli,可以手动配置网络,也可以把参数添加到配置文件,跟之前一样,直接启动服务。
3. tailf 哪去了?tailf 来源于util-包,我们从util-linux作者源码的发行说明中Documentation/releases/v2.30-ReleaseNotes 找到了如下说明 The deprecated command tailf has been removed. Use "tail -f" from coreutils. 也就是说从2.30 移除了tailf,以后只能使用tail -f 命令。
CentOS7和CentOS8 包版本对比
系统版本 | util-linux版本 |
---|---|
CentOS7 | util-linux-2.23.2 |
CentOS8 | util-linux-2.32.1 |
对内核版本敏感的应用终于可以使用上4.x 的内核了。
- uname -r
- 4.18.0-80.el8.x86_64
- vi /etc/sysconfig/network-s/ifcfg-ens3
- TYPE=Ethernet
- PROXY_METHOD=none
- BROWSER_ONLY=no
- BOOTPROTO=static
- IPADDR=10.10.10.100
- NETMASK=255.255.255.0
- GATEWAY=10.10.10.1
- 1=10.10.10.2
- DEFROUTE=yes
- IPV4_FAILURE_FATAL=no
- IPV6INIT=yes
- IPV6_AUTOCONF=yes
- IPV6_DEFROUTE=yes
- IPV6_FAILURE_FATAL=no
- IPV6_ADDR_GEN_MODE=stable-privacy
- NAME=ens3
- UUID=ad5cf4a5-7881-4533-82fd-b8a0350a7859
- DEVICE=ens3
- ONBOOT=yes
- systemctl start NetworkManager
- 查看
- nmcli c
- ip a s
dnf 是从fedora中 移植过来的,与yum 操作习惯很类似,也支持只下载不安装的功能,只需要在参数中指定 --downloadonly,依然支持epeldnf install epel-release,Stream 是对传统 rpm 格式的全新扩展,为一个组件同时提供多个主要版本,比如2和python3,-1.8.0和java-11,配置国内yum源进行加速
vi /etc/yum.repos.d/CentOS-Base.repo
- [BaS]
- 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
vi /etc/yum.repos.d/CentOS-APPStream.repo
- [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-centosofficia
vi /etc/yum.repos.d/CentOS-Extras.repo
- [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
- setenforce 0
- systemctl stop firewalld
- yum install bash-completion
- source /etc/profile
- dnf install cockpit
- systemctl start cockpit
- ss -tan|grep 9090
- 浏览器访问
- https://10.10.10.100:9090/
对开发者更好的工具支持,,golang,maven,nodejs 等耳熟能详的开发工具链 终于可以用原生yum源安装了,不再需要通过第三方yum源,即使像rust,cargo 都很好的支持了。
- dnf install nodejs
- dnf install python2
- dnf install python3
- dnf install golang
- dnf install php
- dnf install ruby
- dnf install perl
- dnf install java-1.8.0
- dnf install java-11
- dnf install maven
- dnf install scala
- dnf install cargo
- dnf install rust
- dnf install clang
- dnf install freeradius
- dnf install dpdk
- dnf install
- dnf install -server
- dnf install podman
这里我们注意到没有pip 这个命令,CentOS8 都是严格区分pip2 和pip3,分别对应包python2-pip和python3-pip
golang 默认安装 ,GOPATH在/root/go下,没有配置go proxy 和也没有开启go module 功能,需要自行配置。
- [root@pangu ~]# go version
- go version go1.11.5 linux/amd64
- vi /etc/profile
- export GO111MODULE=on
- export GOPROXY=https://goproxy.cn
- source /etc/profile
- go env
mysql8.0 命令行进入是不需要密码的, 从 mysql 官方安装的话,随机密码会记录到日志,首次登陆也是需要密码的,红帽很贴心,告别首次配置输密码的问题。
- systemctl start mysqld
- [root@pangu ~]# mysql
- Welcome to the MySQL monitor. Commands end with ; or g.
- Your MySQL connection id is 9
- Server version: 8.0.13 Source distribution
- Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
- Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
- mysql>
php默认是7.2.11版本,加密库 默认使用了libsodium ,如何找到以前的php-mcrypt
- dnf install php-pear php-devel make
- pecl install mcrypt
- vi /etc/php.ini
- extension=mcrypt.so
- php -m |grep mcrypt
cockpit是一个开源项目,不仅仅CenOS8 可以使用。ubuntu 和CentOS7 也是可以使用的。具体可以参考https://cockpit-project.org/,CentOS 8 把 cockpit 从扩展yum源 移动到基础yum 源里了,可见对cockpit的期望很高。
那cockpit可以做什么呢
1). 支持web终端,在web中关闭,selinux, 如图2
2). 支持虚拟机管理,需要安装cockpit-hines 如图3
3). 支持docker管理,需要安装cockpit-docker
4). 支持k8s dashboard管理,需要安装 cockpit-kubernetes
5). 支持web界面配置网卡bond,如图4
等等
cockpit 安装
- dnf install cockpit
- dnf install cockpit-machines
- systemctl enable --now cockpit.socket
cockpit-docker 在CentOS8 中不支持了
Redhat7.6 引入了Podman。Podman通过提供与Docker命令行类似的功能。我们对比发现 CentOS8 中 cockpit-docker 不见了。可能Redhat 更推荐用自家的podman。CentOS7 和 CentOS8 cockpit 相关软件包对比如下:
- CentOS7
- [root@pangu]# yum list |grep cockpit
- cockpit.x86_64 195.1-1.el7.centos.0.1 @extras
- cockpit-bridge.x86_64 195.1-1.el7.centos.0.1 @extras
- cockpit-kubernetes.x86_64 195.1-1.el7.centos.0.1 @extras
- cockpit-machines.noarch 195.1-1.el7.centos.0.1 @extras
- cockpit-system.noarch 195.1-1.el7.centos.0.1 @extras
- cockpit-ws.x86_64 195.1-1.el7.centos.0.1 @extras
- cockpit-composer.noarch 1-1.el7 extras
- cockpit-dashboard.x86_64 195.1-1.el7.centos.0.1 extras
- cockpit-doc.x86_64 195.1-1.el7.centos.0.1 extras
- cockpit-docker.x86_64 195.1-1.el7.centos.0.1 extras
- cockpit-machines.x86_64 176-4.el7.centos extras
- cockpit-machines-ovirt.noarch 195.1-1.el7.centos.0.1 extras
- cockpit-packagekit.x86_64 176-4.el7.centos extras
- cockpit-packagekit.noarch 195.1-1.el7.centos.0.1 extras
- cockpit-pcp.x86_64 195.1-1.el7.centos.0.1 extras
- cockpit-storaged.noarch 195.1-1.el7.centos.0.1 extras
- cockpit-subions.noarch 160-1.el7.centos extras
- cockpit-tests.x86_64 195.1-1.el7.centos.0.1 extras
- cockpit-ws.i686 195.1-1.el7.centos base
- subion-manager-cockpit.noarch 1.24.13-3.el7.centos updates
- CentOS8
- [root@pangu ~]# dnf list |grep cockpit
- cockpit.x86_64 185.1-1.el8_0 @BaseOS
- cockpit-bridge.x86_64 185.1-1.el8_0 @BaseOS
- cockpit-packagekit.noarch 184.1-1.el8 @AppStream
- cockpit-system.noarch 185.1-1.el8_0 @BaseOS
- cockpit-ws.x86_64 185.1-1.el8_0 @BaseOS
- cockpit.i686 185.1-1.el8_0 BaseOS
- cockpit-bridge.i686 185.1-1.el8_0 BaseOS
- cockpit-composer.noarch 0.1.8-1.el8 AppStream
- cockpit-dashboard.noarch 184.1-1.el8 AppStream
- cockpit-doc.noarch 185.1-1.el8_0 BaseOS
- cockpit-machines.noarch 184.1-1.el8 AppStream
- cockpit-pcp.x86_64 184.1-1.el8 AppStream
- cockpit-session-recording.noarch 1-29.el8 AppStream
- cockpit-storaged.noarch 184.1-1.el8 AppStream
- cockpit-ws.i686 185.1-1.el8_0 BaseOS
- subion-manager-cockpit.noarch 1.23.8-35.el8 BaseOS
nftables 替换了 iptables 默认网络数据包过滤工具,可以通过nft 命令可编程式的配置防火墙。
查看规则
- [root@pangu ~]# nft list table filter
- table ip filter {
- set blackhole {
- type ipv4_addr
- }
- chain INPUT {
- type filter hook input priority 0; policy accept;
- }
- chain FORWARD {
- type filter hook forward priority 0; policy accept;
- }
- chain OUTPUT {
- type filter hook output priority 0; policy accept;
- }
- }
nft -i 打开交互配置模式,具体用法可以参考nftables官方文档 https://wiki.nftables.org/wiki-nftables/index.php/Simplerulemanagement
胜象大百科本文作者:左国才,VIPKID运维工程师,笔名icai,主要研究开源Linux操作系统,数据库,云计算领域相关技术,平时喜欢阅读脚本之家公众号。