Linux的学习之路:7、yum与git

news2024/10/5 20:23:47

摘要

本章主要是说一下yum和git的操作

目录

摘要

一、什么是yum

二、yum三板斧

1、list

2、install

3、remove

三、怎么创建仓库

四、git三板斧

1、add

2、commit

3、push

4、pull

五、思维导图 


一、什么是yum

YUM是Yellowdog Updater Modified的简称,是杜克大学为了提高RPM软件包安装性而开发的一种软件包管理器。它可以从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装,就像手机里面的应用商店。

YUM提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。YUM解决了依赖关系的问题,它可以自动下载软件包所依赖的其它软件包。

YUM软件仓库实际上是根据实际使用中的各种情形,在文件服务器或特定服务器上,将众多的RPM包按照一定合理的分类方式进行整合,同时保持着与官方发布一致性的更新。这样,当需要安装某个RPM包时,可以迅速地在软件仓库中找到并下载到本地进行安装。

总的来说,YUM是一个方便、快捷的软件包管理工具,能够自动处理软件包之间的依赖关系,极大地简化了软件安装的过程.

二、yum三板斧

1、list

通过 yum list 命令可以罗列出当前一共有哪些软件包,如下方截图就是一部分查找到的软件包,因为太多了不好全部截图。

因为太多了,所以我们需要什么就可以利用管道配合grep进行查找软件,就是yum list | grep stl这行代码,测试如下方截图

 ustl-devel.x86_64                        2.8-1.el7                     epel  

如上方这行代码:软件包名称: 主版本号.次版本号.源程序发行号-软件包的发行号.主机平台.cpu架构."x86_64" 后缀表示64位系统的安装包, "i686" 后缀表示32位系统安装包. 选择包时要和系统匹配、"el7" 表示操作系统发行版的版本. "el7" 表示的是 centos7/redhat7. "el6" 表示 centos6/redhat6、最后一列, epel 表示的是 "软件源" 的名称, 类似于 "小米应用商店", "华为应用商店" 这样的概念.

2、install

通过 yum, 我们可以通过很简单的一条命令完成 gcc 的安装,yum 会自动找到都有哪些软件包需要下载, 这时候敲 "y" 确认安装,出现 "complete" 字样, 说明安装完成,如之前文章中安装tree的时候就是yum install -y tree就是下载树。

注意:

1、安装软件时由于需要向系统目录中写入内容, 一般需要 sudo 或者切到 root 账户下才能完成yum安装软件只能一个装完了再装另一个

2、 正在yum安装一个软件的过程中, 如果再尝试用yum安装另外一个软件, yum会报错,如果 yum 报错, 请自行百度,这里就不详细说了

如下方代码就是下载一个sl的开源应用,这个应用挺有意思是一个小火车跑过去,如下方视频

Linux小火车

3、remove

sudo yum remove就是删除应用的指令,这里就是把上面那个小火车的删除演示,如下方截图,删除后再用就没有了。

三、怎么创建仓库

这里就用国内的gitte进行演示了,如下方图片在浏览器内搜索gitte,这个就是官网,点进去注册登录,点击图二划红线的位置,然后如图三进行创建仓库然后点击创建。

 如下方图一点击克隆然后如图二进行赋值第一个的https的链接,然后如下方代码所示,可以看到在进入test这个克隆的代码仓库就可以看出来在和gitte上面的仓库里面的东西一样,这就是克隆好了。

 

[ly1@VM-24-9-centos ~]$ ll
total 4
-rw-rw-r-- 1 ly1 ly1 462 Apr 11 20:03 test.c
[ly1@VM-24-9-centos ~]$ git clone https://gitee.com/three-thousand-luoshui/test.git
Cloning into 'test'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
[ly1@VM-24-9-centos ~]$ ll
total 8
drwxrwxr-x 3 ly1 ly1 4096 Apr 12 20:45 test
-rw-rw-r-- 1 ly1 ly1  462 Apr 11 20:03 test.c
[ly1@VM-24-9-centos ~]$ ll -a
total 52
drwx------  7 ly1  ly1  4096 Apr 12 20:45 .
drwxr-xr-x. 5 root root 4096 Apr 11 18:42 ..
-rw-------  1 ly1  ly1  1606 Apr 12 20:45 .bash_history
-rw-r--r--  1 ly1  ly1    18 Apr  1  2020 .bash_logout
-rw-r--r--  1 ly1  ly1   193 Apr  1  2020 .bash_profile
-rw-r--r--  1 ly1  ly1   231 Apr  1  2020 .bashrc
drwxrwxr-x  3 ly1  ly1  4096 Apr 11 19:04 .cache
drwxrwxr-x  3 ly1  ly1  4096 Apr 11 19:04 .config
drwxrw----  3 ly1  ly1  4096 Apr 12 20:45 .pki
drwxrwxr-x  3 ly1  ly1  4096 Apr 12 20:45 test
-rw-rw-r--  1 ly1  ly1   462 Apr 11 20:03 test.c
drwxr-xr-x  2 ly1  ly1  4096 Apr 11 21:30 .vim
-rw-------  1 ly1  ly1  2615 Apr 11 21:30 .viminfo
[ly1@VM-24-9-centos ~]$ cd test
[ly1@VM-24-9-centos test]$ ll -a
total 28
drwxrwxr-x 3 ly1 ly1 4096 Apr 12 20:45 .
drwx------ 7 ly1 ly1 4096 Apr 12 20:45 ..
drwxrwxr-x 8 ly1 ly1 4096 Apr 12 20:45 .git
-rw-rw-r-- 1 ly1 ly1  270 Apr 12 20:45 .gitignore
-rw-rw-r-- 1 ly1 ly1  643 Apr 12 20:45 LICENSE
-rw-rw-r-- 1 ly1 ly1  841 Apr 12 20:45 README.en.md
-rw-rw-r-- 1 ly1 ly1  930 Apr 12 20:45 README.md
[ly1@VM-24-9-centos test]$ 

四、git三板斧

1、add

如下方代码所示,这里是创建了一个文件进行测试,测试的hello然后利用add提交,这是就会把这个文件提交到gitee上,也就相当于一个通知。

[ly1@VM-24-9-centos test]$ ll -a
total 28
drwxrwxr-x 3 ly1 ly1 4096 Apr 12 20:45 .
drwx------ 7 ly1 ly1 4096 Apr 12 20:45 ..
drwxrwxr-x 8 ly1 ly1 4096 Apr 12 20:45 .git
-rw-rw-r-- 1 ly1 ly1  270 Apr 12 20:45 .gitignore
-rw-rw-r-- 1 ly1 ly1  643 Apr 12 20:45 LICENSE
-rw-rw-r-- 1 ly1 ly1  841 Apr 12 20:45 README.en.md
-rw-rw-r-- 1 ly1 ly1  930 Apr 12 20:45 README.md
[ly1@VM-24-9-centos test]$ vim test.c
[ly1@VM-24-9-centos test]$ gcc -o hello test.c
[ly1@VM-24-9-centos test]$ ll
total 28
-rwxrwxr-x 1 ly1 ly1 8360 Apr 12 20:49 hello
-rw-rw-r-- 1 ly1 ly1  643 Apr 12 20:45 LICENSE
-rw-rw-r-- 1 ly1 ly1  841 Apr 12 20:45 README.en.md
-rw-rw-r-- 1 ly1 ly1  930 Apr 12 20:45 README.md
-rw-rw-r-- 1 ly1 ly1   70 Apr 12 20:48 test.c
[ly1@VM-24-9-centos test]$ ./hello
Hello Word
[ly1@VM-24-9-centos test]$ git add test.c
[ly1@VM-24-9-centos test]$ 

2、commit

如下方带吗,我直接提交显示的是请告诉我你是谁,也就是他不知道我是谁,下面还给了两个代码,大概意思就是让我们用这个去更改邮箱和用户名,就是引号里面的,用户名就是个人主页这个@后面的,邮箱是自己填的。

[ly1@VM-24-9-centos test]$ git commit .

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <ly1@VM-24-9-centos.(none)>) not allowed
[ly1@VM-24-9-centos test]$ 

然后在进行提交这两行代码,然后在进行提交就会出现下方第二个代码,这是说我在提交的时候没有进行备注说明,也就是下方第一个代码块第三句代码,.就是全部提交。

[ly1@VM-24-9-centos test]$ git config --global user.email "2552696329@qq.com"
[ly1@VM-24-9-centos test]$ git config --global user.name "three-thousand-luoshui"

[ly1@VM-24-9-centos test]$ git commit .

Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# Explicit paths specified without -i nor -o; assuming --only paths...
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   test.c
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       hello

这是如下方代码这样在git commit .后面加上-m然后引号,在引号内加上自己的提交信息,就提交上去了。

[ly1@VM-24-9-centos test]$ git commit . -m"这是一个测试"
[master 8d8920e] 这是一个测试
 2 files changed, 6 insertions(+)
 create mode 100755 hello
 create mode 100644 test.c
[ly1@VM-24-9-centos test]$ 

3、push

这是就需要push推送到gitee上的仓库,让两个仓库内容相同,如下方代码,就可以看到gitee上的仓库也提交成功了。

[ly1@VM-24-9-centos test]$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'https://gitee.com': 17719362786   
Password for 'https://17719362786@gitee.com': 
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 2.65 KiB | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/three-thousand-luoshui/test.git
   e4ecb6d..8d8920e  master -> master
[ly1@VM-24-9-centos test]$ 

4、pull

这个就是拉取,如上方代码在我有创建了一个文件进行测试,但是这次提交却不成功,这是因为啥?看他的报错意思就是两边代码不同步,这是就需要利用pull进行拉取同步。

[ly1@VM-24-9-centos test]$ vim test3.c
[ly1@VM-24-9-centos test]$ ll
total 28
-rwxrwxr-x 1 ly1 ly1 8360 Apr 12 20:49 hello
-rw-rw-r-- 1 ly1 ly1  643 Apr 12 20:45 LICENSE
-rw-rw-r-- 1 ly1 ly1  841 Apr 12 20:45 README.en.md
-rw-rw-r-- 1 ly1 ly1  930 Apr 12 20:45 README.md
-rw-rw-r-- 1 ly1 ly1    0 Apr 12 21:20 test3.c
-rw-rw-r-- 1 ly1 ly1   70 Apr 12 20:48 test.c
[ly1@VM-24-9-centos test]$ git add.
git: 'add.' is not a git command. See 'git --help'.

Did you mean this?
	add
[ly1@VM-24-9-centos test]$ git add .
[ly1@VM-24-9-centos test]$ git commit . -m"test"
[master cf21b89] test
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test3.c
[ly1@VM-24-9-centos test]$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'https://gitee.com': 17719362786
Password for 'https://17719362786@gitee.com': 
To https://gitee.com/three-thousand-luoshui/test.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/three-thousand-luoshui/test.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[ly1@VM-24-9-centos test]$ 

如下方代码就是先利用pull进行拉取让两边代码仓库同步,然后进行提交就可以了,如下方图片。

[ly1@VM-24-9-centos test]$ git pull
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://gitee.com/three-thousand-luoshui/test
   8d8920e..3c04c04  master     -> origin/master
Merge made by the 'recursive' strategy.
 test2 | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test2
[ly1@VM-24-9-centos test]$ ll
total 28
-rwxrwxr-x 1 ly1 ly1 8360 Apr 12 20:49 hello
-rw-rw-r-- 1 ly1 ly1  643 Apr 12 20:45 LICENSE
-rw-rw-r-- 1 ly1 ly1  841 Apr 12 20:45 README.en.md
-rw-rw-r-- 1 ly1 ly1  930 Apr 12 20:45 README.md
-rw-rw-r-- 1 ly1 ly1    0 Apr 12 21:23 test2
-rw-rw-r-- 1 ly1 ly1    0 Apr 12 21:20 test3.c
-rw-rw-r-- 1 ly1 ly1   70 Apr 12 20:48 test.c
[ly1@VM-24-9-centos test]$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'https://gitee.com': 17719362786
Password for 'https://17719362786@gitee.com': 
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 501 bytes | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/three-thousand-luoshui/test.git
   3c04c04..8160868  master -> master
[ly1@VM-24-9-centos test]$ 

 

五、思维导图 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1590234.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

三方库移植之NAPI开发(三)通过IDE开发NAPI工程

在三方库移植之NAPI开发[1]—Hello OpenHarmony NAPI一文中&#xff0c;笔者开发的是一个rom包的napi工程。该工程需要编译烧录固件&#xff0c;C 的动态库会集成到开发板的ROM中。在本篇文章中&#xff0c;笔者使用三方库移植之NAPI开发[1]—Hello OpenHarmony NAPI中一样的he…

zabbix监控配置(添加主机、主机组和添加监控项等)

zabbix监控配置 文章目录 zabbix监控配置1.添加主机组2.添加主机&#xff08;linux&#xff09;3.添加主机&#xff08;windows&#xff09;4.监控项配置&#xff08;通过模板添加&#xff09;5.监控项配置&#xff08;手动添加&#xff09; 1.添加主机组 2.添加主机&#xff0…

【Github】PwGen用户友好的Web应用密码生成器

弱密码问题一直是网络安全领域的一个重大挑战。许多人为了方便记忆&#xff0c;倾向于使用简单、常见的密码&#xff0c;如“123456”、“password”或者他们的生日等&#xff0c;这些密码很容易被猜测或通过暴力破解方法攻破。弱密码的使用大大增加了账户被黑客入侵的风险&…

【深入解析spring cloud gateway】13 Reactive Feign的使用

问题引入 在gateway中如果使用feignClient的话&#xff0c;会报如下错误 java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-3at reactor.core.publisher.BlockingSingleSubscriber.bloc…

C++实现一个自定义字符串类(string)

本博客将详细介绍如何在C中实现一个自定义的字符串类 string&#xff0c;这个类模仿了标准库中 std::string 的关键功能。这个过程将涵盖从声明到定义的每一步&#xff0c;重点介绍内存管理、操作符重载以及提供一些关键的实现细节。 首先&#xff1a;我们采用函数的声明与定义…

python--字符串对象和

1、找出10000以内能被5或6整除&#xff0c;但不能被两者同时整除的数&#xff08;函数&#xff09; def Divisible_by_5_6(x:int)->list:arr[]for i in range(1,x1):if (i % 5 0 or i % 6 0 ):if i % 5 0 and i % 6 0:continue #利用continue跳过能被5和6整除的数else:a…

Spring Boot 学习(4)——开发环境升级与项目 jdk 升级

各种版本都比较老&#xff0c;用起来也是常出各样的问题&#xff0c;终于找到一个看来不错的新教程&#xff0c;是原先那个教程的升级。遂决定升级一下开发环境&#xff0c;在升级遇到一些问题&#xff0c;摸索将其解决&#xff0c;得些体会记录备查。 最终确定开发环境约束如下…

ActiveMQ 01 消息中间件jmsMQ

消息中间件之ActiveMQ 01 什么是JMS MQ 全称&#xff1a;Java MessageService 中文&#xff1a;Java 消息服务。 JMS 是 Java 的一套 API 标准&#xff0c;最初的目的是为了使应用程序能够访问现有的 MOM 系 统&#xff08;MOM 是 MessageOriented Middleware 的英文缩写&am…

QLoRa 低秩分解+权重量化的微调

QLoRa的核心思想是首先使用低秩分解技术降低参数的数量&#xff0c;然后对这些低秩表示的参数应用量化技术&#xff0c;进一步减少所需的存储空间和计算量。 https://arxiv.org/abs/2305.14314 低秩分解 低秩分解&#xff08;Low-Rank Factorization&#xff09;&#xff1a;…

Elasticsearch初步了解学习记录

目录 前言 一、ElasticSearch是什么&#xff1f; 二、使用步骤&#xff08;python版&#xff09; 1.引入包 2.连接数据库 3.创建索引 4.写入数据 5.查询数据 三、相关工具介绍 1.ES浏览器插件 总结 前言 随着数据量的不断增加&#xff0c;传统的查询检索在速度上遇…

Android使用shape属性绘制边框内渐变色

目录 先上效果图实现方法shape属性介绍代码结果 先上效果图 这是使用AndroidStudio绘制的带有渐变色的边框背景色 实现方法 项目中由于UI设计需求&#xff0c;需要给按钮、控件设置带有背景色效果的。以下是UI效果图。 这里我们使用shape属性来绘制背景效果。 shape属性介…

机器学习-09-图像处理02-PIL+numpy+OpenCV实践

总结 本系列是机器学习课程的系列课程&#xff0c;主要介绍机器学习中图像处理技术。 参考 【人工智能】PythonOpenCV图像处理&#xff08;一篇全&#xff09; 一文讲解方向梯度直方图&#xff08;hog&#xff09; 【杂谈】计算机视觉在人脸图像领域的十几个大的应用方向&…

清远某国企IBM服务器Board故障上门维修

接到一台来自广东清远市清城区某水利大坝国企单位报修一台IBM System x3650 M4服务器无法开机的故障&#xff0c;分享给大家&#xff0c;同时也方便有需要的朋友能及时找到我们快速解决服务器问题。 故障服务器型号&#xff1a;IBM System x3650 M4 服务器使用单位&#xff1a;…

只要0.74元的双通道数字隔离器,1T1R,增强型ESD-3.0 kV ,150Kbps数字隔离器

前言: 做和电源打交道的设备&#xff0c;通信时非常危险&#xff0c;一定要使用隔离的USB-232转换器&#xff0c;或者你设备的串口与市电直连的设备通信时&#xff0c;现在需要使用数字隔离器&#xff0c;早期的一般都使用光耦&#xff0c;在这种情况下&#xff0c;速度不搞的…

正则表达式:量词(三)

正则表达式中的量词有以下几种:1. *: 匹配前面的字符0次或多次。2. : 匹配前面的字符1次或多次。3.?: 匹配前面的字符0次或1次。4. {n}: 匹配前面的字符恰好n次。5. {n,}: 匹配前面的字符至少n次。6. {n,m}:匹配前面的字符至少n次&#xff0c;但不超过m次。 以下是使用Python的…

Unity TextMeshProUGUI 获取文本尺寸·大小

一般使用ContentSizeFitter组件自动变更大小 API 渲染前 Vector2 GetPreferredValues(string text)Vector2 GetPreferredValues(string text, float width, float height)Vector2 GetPreferredValues(float width, float height) 渲染后 Vector2 GetRenderedValues()Vector…

idea 卡怎么办

设置内存大小 清缓存重启 idea显示内存全用情况 右下角

解决CSS中鼠标移入到某个元素其子元素被遮挡的问题

我们在开发中经常遇到一种场景&#xff0c;就是给元素加提示信息&#xff0c;就是鼠标移入到盒子上面时&#xff0c;会出现提示信息这一功能&#xff0c;如果我们给盒子加了hover&#xff0c;当鼠标移入到盒子上时&#xff0c;让他往上移动5px&#xff0c;即transform: transla…

网盘——搜索用户

目录 1、搜索用户 1.1、在friend.h里面定义槽函数 1.2、关联槽函数 1.3、搜索用户的时候&#xff0c;会弹出一个对话框来,在friend.cpp里面引入下面的头文件&#xff0c;专门用来输入数据的 1.4、获取输入信息&#xff0c;并使用Qstring来接收它 1.5、将上述代码打包&…

AR地图导览小程序是怎么开发出来的?

在移动互联网时代&#xff0c;AR技术的发展为地图导览提供了全新的可能性。AR地图导览小程序结合了虚拟现实技术和地图导航功能&#xff0c;为用户提供了更加沉浸式、直观的导览体验。本文将从专业性和思考深度两个方面&#xff0c;探讨AR地图导览小程序的开发方案。 编辑搜图 …