首页
直播
统计
壁纸
留言
友链
关于
Search
1
PVE开启硬件显卡直通功能
2,573 阅读
2
在k8s(kubernetes) 上安装 ingress V1.1.0
2,079 阅读
3
二进制安装Kubernetes(k8s) v1.24.0 IPv4/IPv6双栈
1,937 阅读
4
Ubuntu 通过 Netplan 配置网络教程
1,861 阅读
5
kubernetes (k8s) 二进制高可用安装
1,808 阅读
默认分类
登录
/
注册
Search
chenby
累计撰写
202
篇文章
累计收到
124
条评论
首页
栏目
默认分类
页面
直播
统计
壁纸
留言
友链
关于
搜索到
202
篇与
cby
的结果
2021-12-30
搭建一个自己专属的个人网盘
我们可以搭建一个自己的个人网盘(私有云盘),常用的开源框架包括ownCloud,Seafile,Nextcloud,本文介绍的是在CentOS 7下基于Nextcloud教你如何搭建一个私有云。安装MySQL安装mysql源信息 \[root@xxx ~\]# yum install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm 安装mysql \[root@xxx ~\]# yum install mysql-community-server 启动mysql \[root@xxx ~\]# systemctl start mysqld 查看密码 \[root@xxx ~\]# grep 'temporary password' /var/log/mysqld.log 修改密码 mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Cby123..' 设置开机自启 \[root@xxx ~\]# systemctl enable mysqld安装PHP并配置安装epel \[root@xxx ~\]# yum install epel\* 安装remi \[root@xxx ~\]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm 安装php以及php-fpm \[root@xxx ~\]# yum install -y php74-php-fpm php74-php-cli php74-php-bcmath php74-php-gd php74-php-json php74-php-mbstring php74-php-mcrypt php74-php-mysqlnd php74-php-opcache php74-php-pdo php74-php-pecl-crypto php74-php-pecl-mcrypt php74-php-pecl-geoip php74-php-recode php74-php-snmp php74-php-soap php74-php-xmll # 编辑配置文件 \[root@xxx ~\]# vim /etc/php.ini # 找到 ;cgi.fix\_pathinfo=1 # 去掉注释,并将1改成0 cgi.fix\_pathinfo=0 添加开机自启 \[root@xxx ~\]# systemctl enable php74-php-fpm \[root@xxx ~\]# systemctl restart php74-php-fpm 安装Nginx并设置开启启动安装Nginx \[root@xxx ~\]# yum install nginx 启动Nginx \[root@xxx ~\]# systemctl start nginx 设置开机自启 \[root@xxx ~\]# systemctl enable nginx安装nextcloud下载软件包 \[root@xxx ~\]# wget https://download.nextcloud.com/server/releases/nextcloud-18.0.2.tar.bz2 安装解压依赖 \[root@xxx ~\]# yum install lbzip2 进行解压 \[root@xxx ~\]# tar xvf nextcloud-18.0.2.tar.bz2 挪动文件夹 \[root@xxx ~\]# mv nextcloud /var/www/ 给文件权限 \[root@xxx ~\]# chmod 777 /var/www/nextcloud -Rf创建数据库\# 进入MySQL mysql -u root -p # 创建一个名为nextclud\_db的数据库 CREATE DATABASE nextcloud\_db; # 创建一个名为nextcloud、密码也为nextcloud的用户 CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'Cby123..'; # 赋予用户nextcloud对数据库nextcloud\_db的所有操作权限 GRANT ALL PRIVILEGES ON nextcloud\_db.\* TO 'nextcloud'@'localhost'; # 刷新数据库权限 FLUSH PRIVILEGES; # 退出 exit
2021年12月30日
351 阅读
0 评论
0 点赞
2021-12-30
Prometheus+Grafana监控系统
Prometheus vs Zabbix Zabbix的客户端更多是只做上报的事情,push模式。而Prometheus则是客户端本地也会存储监控数据,服务端定时来拉取想要的数据。Zabbix的客户端agent可以比较方便的通过脚本来读取机器内数据库、日志等文件来做上报。zabbix的客户端agent可以比较方便的通过脚本来读取机器内数据库、日志等文件来做上报。Prometheus的上报客户端则分为不同语言的SDK和不同用途的exporter两种,比如如果你要监控机器状态、mysql性能等,有大量已经成熟的exporter来直接开箱使用,通过http通信来对服务端提供信息上报(server去pull信息);Zabbix's client is more of only reporting things, push mode. In Prometheus, the client also stores monitoring data locally, and the server regularly pulls the desired data. Zabbix's client agent can easily read the database, log and other files in the machine through scripts for reporting. The zabbix client agent can easily read the database, log and other files in the machine through scripts for reporting. Prometheus reporting clients are divided into SDKs in different languages and exporters for different purposes. For example, if you want to monitor machine status, mysql performance, etc., there are a large number of mature exporters to use directly out of the box, and serve through HTTP communication. The terminal provides information reporting (server to pull information);安装Prometheus:install Prometheus 官网下载地址:Official website download addresshttps://prometheus.io/download/ 下载您想要的版本后,进行安装使用即可。After downloading the version you want, install it and use itcby@cby-Inspiron-7577:~$ wget https://github.com/prometheus/prometheus/releases/download/v2.21.0/prometheus-2.21.0.linux-amd64.tar.gz cby@cby-Inspiron-7577:~$ tar xvf prometheus-2.21.0.linux-amd64.tar.gz prometheus-2.21.0.linux-amd64/ prometheus-2.21.0.linux-amd64/LICENSE prometheus-2.21.0.linux-amd64/prometheus prometheus-2.21.0.linux-amd64/promtool prometheus-2.21.0.linux-amd64/prometheus.yml prometheus-2.21.0.linux-amd64/NOTICE prometheus-2.21.0.linux-amd64/console\_libraries/ prometheus-2.21.0.linux-amd64/console\_libraries/menu.lib prometheus-2.21.0.linux-amd64/console\_libraries/prom.lib prometheus-2.21.0.linux-amd64/consoles/ prometheus-2.21.0.linux-amd64/consoles/node-overview.html prometheus-2.21.0.linux-amd64/consoles/node.html prometheus-2.21.0.linux-amd64/consoles/prometheus.html prometheus-2.21.0.linux-amd64/consoles/node-cpu.html prometheus-2.21.0.linux-amd64/consoles/index.html.example prometheus-2.21.0.linux-amd64/consoles/prometheus-overview.html prometheus-2.21.0.linux-amd64/consoles/node-disk.html 解压后进入文件夹内即可看到该程序。同时即可使用。After decompression, enter the folder to see the program. Can be used at the same timecby@cby-Inspiron-7577:~/prometheus-2.21.0.linux-amd64$ ll 总用量 161140 drwxr-xr-x 4 cby cby 4096 9月 11 21:30 ./ drwxr-xr-x 22 cby cby 4096 10月 5 00:18 ../ drwxr-xr-x 2 cby cby 4096 9月 11 21:29 console\_libraries/ drwxr-xr-x 2 cby cby 4096 9月 11 21:29 consoles/ -rw-r--r-- 1 cby cby 11357 9月 11 21:29 LICENSE -rw-r--r-- 1 cby cby 3420 9月 11 21:29 NOTICE -rwxr-xr-x 1 cby cby 88471209 9月 11 19:37 prometheus\* -rw-r--r-- 1 cby cby 926 9月 11 21:29 prometheus.yml -rwxr-xr-x 1 cby cby 76493104 9月 11 19:39 promtool\* 查看一下版本: Check the versioncby@cby-Inspiron-7577:~/prometheus-2.21.0.linux-amd64$ ./prometheus --version prometheus, version 2.21.0 (branch: HEAD, revision: e83ef207b6c2398919b69cd87d2693cfc2fb4127) build user: root@a4d9bea8479e build date: 20200911-11:35:02 go version: go1.15.2 查看启动sever文件: View startup sever filecby@cby-Inspiron-7577:~/prometheus-2.21.0.linux-amd64$ cat prometheus.yml # my global config global: scrape\_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation\_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape\_timeout is set to the global default (10s). # Alertmanager configuration alerting: alertmanagers: - static\_configs: - targets: # - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation\_interval'. rule\_files: # - "first\_rules.yml" # - "second\_rules.yml" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape\_configs: # The job name is added as a label \`job=<job\_name>\` to any timeseries scraped from this config. - job\_name: 'prometheus' # metrics\_path defaults to '/metrics' # scheme defaults to 'http'. static\_configs: - targets: \['localhost:9090'\] 其大致分为四部分:It is roughly divided into four parts:global:全局配置,其中scrape_interval表示抓取一次数据的间隔时间,evaluation_interval表示进行告警规则检测的间隔时间;global: global configuration, in which scrape_interval represents the interval of data capture, evaluation_interval represents the interval of alarm rule detection;alerting:告警管理器(Alertmanager)的配置,目前还没有安装Alertmanager;alerting: The configuration of the alert manager (Alertmanager), Alertmanager is not installed yet;rule_files:告警规则有哪些;rule_files: what are the alarm rules;scrape_configs:抓取监控信息的目标。一个job_name就是一个目标,其targets就是采集信息的IP和端口。这里默认监控了Prometheus自己,可以通过修改这里来修改Prometheus的监控端口。Prometheus的每个exporter都会是一个目标,它们可以上报不同的监控信息,比如机器状态,或者mysql性能等等,不同语言sdk也会是一个目标,它们会上报你自定义的业务监控信息。scrape_configs: The goal of grabbing monitoring information. A job_name is a target, and its targets are the IP and port for collecting information. Prometheus itself is monitored by default here, and the monitoring port of Prometheus can be modified by modifying this. Each exporter of Prometheus will be a target, they can report different monitoring information, such as machine status, or mysql performance, etc., different language SDK will also be a target, they will report your customized business monitoring information. 启动运行sever:Start running severcby@cby-Inspiron-7577:~/prometheus-2.21.0.linux-amd64$ ./prometheus --config.file=prometheus.yml 运行后,使用默认9090端口即可进行访问,若无法访问您可以查看一下是否有防火墙的限制,若没有限制,那就看一下是否正常启动,有端口的监听。 After running, you can use the default port 9090 to access it. If you can't access it, you can check if there is a firewall restriction. If there is no restriction, check if it is started normally and there is port monitoring.添加机器的监控器:Add machine monitor 在官网的下载页面中,可以找到 node_exporter 这个tar包,这个监空插件可以监控基础的硬件信息,例如CPU内存硬盘等信息,node_exporter本身也是一个http服务可以进行直接调用使用哦。 On the download page of the official website, you can find the tar package of node_exporter. This plug-in can monitor basic hardware information, such as CPU memory and hard disk information. The node_exporter itself is also an http service that can be used directly. 下载最新的此插件,同时进行解压,并运行:Download the latest plug-in, unzip at the same time, and runcby@cby-Inspiron-7577:~$ wget https://github.com/prometheus/node\_exporter/releases/download/v1.0.1/node\_exporter-1.0.1.linux-amd64.tar.gz cby@cby-Inspiron-7577:~$ cd node\_exporter-1.0.1.linux-amd64/ cby@cby-Inspiron-7577:~/node\_exporter-1.0.1.linux-amd64$ ls LICENSE node\_exporter NOTICE cby@cby-Inspiron-7577:~/node\_exporter-1.0.1.linux-amd64$ ./node\_exporter level=info ts=2020-10-04T16:31:41.858Z caller=node\_exporter.go:177 msg="Starting node\_exporter" version="(version=1.0.1, branch=HEAD, revision=3715be6ae899f2a9b9dbfd9c39f3e09a7bd4559f)" level=info ts=2020-10-04T16:31:41.858Z caller=node\_exporter.go:178 msg="Build context" build\_context="(go=go1.14.4, user=root@1f76dbbcfa55, date=20200616-12:44:12)" level=info ts=2020-10-04T16:31:41.859Z caller=node\_exporter.go:105 msg="Enabled collectors" 可以使用curl进行测试一下是否正常启动 You can use curl to test whether it starts normallycby@cby-Inspiron-7577:~$ curl http://localhost:9100/metrics 若可以正常访问,那就可以在prometheus.yml文件中添加一个targetIf you can access normally, you can add a target in the prometheus.yml file\# my global config global: scrape\_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation\_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape\_timeout is set to the global default (10s). # Alertmanager configuration alerting: alertmanagers: - static\_configs: - targets: # - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation\_interval'. rule\_files: # - "first\_rules.yml" # - "second\_rules.yml" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape\_configs: # The job name is added as a label \`job=<job\_name>\` to any timeseries scraped from this config. - job\_name: 'prometheus' # metrics\_path defaults to '/metrics' # scheme defaults to 'http'. static\_configs: - targets: \['localhost:9090'\] - job\_name: 'server' static\_configs: - targets: \['localhost:9100'\] 在标签栏的 Status --> Targets 中可以:In Status --> Targets in the tab bar, you can安装Grafana:Install Grafanacby@cby-Inspiron-7577:~$ sudo apt-get install -y adduser libfontconfig1 cby@cby-Inspiron-7577:~$ wget https://dl.grafana.com/oss/release/grafana\_7.2.0\_amd64.deb cby@cby-Inspiron-7577:~$ sudo dpkg -i grafana\_7.2.0\_amd64.deb 正在选中未选择的软件包 grafana。 (正在读取数据库 ... 系统当前共安装有 211277 个文件和目录。) 准备解压 grafana\_7.2.0\_amd64.deb ... 正在解压 grafana (7.2.0) ... 正在设置 grafana (7.2.0) ... 正在添加系统用户"grafana" (UID 130)... 正在将新用户"grafana" (UID 130)添加到组"grafana"... 无法创建主目录"/usr/share/grafana"。 ### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable grafana-server ### You can start grafana-server by executing sudo /bin/systemctl start grafana-server 正在处理用于 systemd (245.4-4ubuntu3.2) 的触发器 ... 安装完成后,进行启动: After the installation is complete, startcby@cby-Inspiron-7577:~$ sudo systemctl start grafana-server.service cby@cby-Inspiron-7577:~$ sudo systemctl status grafana-server.service \[sudo\] cby 的密码: 对不起,请重试。 \[sudo\] cby 的密码: 对不起,请重试。 \[sudo\] cby 的密码: ● grafana-server.service - Grafana instance Loaded: loaded (/lib/systemd/system/grafana-server.service; disabled; vendor preset: enabled) Active: active (running) since Mon 2020-10-05 00:02:59 CST; 40min ago Docs: http://docs.grafana.org Main PID: 1521572 (grafana-server) Tasks: 14 (limit: 18689) Memory: 25.3M CGroup: /system.slice/grafana-server.service └─1521572 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafa 默认端口为3000 ,使用IP加端口即可进行访问,默认用户名密码是admin,登录后即可看到首页。在设置中进行添加Prometheus监控数据。 The default port is 3000, you can access by using IP plus port, the default user name and password is admin, you can see the home page after logging in. Add Prometheus monitoring data in the settings. 添加监控数据后,导入一个监控面板,或者勤劳的人们可以自行进行配置面板,哇哈哈哈,同时可以在官方的面板界面中寻找到一个心仪的面板地址为:https://grafana.com/dashboards下载面板的json后,可以进行导入面板。 After adding monitoring data, import a monitoring panel, or industrious people can configure the panel by themselves, wow ha ha ha, and you can find a favorite panel in the official panel interfaceThe address is: https://grafana.com/dashboardsAfter downloading the json of the panel, you can import the panel.导入后即可显示看到花里胡哨的面版了After importing, you can see the bells and whistles 面板添加后,必然需要报警。可以使用onealert,进行告警。 https://caweb.aiops.com/#/Application/newBuild/grafana/0 After the panel is added, an alarm is necessary. You can use onealert to alert.到这里环境已经配置完成The environment has been configured here
2021年12月30日
617 阅读
0 评论
0 点赞
2021-12-30
Nginx主要功能
Nginx主要功能:1、反向代理 2、负载均衡 3、HTTP服务器(包含动静分离) 4、正向代理*一、反向代理反向代理应该是 Nginx 做的最多的一件事了,什么是反向代理呢,以下是百度百科的说法:反向代理(Reverse Proxy)方式是指以代理服务器来接受 internet上 的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给 internet 上请求连接的客户端,此时代理服务器对外就表现为一个反向代理服务器。简单来说就是真实的服务器不能直接被外部网络访问,所以需要一台代理服务器,而代理服务器能被外部网络访问的同时又跟真实服务器在同一个网络环境,当然也可能是同一台服务器,端口不同而已。下面贴上一段简单的实现反向代理的代码server { listen 80; server\_name localhost; client\_max\_body\_size 1024M; location / { proxy\_pass http://localhost:8080; proxy\_set\_header Host $host:$server\_port; } }保存配置文件后启动 Nginx,这样当我们访问 localhost 的时候,就相当于访问 localhost:8080 了。*二、负载均衡负载均衡也是 Nginx 常用的一个功能,负载均衡其意思就是分摊到多个操作单元上进行执行,例如:Web服务器、FTP服务器、企业关键应用服务器和其它关键任务服务器等,从而共同完成工作任务。简单而言就是当有2台或以上服务器时,根据规则随机的将请求分发到指定的服务器上处理,负载均衡配置一般都需要同时配置反向代理,通过反向代理跳转到负载均衡。而Nginx目前支持自带3种负载均衡策略,还有2种常用的第三方策略。 1、RR(默认)每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。简单配置 upstream test { server localhost:8080; server localhost:8081; } server { listen 81; server\_name localhost; client\_max\_body\_size 1024M; location / { proxy\_pass http://test; proxy\_set\_header Host $host:$server\_port; } }配置了2台服务器,当然实际上是一台,只是端口不一样而已,而8081的服务器是不存在的,也就是说访问不到,但是我们访问 http://localhost 的时候,也不会有问题,会默认跳转到http://localhost:8080 具体是因为Nginx会自动判断服务器的状态,如果服务器处于不能访问(服务器挂了),就不会跳转到这台服务器,所以也避免了一台服务器挂了影响使用的情况,由于 Nginx 默认是RR策略,所以我们不需要其他更多的设置。2、权重 指定轮询几率,weight和访问比率成正比,用于后端服务器性能不均的情况。例如upstream test { server localhost:8080 weight=9; server localhost:8081 weight=1; }那么10次一般只会有1次会访问到8081,而有9次会访问到8080。3、ip_hash 上面的2种方式都有一个问题,那就是下一个请求来的时候请求可能分发到另外一个服务器,当我们的程序不是无状态的时候(采用了session保存数据),这时候就有一个很大的很问题了,比如把登录信息保存到了session中,那么跳转到另外一台服务器的时候就需要重新登录了,所以很多时候我们需要一个客户只访问一个服务器,那么就需要用iphash了,iphash的每个请求按访问ip的hash结果分配,这样每个访客固定访问一个后端服务器,可以解决session的问题。upstream test { ip\_hash; server localhost:8080; server localhost:8081; }4、fair(第三方) 按后端服务器的响应时间来分配请求,响应时间短的优先分配。upstream backend { fair; server localhost:8080; server localhost:8081; }5、url_hash(第三方) 按访问url的hash结果来分配请求,使每个url定向到同一个后端服务器,后端服务器为缓存时比较有效。在upstream中加入hash语句,server语句中不能写入weight等其他的参数,hash_method是使用的hash算法。upstream backend { hash $request\_uri; hash\_method crc32; server localhost:8080; server localhost:8081; }以上5种负载均衡各自适用不同情况下使用,所以可以根据实际情况选择使用哪种策略模式,不过fair和url_hash需要安装第三方模块才能使用,由于本文主要介绍Nginx能做的事情,所以Nginx安装第三方模块不会再本文介绍。*三、HTTP服务器Nginx本身也是一个静态资源的服务器,当只有静态资源的时候,就可以使用Nginx来做服务器,同时现在也很流行动静分离,就可以通过Nginx来实现,首先看看Nginx做静态资源服务器。 server { listen 80; server\_name localhost; client\_max\_body\_size 1024M; location / { root e:\\wwwroot; index index.html; } }这样如果访问http://localhost 就会默认访问到E盘wwwroot目录下面的index.html,如果一个网站只是静态页面的话,那么就可以通过这种方式来实现部署。动静分离 动静分离是让动态网站里的动态网页根据一定规则把不变的资源和经常变的资源区分开来,动静资源做好了拆分以后,我们就可以根据静态资源的特点将其做缓存操作,这就是网站静态化处理的核心思路。upstream test{ server localhost:8080; server localhost:8081; } server { listen 80; server\_name localhost; location / { root e:\\wwwroot; index index.html; } # 所有静态请求都由nginx处理,存放目录为html location ~ \\.(gif|jpg|jpeg|png|bmp|swf|css|js)$ { root e:\\wwwroot; } # 所有动态请求都转发给tomcat处理 location ~ \\.(jsp|do)$ { proxy\_pass http://test; } error\_page 500 502 503 504 /50x.html; location = /50x.html { root e:\\wwwroot; } }这样我们就可以把HTML以及图片和css以及js放到wwwroot目录下,而tomcat只负责处理jsp和请求, 例如当我们后缀为gif的时候,Nginx默认会从wwwroot获取到当前请求的动态图文件返回,当然这里的静态文件跟Nginx是同一台服务器,我们也可以在另外一台服务器,然后通过反向代理和负载均衡配置过去就好了,只要搞清楚了最基本的流程,很多配置就很简单了,另外localtion后面其实是一个正则表达式,所以非常灵活。*四、正向代理正向代理,意思是一个位于客户端和原始服务器(origin server)之间的服务器,为了从原始服务器取得内容,客户端向代理发送一个请求并指定目标(原始服务器),然后代理向原始服务器转交请求并将获得的内容返回给客户端。客户端才能使用正向代理。当你需要把你的服务器作为代理服务器的时候,可以用Nginx来实现正向代理,但是目前Nginx有一个问题,那么就是不支持HTTPS,虽然我百度到过配置HTTPS的正向代理,但是到最后发现还是代理不了,当然可能是我配置的不对。 resolver 114.114.114.114 8.8.8.8; server { resolver\_timeout 5s; listen 81; access\_log e:\\wwwroot\\proxy.access.log; error\_log e:\\wwwroot\\proxy.error.log; location / { proxy\_pass http://$host$request\_uri; } }resolver是配置正向代理的DNS服务器,listen 是正向代理的端口,配置好了就可以在ie上面或者其他代理插件上面使用服务器ip+端口号进行代理了。注意:Nginx是支持热启动的,也就是说当我们修改配置文件后,不用关闭Nginx,就可以实现让配置生效。Nginx从新读取配置的命令是:nginx -s reload 。
2021年12月30日
1,112 阅读
0 评论
0 点赞
2021-12-30
CentOS 的 YUM安装时卡死解决方案
YUM是基于RPM的软件包管理器YUM is an RPM-based package manager补充说明Supplementary noteyum命令 是在Fedora和RedHat以及SUSE中基于rpm的软件包管理器,它可以使系统管理人员交互和自动化地更新与管理RPM软件包,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。yum提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。 The yum command is a rpm-based package manager in Fedora, RedHat and SUSE. It enables system administrators to interactively and automatically update and manage RPM packages. It can automatically download and install RPM packages from a specified server, and can be processed automatically Dependency relationship, and install all dependent software packages at one time, no need to download and install tediously again and again. Yum provides commands to find, install, delete a certain, a group or even all packages, and the commands are concise and easy to remember.问题: 在使用yum安装时,卡死并且无法Ctrl+c终止,需要将其杀死才能停止。如下图: When using yum to install, it is stuck and cannot be terminated by Ctrl+c. You need to kill it to stop.As shown below:解决方案一:Solution 1: 删除rpm数据文件后再重建rpm数据文件:Rebuild the rpm data file after deleting the rpm data file: 删除rpm数据文件Delete rpm data filerm -f /var/lib/rpm/__db.00*重建rpm数据文件Rebuild rpm data filerpm -vv --rebuilddb清空缓存后再重新缓存Re-cache after clearing the cacheyum clean all yum makecache执行完一般情况就可以正常使用了,若依旧无法使用请参考以下方式二 After executing the general situation, it can be used normally, if it still cannot be used, please refer to the following method two解决方案二:Solution two:将这俩个文件删除后在进行测试Test after deleting these two files
2021年12月30日
628 阅读
0 评论
0 点赞
2021-12-30
Python安装-在Linux系统中使用编译进行安装
Python安装-在Linux系统中使用编译进行安装 你可以使用Ubuntu自带的Python3,不过你不能自由的控制版本,还要单独安装pip3,如果你想升级pip3,还会出现一些让人不愉快的使用问题。而在CentOS系统中,默认只有Python2,通过yum安装Python3,也同样面临版本落后以及pip3的问题。如果不自己编译安装,还有什么别的方法来一直保持使用最新的版本呢?!除非你用Win系统。You can use the Python3 that comes with Ubuntu, but you can't control the version freely. You have to install pip3 separately. If you want to upgrade pip3, there will be some unpleasant usage problems. In the CentOS system, there is only Python2 by default. Installing Python3 through yum also faces the problems of backward version and pip3. If you don’t compile and install it yourself, what other methods are there to keep using the latest version? ! Unless you use Win system.在CentOS中安装Python3需要的依赖库Install the dependency libraries required by Python3 in CentOSsudo yum install zlib-devel bzip2-developenssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-develexpat-devel gdbm-devel xz-devel db4-devel libpcap-devel make在Ubuntu中安装Python3需要的依赖库Install the dependency libraries required by Python3 in Ubuntu$ sudo apt install libreadline-gplv2-devlibncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libbz2-devzlib1g-dev libffi-dev liblzma-dev安装GCCInstall GCCCentOS的minimal版本,以及Ubuntu,都没有预装gcc,如果你用的是这两个版本,需要确保系统有gcc编译器可以使用。安装和查看gcc的方法:The minimal version of CentOS and Ubuntu do not have gcc pre-installed. If you are using these two versions, you need to make sure that the system has a gcc compiler that can be used. How to install and view gcc: $ sudo yum install gcc # install gcc in centos $ sudo apt install gcc # install gcc in ubuntu $ which gcc # check if gcc is there $ gcc --version # check gcc version下载Python3源码并解压Download the Python3 source code and unzip itPython3的官方源码下载页面是:https://www.python.org/downloads/The official source code download page of Python3 is:https://www.python.org/downloads/ 使用curl或wget下载,然后解压:Use curl or wget to download, and then unzip:Wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz tar xvf Python-3.9.2.tgz执行configureExecute configure进入上一步的解压目录,然后执行configure:Enter the unzipped directory of the previous step, and then execute configure:$ cd Python-3.7.3 $ ./configure --prefix=/usr/local/python-3.9.2make和installmake and install最后,我们执行make和install的指令。Finally, we execute the make and install instructions.$ make && sudo make installmake install 前要有sudo,因为我们在configure的时候,指定的安装路径为系统路径,不是用户的/home/user路径。There must be sudo before make install, because when we configure, the specified installation path is the system path, not the user's /home/user path.ln -s /usr/local/python-3.9.2/bin/python3.9/usr/bin/python3 ln -s /usr/local/python-3.9.2/bin/pip3.9/usr/bin/pip3
2021年12月30日
575 阅读
0 评论
0 点赞
1
...
36
37
38
...
41