RHEL8配置Yum源及测试thefuck

QDFILMRHEL8配置Yum源及测试thefuck
长春密刺1. 配置Yum源
RHEL系统安装完成之后,如果没有注册并购买红帽服务是⽆法连接到官⽅的Yum源的,也就⽆法直接使⽤Yum命令来安装软件包及更新系统。1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22[root@wuhan2020 /]# hostnamectl
Static hostname: wuhan2020
Icon name: computer-laptop
Chassis: laptop
Machine ID: 601eca308ef84823a9e0a775d944fa23
Boot ID: 2b616f1426814536b6cd7a469718f588
Operating System: Red Hat Enterprise Linux 8.1 (Ootpa)
CPE OS Name: cpe:/o:redhat:enterprise_linux:8.1:GA
Kernel: Linux 4.18.0-147.el8.x86_64
Architecture: x86-64
[root@wuhan2020 /]# yum install thefuck
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. Error: There are no enabled repositories in"/pos.d", "/etc/yum/repos.d", "/pos.d".
[root@wuhan2020 /]#
[root@wuhan2020 /]# yum update
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. Error: There are no enabled repositories in"/pos.d", "/etc/yum/repos.d", "/pos.d".
[root@wuhan2020 /]#
发动机摇臂
但是,我们可以禁⽤“Subscription Management”,然后配置成我们⾃⼰定义的Yum源,也就是Repository库。可以⾃定义, 这个很简单,可参考之前的⽂档。这⾥我们使⽤阿⾥云开源镜像。
阿⾥云开源镜像
mirrors.aliyun/repo/
下载po 到/pos.d/
cd  /pos.d/
wget mirrors.aliyun/po
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16[root@wuhan2020 /]# cd /pos.d/
[root@pos.d]# wget mirrors.aliyun/po
--2020-02-17 15:17:20--  mirrors.aliyun/po
Resolving mirrors.aliyun (mirrors.aliyun)... 47.246.28.228, 47.246.28.229, 47.246.28.224, ...
Connecting to mirrors.aliyun (mirrors.aliyun)|47.246.28.228|: connected.
HTTP request sent, 200 OK
Length: 2595 (2.5K) [application/octet-stream]
Saving to: ‘po’
[root@pos.d]# ls
[root@pos.d]# po_bak
####修改以下两个⽂件的Enable=0来禁⽤Subscription Management的提⽰。[root@pos.d]# vi /etc/yum/pluginconf.f
[root@pos.d]# vi /etc/yum/pluginconf.f [root@pos.d]# yum clean all
[root@pos.d]# yum makecache
1
2
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31[root@pos.d]# yum repolist
Last metadata expiration check: 0:00:25 ago on Mon 17 Feb 2020 03:21:58 PM +04.
蚝排
repo id                                        repo name                                                                      status AppStream                                      CentOS-8 - AppStream - mirrors.aliyun                                      5,093 base CentOS-8 - Base - mirrors.aliyun                                          2,080 extras                                        CentOS-8 - Extras - mirrors.aliyun                                            3 [root@pos.d]# yum grouplist
Last metadata expiration check: 0:00:31 ago on Mon 17 Feb 2020 03:21:58 PM +04.
Available Environment Groups:
Server
Minimal Install
Workstation
Custom Operating System
Virtualization Host
Installed Environment Groups:
Server with GUI
Installed Groups:
Legacy UNIX Compatibility
Container Management
Development Tools
Graphical Administration Tools
Headless Management
Network Servers
Security Tools
System Tools
Available Groups:
.
NET Core Development
RPM Development Tools
Scientific Support
Smart Card Support
[root@pos.d]#
2. 安装并测试thefuck应⽤
需要先安装Python, Pip, Python-Devel RHEL8默认已安装了Python3.6。
1 2 3[root@wuhan2020 bin]# find /usr/bin/ -name python* /usr/bin/python3.6
/usr/bin/python3.6m
4 5 6 7 8 9/usr/bin/python3
/usr/bin/python-argcomplete-check-easy-install-script
/
usr/bin/python-argcomplete-tcsh
[root@wuhan2020 bin]# ln -s /usr/bin/python3.6 /usr/bin/python [root@wuhan2020 /]# python -V
Python 3.6.8
需要⼿动安装python3-devel
[root@wuhan2020 ~]# yum install python3-devel 安装Pip
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22[root@wuhan2020 /]# python get-pip.py
Collecting pip
Downloading pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
|████████████████████████████████| 1.4 MB 1.3 MB/s
Collecting wheel
Downloading wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: pip, wheel
Attempting uninstall: pip
Found existing installation: pip 9.0.3
Uninstalling pip-9.0.3:
Successfully uninstalled pip-9.0.3
Successfully installed pip-20.0.2 wheel-0.34.2
After the preparation environment is ready, start installing "Thefuck":
Install python pip
[root@wuhan2020 log]# pip -V
pip 20.0.2 from/usr/local/lib/python3.6/site-packages/pip (python 3.6)
Install the setuptools module
[root@wuhan2020 log]# pip install -U setuptools
Requirement already up-to-date: setuptools in/usr/local/lib/python3.6/site-packages (45.2.0)
安装thefuck
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17root@wuhan2020 ~]# python3 -m pip install thefuck
Collecting thefuck
变压器防盗锁Using cached thefuck-3.29-py2.py3-none-any.whl (109 kB)
Collecting psutil
Using cached psutil-5.6. (448 kB)
Requirement already satisfied: six in/usr/lib/python3.6/site-packages (from thefuck) (1.11.0)
Requirement already satisfied: colorama in/usr/local/lib/python3.6/site-packages (from thefuck) (0.4.3)
Requirement already satisfied: decorator in/usr/lib/python3.6/site-packages (from thefuck) (4.2.1)
Requirement already satisfied: pyte in/usr/local/lib/python3.6/site-packages (from thefuck) (0.8.0)
Requirement already satisfied: wcwidth in/usr/local/lib/python3.6/site-packages (from pyte->thefuck) (0.1.8)
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) ... done
Created wheel for psutil: filename=psutil-5.6.7-cp36-cp36m-linux_x86_64.whl size=282020 sha256=d257a6b535f7e092f19dcb2e28d3940232bb33ecf2c960998c05bdcade73ff74  Stored in directory: /root/.cache/pip/wheels/b2/b3/a3/551db06cebc9141c437c6b58aa751d3670471494e9f6d1428d
Successfully built psutil
Installing collected packages: psutil, thefuck
Successfully installed psutil-5.6.7 thefuck-3.29
配置环境变量
可以添加到bashrc或者/etc/profile⽂件都⾏。[root@wuhan2020 /]# vi /etc/profile
###修改profile⽂件,在末尾下⾯⼀⾏内容alias fuck='eval $(thefuck $(fc -ln -1)); history -r' 1
2
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24[root@wuhan2020 /]# hostnamectl
Static hostname: wuhan2020
Icon name: computer-laptop
Chassis: laptop
Machine ID: 601eca308ef84823a9e0a775d944fa23          Boot ID: 2b616f1426814536b6cd7a469718f588
Operating System: Red Hat Enterprise Linux 8.1 (Ootpa)      CPE OS Name: cpe:/o:redhat:enterprise_linux:8.1:GA            Kernel: Linux 4.18.0-147.el8.x86_64
Architecture: x86-64
[root@wuhan2020 /]# hostnamcl
bash: hostnamcl: command
[root@wuhan2020 /]# fuck
hostnamectl [enter/↑/↓/ctrl+c]
Static hostname: wuhan2020
Icon name: computer-laptop
Chassis: laptop
Machine ID: 601eca308ef84823a9e0a775d944fa23          Boot ID: 2b616f1426814536b6cd7a469718f588
Operating System: Red Hat Enterprise Linux 8.1 (Ootpa)      CPE OS Name: cpe:/o:redhat:enterprise_linux:8.1:GA            Kernel: Linux 4.18.0-147.el8.x86_64
Architecture: x86-64
[root@wuhan2020 /]#
=====
在安装thefuck时,有遇到如下错误,原因是未安装Python3-devel.
1 2 3 4 5 6 7 8[root@wuhan2020 ~]# python3 -m pip install thefuck
Collecting thefuck
Using cached thefuck-3.29-py2.py3-none-any.whl (109 kB)
Collecting psutil
Using cached psutil-5.6. (448 kB)
Requirement already satisfied: six in/usr/lib/python3.6/site-packages (from thefuck) (1.11.0) Requirement already satisfied: decorator in/usr/lib/python3.6/site-packages (from thefuck) (4.2.1) Requirement already satisfied: colorama in/usr/local/lib/python3.6/site-packages (from thefuck) (0.4.
3) Requirement already satisfied: pyte in/usr/local/lib/python3.6/site-packages (from thefuck) (0.8.0)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43Requirement already satisfied: wcwidth in/usr/local/lib/python3.6/site-packages (from pyte->thefuck) (0.1.8)
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a1ke_1aj/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-a1ke_1aj/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);ad().replace('"'"'\r\n'"'"',
超低温制冷机creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/psutil
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-
D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=567 -DPSUTIL_LINUX=1 -I/usr/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command 'gcc'failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psutil
Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil, thefuck
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a1ke_1aj/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-a1ke_1aj/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);ad().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'install --record /tmp/ --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6m/psutil
cwd: /tmp/pip-install-a1ke_1aj/psutil/
Complete output (44 lines):
……
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/psutil
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-
D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=567 -DPSUTIL_LINUX=1 -I/usr/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command 'gcc'failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv

本文发布于:2024-09-21 20:53:29,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/3/196811.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:安装   服务   购买   没有   红帽   注册
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议