7.16 练习

1.插⼊优盘,读取优盘数据

2.在vmware配置光盘iso⽂件,在linux系统中读取光盘⽂件

3.配置阿⾥云yum仓库

(1)根据官⽅提示配置yum源https://developer.aliyun.com/mirror/centos

 


# 复制阿⾥云提供的url,下载⽂件
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo
https://mirrors.aliyun.com/repo/Centos-7.repo
--2024-07-14 20:00:04-- https://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 117.23.49.221,
117.23.49.224, 58.222.47.210, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|117.23.49.221|:443... 已
连接。
已发出 HTTP 请求,正在等待回应... 200 OK
⻓度:2523 (2.5K) [application/octet-stream]
正在保存⾄: “/etc/yum.repos.d/CentOS-Base.repo”
100%
[======================================================================
>] 2,523 --.-K/s ⽤时 0s 
2024-07-14 20:00:04 (469 MB/s) - 已保存 “/etc/yum.repos.d/CentOSBase.repo” [2523/2523])
# 查看下载的⽂件
[root@localhost yum.repos.d]# ls
20240714001.repo CentOS-Base.repo repo.tar.gz

  (2)创建一个新的aliyun.repo文件在/etc/yum.repos.d/目录下,可以使用vim或者其他文本编辑器进行编辑:

vim /etc/yum.repos.d/aliyun.repo 

(3)将以下内容添加到aliyun.repo文件中:

[aliyun-base]
name=Aliyun Base $releasever - $basearch
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
enabled=1
gpgcheck=0
 
[aliyun-updates]
name=Aliyun Updates $releasever - $basearch
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
enabled=1
gpgcheck=0
 
[aliyun-extras]
name=Aliyun Extras $releasever - $basearch
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
enabled=1
gpgcheck=0

(4)保存并退出编辑器,例如在vim中按下Esc键,然后输入:wq并按下Enter

(5)清理现有的yum缓存:

yum clean all

(6)更新yum缓存 

yum makecache

(7)查看源

[root@localhost yum.repos.d]# yum repolist all
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
源标识 源名称
 状态
base/7/x86_64 CentOS-7 - Base -
mirrors.aliyun.com 启⽤: 10,072
centosplus/7/x86_64 CentOS-7 - Plus -
mirrors.aliyun.com 禁⽤
contrib/7/x86_64 CentOS-7 - Contrib -
mirrors.aliyun.com 禁⽤
extras/7/x86_64 CentOS-7 - Extras -
mirrors.aliyun.com 启⽤: 526
local local0 
 启⽤: 9,911
updates/7/x86_64 CentOS-7 - Updates -
mirrors.aliyun.com 启⽤: 6,173
repolist: 26,682

(8)再次安装httpd

[root@localhost yum.repos.d]# yum -y install httpd
已安装:
 httpd.x86_64 0:2.4.6-99.el7.centos.1 
完毕!

4.配置清华镜像仓库

(1)打开终端或命令提示符窗口。

(2)编辑 /etc/apt/sources.list 文件,可以使用文本编辑器如 nano、vim、gedit等。可以使用以下命令打开:

sudo nano /etc/apt/sources.list

(3)在 sources.list 文件中,找到并注释掉原来的镜像仓库地址,可以在前面加上 "#" 

deb http://archive.ubuntu.com/ubuntu bionic main restricted
  1. 保存文件并退出编辑器(在 nano 中按 Ctrl + O 保存,然后按 Ctrl + X 退出)。

  2. 运行以下命令更新本地包列表:

    sudo apt update

 

5.配置腾讯镜像仓库

腾讯软件源

(1)根据官⽅提示配置yum源腾讯软件源 

(2)下载文件

[root@localhost yum.repos.d]# rm -rf /etc/yum.repos.d/CentOS-Base.repo
[root@localhost yum.repos.d]# cd
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo
http://mirrors.cloud.tencent.com/repo/centos7_base.repo
--2024-07-14 20:17:18-- 
http://mirrors.cloud.tencent.com/repo/centos7_base.repo
正在解析主机 mirrors.cloud.tencent.com (mirrors.cloud.tencent.com)...
101.227.191.8, 101.227.191.31, 114.80.12.245, ...
正在连接 mirrors.cloud.tencent.com
(mirrors.cloud.tencent.com)|101.227.191.8|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
⻓度:1694 (1.7K) [application/octet-stream]
正在保存⾄: “/etc/yum.repos.d/CentOS-Base.repo”
100%
[======================================================================
>] 1,694 --.-K/s ⽤时 0s 
2024-07-14 20:17:18 (275 MB/s) - 已保存 “/etc/yum.repos.d/CentOSBase.repo” [1694/1694])

(3)更新缓存

[root@localhost ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: extras local os updates
Cleaning up list of fastest mirrors
Other repos take up 112 M of disk space (use --verbose for details)
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# yum makecache
已加载插件:fastestmirror
(14/14): updates/7/x86_64/primary_db 
 | 27 MB 00:00:20 
元数据缓存已建⽴

(4)epel源配置 对官⽅和官⽹源的扩展, yum -y install epel-release 

[root@localhost ~]# yum -y install epel-release
已安装:
 epel-release.noarch 0:7-11 
完毕!
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# yum repolist all
[root@localhost ~]# ls /etc/yum.repos.d/
20240714001.repo CentOS-Base.repo epel.repo epel-testing.repo 
repo.tar.gz

(5)安装小火车

[root@localhost ~]# yum -y install sl
已安装:
 sl.x86_64 0:5.02-1.el7 
完毕!
您在 /var/spool/mail/root 中有新邮件

6.⾃建仓库 包含 tree net-tools bash-completion nginx tree等包

(1)创建一个目录来存储软件包文件。使用以下命令来创建一个名为myrepo的目录:

mkdir myrepo


(2)将软件包文件放入myrepo目录中。

(3)使用 dpkg-scanpackages 命令来创建 Packages 文件。确保在myrepo目录中打开终端,然后运行以下命令:

dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz

(4)在myrepo目录中创建一个Release文件

Origin: MyRepo
Label: MyRepo
Suite: stable
Version: 1.0
Codename: bionic
Architectures: amd64
Components: main
Description: My custom repository

(5)使用apt-ftparchive命令生成Release文件并签名该文件。在myrepo目录下执行以下命令:

apt-ftparchive release . > Release
gpg --default-key <your_gpg_key> -abs -o - Release > Release.gpg

(6)搭建一个简单的 HTTP 服务器来托管您的软件仓库

cd myrepo
python3 -m http.server 8000

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值