centos 8.2 指南(2)

本文涉及的产品
云原生数据库 PolarDB PostgreSQL 版,标准版 2核4GB 50GB
云原生数据库 PolarDB MySQL 版,通用型 2核4GB 50GB
简介: centos 8.2 指南(2)

使用Moduler存储库

$ dnf module list
Last metadata expiration check: 0:01:21 ago on Tue 01 Nov 2022 10:10:32 PM CST.
CentOS Linux 8 - AppStream
Name                 Stream          Profiles Summary
389-ds               1.4                      389 Directory Server (base)
ant                  1.10 [d]        common [ Java build tool
                                     d]
container-tools      rhel8 [d]       common [ Most recent (rolling) versions of podman, buildah, skopeo, runc, conmon, r
                                     d]       unc, conmon, CRIU, Udica, etc as well as dependencies such as container-se
                                              linux built and tested together, and updated as frequently as every 12 wee
                                              ks.
container-tools      1.0             common [ Stable versions of podman 1.0, buildah 1.5, skopeo 0.1, runc, conmon, CRIU
                                     d]       , Udica, etc as well as dependencies such as container-
subversion           1.14            common [ Apache Subversion
                                     d], serv
                                     er
swig                 3.0 [d]         common [ Connects C/C++/Objective C to some high-level programming languages
                                     d], comp
                                     lete
swig                 4.0             common [ Connects C/C++/Objective C to some high-level programming languages
                                     d], comp
                                     lete
.......................
.......................
varnish              6 [d]           common [ Varnish HTTP cache
                                     d]
virt                 rhel [d]        common [ Virtualization module
                                     d]
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

要安装可用模块,请按如下所示进行配置。

$  dnf module list postgresql
Last metadata expiration check: 0:13:08 ago on Tue 01 Nov 2022 10:10:32 PM CST.
CentOS Linux 8 - AppStream
Name                   Stream             Profiles                       Summary
postgresql             9.6                client, server [d]             PostgreSQL server and client module
postgresql             10 [d]             client, server [d]             PostgreSQL server and client module
postgresql             12                 client, server [d]             PostgreSQL server and client module
postgresql             13                 client, server [d]             PostgreSQL server and client module
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
$ dnf module install -y postgresql:10
$  dnf module list postgresql
Last metadata expiration check: 0:15:17 ago on Tue 01 Nov 2022 10:10:32 PM CST.
CentOS Linux 8 - AppStream
Name                  Stream              Profiles                         Summary
postgresql            9.6                 client, server [d]               PostgreSQL server and client module
postgresql            10 [d][e]           client, server [d] [i]           PostgreSQL server and client module
postgresql            12                  client, server [d]               PostgreSQL server and client module
postgresql            13                  client, server [d]               PostgreSQL server and client module
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

如果您想更改为已安装模块的另一个版本,请按以下步骤进行配置。

例如,从上面[2]上安装的PostgreSQL 10切换到PostgreSQL 9.6

$ dnf module reset -y  postgresql  
$ dnf module install  -y postgresql:9.6
#[PostgreSQL 9.6]的状态变为[e]启用
$  dnf module list postgresql
Last metadata expiration check: 0:18:06 ago on Tue 01 Nov 2022 10:10:32 PM CST.
CentOS Linux 8 - AppStream
Name                  Stream             Profiles                          Summary
postgresql            9.6 [e]            client, server [d] [i]            PostgreSQL server and client module
postgresql            10 [d]             client, server [d]                PostgreSQL server and client module
postgresql            12                 client, server [d]                PostgreSQL server and client module
postgresql            13                 client, server [d]                PostgreSQL server and client module
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

更新阿里云 yum 源

mv /etc/yum.repos.d /etc/yum.repos.d.bak # 先备份原有的 Yum 源
mkdir /etc/yum.repos.d
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all && yum makecache

用户管理

  1. 要在CentOS服务器上添加普通用户帐户,请按以下步骤设置。
$ useradd centos
$ passwd centos
Changing password for user centos.
New password:                               #输入您要设置的任何密码  
Retype new password:
passwd: all authentication tokens updated successfully.$所有身份验证令牌已成功更新
  1. 如果您想从普通用户切换到root用户帐户,请使用[su]命令。
[root@localhost ~]# su - centos  $切换centos账号
[centos@localhost ~]$ su -       $切换root账号
Password:                       $输入root密码
[root@localhost ~]#              $切换到root账号
  1. 如果您想限制用户运行[su]命令,请进行如下设置。
    在以下示例中,只有[wheel]组中的用户可以运行[su]命令。
[root@localhost ~]# usermod -G wheel centos
[root@localhost ~]# vi /etc/pam.d/su
[root@localhost ~]# cat  /etc/pam.d/su
#%PAM-1.0
auth            required        pam_env.so
auth            sufficient      pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth           sufficient      pam_wheel.so trust use_uid  $我们添加的配置项
# Uncomment the following line to require a user to be in the "wheel" group.
auth            required        pam_wheel.so use_uid
auth            substack        system-auth
auth            include         postlogin
account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account         include         system-auth
password        include         system-auth
session         include         system-auth
session         include         postlogin
session         optional        pam_xauth.so
auth          sufficient      pam_rootok.so debug
[root@localhost ~]# groups centos  $查看账号所在的组
centos : centos wheel

我们可以创建一个账号user01没有在wheel组,并尝试切换到root账号

[root@localhost ~]# useradd user01
[root@localhost ~]# passwd user01
Changing password for user user01.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
[root@localhost ~]# su - user01
[user01@localhost ~]$
[user01@localhost ~]$ su -
Password:
su: Permission denied  $通常是被拒绝的
[user01@localhost ~]$
  1. 如果您要删除用户帐户,请按以下步骤设置。
[root@localhost ~]# userdel -r user01  #删除用户[user01](仅删除的用户帐户)
userdel: user 'user01' does not exist
[root@localhost ~]# ll /home/
total 4
drwxr-xr-x.  3 admin    admin      78 Sep 28 10:09 admin
drwx------.  4 centos   centos    113 Dec  4 13:56 centos
drwx------. 15 localhost localhost 4096 Sep 27 16:42 localhost
drwx------.  3 tddev    users      78 Sep 28 10:09 tddev
drwx------.  5 tdops    users     143 Oct 15 16:10 tdops
drwx------.  3 tdsec    users      78 Sep 28 10:09 tdsec
drwx------.  4     1006     1006  113 Dec  4 14:16 user01
#删除用户[user01](已删除的用户帐户和他的主目录)
[root@localhost ~]# userdel -r user01
userdel: user 'user01' does not exist
[root@localhost ~]# userdel -r localhost
  1. 添加到wheel组用户免密切换root账号设置步骤。
[root@localhost ~]#  vi /etc/sudoers
## Same thing without a password
%wheel        ALL=(ALL)       NOPASSWD: ALL $添加这段内容后,wheel组用户,切换到root不需要知道root密码。
[root@localhost ~]# su - centos
[centos@localhost ~]$ id
uid=1005(centos) gid=1005(centos) groups=1005(centos),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[centos@localhost ~]$
[centos@localhost ~]$ sudo su - $#免密切换到root账号。
[root@localhost ~]#

给用户添加sudo权限

$ sed -i '/^root.*ALL=(ALL).*ALL/a\going\tALL=(ALL) \tALL' /etc/sudoers
$ cat /etc/sudoers
root    ALL=(ALL)       ALL
going   ALL=(ALL)       ALL

Cockpit 管理控制台

dnf install -y cockpit
systemctl enable --now cockpit.socket
systemctl status --now cockpit.socket

1832b220aa754cd18c504acc7686a560.png

概览

1832b220aa754cd18c504acc7686a560.png

磁盘、cpu、内存、网络监控

1832b220aa754cd18c504acc7686a560.png

安装软件

b41705914ab149ed906428aa9032a946.gif

日志

1832b220aa754cd18c504acc7686a560.png

磁盘存储

1832b220aa754cd18c504acc7686a560.png

网络

1832b220aa754cd18c504acc7686a560.png

用户

1832b220aa754cd18c504acc7686a560.png

服务

1832b220aa754cd18c504acc7686a560.png

应用

1832b220aa754cd18c504acc7686a560.png

诊断报表

1832b220aa754cd18c504acc7686a560.png

kdump

1832b220aa754cd18c504acc7686a560.png

软件更新

1832b220aa754cd18c504acc7686a560.png

界面终端

1832b220aa754cd18c504acc7686a560.png

相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
相关文章
|
2月前
|
Kubernetes API 虚拟化
|
6月前
|
安全 Unix Linux
CentOS介绍
【5月更文挑战第6天】CentOS介绍
438 3
|
Linux Shell 网络安全
CentOS这些情况你一定遇到过
CentOS这些情况你一定遇到过
|
存储 Java Linux
centos 8.2 指南(1)
centos 8.2 指南(1)
|
JavaScript Linux
|
JavaScript Linux 前端开发
|
开发工具
下一篇
无影云桌面