CSA笔记5-局域网yum源配置互联网yum源配置源代码编译安装

局域网yum源配置:建设一个本地网络仓库给本地局域网用户提供下载安装

互联网yum源配置:在线获取最新安装文件的通道

=========================================================================

1.局域网web方式yum源配置:

服务器提供yum安装服务:

yum install -y httpd  安装并启动httpd    在本地源的基础上进行

setenforce -0  关闭SELinux

getenforce  查看当前状态

Permissive  关闭状态的效果

systemctl stop firewalld  临时关闭防火墙

systemctl status firewalld 查看防火墙状态,空圈表示关闭,绿点表示开启

q  按键退出查看状态命令

httpd 服务的目录文件在  /var/www/html

进入该目录,创建文件夹:mkdir  rhiso,挂载光盘到 rhiso

mount  /dev/sr0  /var/www/html/rhiso

systemctl start httpd     启动httpd

systemctl status httpd    查看httpd是否启动,查看完毕用q键退

在浏览器输入本机ip/rhiso,比如http://127.0.0.1/rhiso/

出现下面页面代表配置完成

注意这里是先改的配置文件,后启动的httpd服务,若操作顺序相反则要重启httpd服务

重启命令:

systemctl  restart  https

客户端访问服务器的yum源:

当在上一台机器已配置好httpd后,我们选择同一网段内网的其他机器配置yum源去访问此台服务器

如果使用拿不到IP地址,是因为我们都是同一个虚拟机拷贝的,会出现地址冲突

mv  /var/lib/NetworkManager  /var/lib/Network/Manager.bak  网络接口备份

reboot   重启虚拟机机器,设备在重启阶段会自动创建一个新的接口

有IP地址后,测试一下,当前客户机是否与服务器联通的情况

ping 服务器IP地址  测试当前主机是否与服务器连接畅通

cd  /etc/yum.repos.d/

vim  local.repo 加入如下内容:

[RHEL9-BaseOS]

name=RHEL9-BaseOS

baseurl=http://192.168.238.129/rhiso/BaseOS

gpgcheck=0

[RHEL9-Appstream]

name=RHEL9-Appstream

baseurl=http://192.168.238.129/rhiso/AppStream

gpgcheck=0

yum clean all   清理旧缓存

yum makecache    建立新缓存

yum repolist   查看仓库列表

出现下图所示内容则说明成功建立yum源:

2.建立第三方互联网络源:

要求:互联网保持畅通

阿里云网络源,aliyun的镜像站点为:

阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区

redhat9.0版本是在centos里,点击centos

优快云收集的各个版本RHEL 的镜像地址

Redhat系列系统在线镜像源_redhat镜像-优快云博客

[litong@localhost yum.repos.d]$ cat /etc/redhat-release

Red Hat Enterprise Linux release 9.3 (Plow)

注:此处先查看自己的发行版本信息,选择相应的仓库

仓库文件可以自己写也可以从aliyu网站下载

su root

cd /etc/yum.repos.d/

[root@localhost ~]# vim /etc/yum.repos.d/aliyun.repo

[appstream]

name=apprestream

baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/AppStream/x86_64/os/

gpgcheck=0

[baseos]

name=baseos

baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/os/

gpgcheck=0

自动排版操作:

1.先按esc键退到命令行模式

2.按下 v键进入可视化魔石

3.用方向键向上移动选中所有文件

4.按下=键自动排版

5.wq保存退出

验证互联网源是否配置成功

[root@localhost ~]# yum clean all

[root@localhost ~]# yum makecache

验证能否装包成功

[root@localhost ~]# yum stall gcc -y

gcc -v

最后显示如下表示编译器gcc安装成功

gcc 版本 11.4.1 20231218 (Red Hat 11.4.1-3) (GCC)

vim  hello.c   编写c源代码

gcc  hello.c   编译c源代码====》自动生成a.out程序

./a.out  执行该程序

yum install gthumb  安装失败,没有资源

扩展源EPEL是yum的一个软件源,里面包含了许多基本源里没有的软件

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

然后可以安装其他扩展软件

3.源代码编译安装

RPM(Red Hat Package Manager)包是已经编译好的二进制软件包,可以直接在系统上安装和运行。

而源代码则是软件的原始代码文件,需要通过编译才能生成可执行程序或库文件。

源代码编译环境需安装支持 C/C++程序语言的编译器 yum install gcc* make

我们以 wget2 为例来进行源码安装

[root@localhost ~]# yum list | grep wget

wget.x86_64 1.21.1-7.el9

@AppStream

[root@localhost ~]# mkdir test && cd test

[root@localhost test]# yum remove -y wget

[root@localhost test]# wget

bash: wget: command not found...

[root@192 test]# rz

[root@192 test]# ll

total 3780

-rw-r--r--. 1 root root 3867884 Apr 30 16:37 wget2-latest.tar.gz

[root@localhost test]# tar -xf wget2-latest.tar.gz

[root@localhost test]# yum -y install make gcc*

[root@localhost test]# ll

total 3784

drwxr-xr-x. 15 root root 4096 Aug 31 2023 wget2-2.1.0

-r--r--r--. 1 root root 3867884 Apr 4 16:27 wget2-latest.tar.gz

[root@localhost test]# cd wget2-2.1.0/

[root@localhost wget2-2.1.0]# yum -y install openssl openssl-devel

[root@localhost wget2-2.1.0]#./configure

[root@localhost wget2-2.1.0]# make

[root@localhost wget2-2.1.0]# make install

[root@localhost ~]# wget2 --version

[root@localhost ~]# wget2

https://dldir1.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.10_240715_x86_64_01.rpm

注意:

1、在执行 "./configure" 命令时,它会检查系统环境,根据系统的特性和用户的选项生成一个适合当前环

境的 Makefile 文件。这个 Makefile 文件包含了编译和安装软件所需的指令,以及根据系统特性进行的

一些配置选项。配置完成后,可以使用 "make" 命令来编译软件包,并使用 "make install" 命令来安装

软件包。

2OpenSSL 库提供了运行时所需的二进制文件和动态库文件,而 OpenSSL-devel 则提供了开发时所需的

头文件和静态库文件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值