配置本地yum源、网络yum源、安装mysql

一、yum源概述

1.yum
软件包管理器,类似于360软件管家,以及⼿机的app市场
2.yum优点
Rpm安装(下载软件,单独安装,需要解决依赖关系)
源码安装 confgure make make install
yum基于rpm,相当于rpm升级版,⾃动解决依赖关系
3.分类:
本地yum源
yum仓库在本地,系统光盘/镜像⽂件⽹络yum源
aliyun  163源  sohu源  清华源  centos源  redhat源  epel源
特定软件:
nginx  mysql  zabbix

二、本地yum源配置

1.找到源文件
2. 将所有的repo⽂件做成压缩包,命名为repo.tar.gz
3.删除所有的repo⽂件

三、网络yum源的分离

1.搜索阿里镜像源
2.根据官方提示配置yum源
https://developer.aliyun.com/mirror/centos
3.下载
4.运⾏ yum makecache⽣成缓存 yum clear
5.查看源

4.特定软件源配置:

1.移除epel源,如果不⾏就全清空

[root@keke ~]# rm -rf /etc/yum.repos.d/epel.repo
您在 /var/spool/mail/root 中有新邮件
[root@keke ~]# yum clear all
已加载插件:fastestmirror
没有该命令:clear。请使⽤ /usr/bin/yum --help
[root@keke ~]# yum makecache
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
extras
| 2.9 kB 00:00:00
local
| 3.6 kB 00:00:00
os
| 3.6 kB 00:00:00
updates
| 2.9 kB 00:00:00
元数据缓存已建⽴
2.搜nginx的镜像:

nginx news

3. 安装稳定版本

[root@keke ~]# vim /etc/yum.repos.d/nginx.repo

4. 创建缓存

[root@keke ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: nginx-stable
Cleaning up list of fastest mirrors
Other repos take up 745 M of disk space (use --verbose for details)
[root@keke ~]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
nginx-stable
| 2.9 kB 00:00:00
(1/3): nginx-stable/7/x86_64/filelists_db
| 121 kB 00:00:01
(2/3): nginx-stable/7/x86_64/primary_db
| 97 kB 00:00:01
(3/3): nginx-stable/7/x86_64/other_db
| 59 kB 00:00:00
元数据缓存已建⽴
您在 /var/spool/mail/root 中有新邮件
[root@keke ~]# yum list|grep nginx
nginx.x86_64 1:1.26.1-2.el7.ngx
nginx-stable
nginx-debug.x86_64 1:1.8.0-1.el7.ngx
nginx-stable
5.安装并且检查 

[root@keke ~]# yum install nginx -y


6. 启动(停用)服务

# 启动服务
[root@keke ~]# nginx
# 查看指令
[root@keke ~]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx
/usr/share/man/man8/nginx.8.gz
# 访问服务器
[root@keke ~]# curl http://localhost
<!DOCTYPE html>
<html>
<head>
<title> Welcome to nginx! </title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed
and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>

# 停⽤ nginx
[root@keke ~]# nginx -s stop
您在 /var/spool/mail/root 中有新邮件
# 访问测试
[root@keke ~]# curl http://localhost
curl: (7) Failed connect to localhost:80; 拒绝连接
[root@keke ~]
四.缓存某些软件到本地: 
1.缓存安装软件包

下⼀次还⽤
国外源
2.如何缓存
vim /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releaserver         # 定义软件包缓存路径
keepcache=1         #开启缓存
debuglevel=2
logfile=/var/log/yum.log
        1.vim /etc/yum.cong
        2.keepcache=1
        3.测试 yum -y. install tree
        4./var/cache/yum/x66_32/7/base/packages/treeexxxxxx.rpm
 [root@keke ~]# vim /etc/yum.conf

3.卸载,然后安装nginx 查看缓存⽂件
 [root@keke ~]# yum -y remove nginx.x86_64

# 安装
[root@keke ~]# yum install nginx -y
# 查找安装包
[root@keke ~]# find /var/cache/ -name "*tree*" -type f
/var/cache/yum/x86_64/7/os/packages/tree-1.6.0-10.el7.x86_64.rpm
您在 /var/spool/mail/root 中有新邮件
[root@keke ~]# find /var/cache/ -name "*nginx*" -type f
/var/cache/yum/x86_64/7/nginx-stable/packages/nginx-1.26.1-
2.el7.ngx.x86_64.rpm
[root@keke ~]#
4.只下载不安装

[root@keke ~]# yum install --downloadonly --downloaddir=./soft/ samba

 [root@keke ~]# ls soft/

6.自建yum仓库:
1.安装createrepo制作仓库的软件

[root@keke ~]# yum -y install createrepo

 2.把soft⽂件夹做成⼀个本地的⾃建仓库

[root@keke ~]# createrepo soft/
[root@keke ~]# cd soft/

[root@keke soft]# ls
avahi-libs-0.6.31-20.el7.x86_64.rpm pytalloc-2.1.16- 1.el7.x86_64.rpm
cups-libs-1.6.3-52.el7_9.x86_64.rpm python-tdb-1.3.18- 1.el7.x86_64.rpm
gnutls-3.3.29-9.el7_6.x86_64.rpm repodata  libldb-1.5.4-2.el7.x86_64.rpm samba-4.10.16-
25.el7_9.x86_64.rpm
libtalloc-2.1.16-1.el7.x86_64.rpm samba-client-libs-4.10.16- 25.el7_9.x86_64.rpm
libtdb-1.3.18-1.el7.x86_64.rpm samba-common-4.10.16- 25.el7_9.noarch.rpm
libtevent-0.9.39-1.el7.x86_64.rpm samba-common-libs-4.10.16- 25.el7_9.x86_64.rpm
libwbclient-4.10.16-25.el7_9.x86_64.rpm samba-common-tools-4.10.16- 25.el7_9.x86_64.rpm
nettle-2.7.1-9.el7_9.x86_64.rpm samba-libs-4.10.16- 25.el7_9.x86_64.rpm
pyldb-1.5.4-2.el7.x86_64.rpm trousers-0.3.14- 2.el7.x86_64.rpm
3.在/etc/yum.repos.d/下创建 soft.repo
vim /etc/yum.repos.d/soft.repo
[soft]
name=soft
baseurl=file:///root/soft/
gpgcheck=0
enable=1
yum clean all
yum makecache
 4.再次安装samba

[root@keke soft]# yum -y install samba

  • 8
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值