5.8学习笔记
包管理工具rpm:
rpm -ivh 软件包名 : 安装rpm包 ---->直接安装网络资源
rpm -qa : 查询系统中所有的rpm包
rpm -e : 卸载一个rpm包
rpm -ql : 查询一个rpm包所生成的所有文件
rpm -qf : 查询某一个文件是那个rpm包生成的
rpm -qc : 查询一个rpm的配置文件
yum管理
yum源
1.更换yum源
创建目录 备份官方yum源
curl -o /etc/yum.repos.d/CentOS-base.repo
https://mirrors.aliyun.com/repo/Centos-7.repo
wget -o /etc/yum.repos.d/epel.reps
https://mirrors.aliyun.com
2.查看yum源 : yum repolist
3.清理yum源缓存 : yum clean all
4.生成yum缓存 : yum makecache fast
5.安装 : yum install
6.更新 : yum update ---->保留旧的rpm包
yum upgrade---->删除旧的rpm包
7.卸载 : yum remove
yum erase
8.搜索 : yum search
9.列出 : yum list
10.回滚: yum history--->yum history undo id
11.重新安装 : yum reinstall
查找命令在那个包 : yum provides 命令 :
12.配置本地yum源
1)备份
2)挂载镜像
3)mount /dev/cdrom /mnt
4)编辑配置文件
vim /etc/yum.repos.d/local.repo
[local]
name=local
baseurl=file:///mnt
enable=1
gpgcheck=0
13.配置局域网内yum源
[准备环境]
需要两台服务器
关闭防火墙并开机不自启
systemctl status firewalld && systemctl disable firewalld
关闭selinux
set enforce 0
vim /etc/selinux/config
SELINUX=enfocing修改为
SELINUX=disable
互ping检测网络是否通畅
[yum服务端 :]
1)安装ftp服务
yum -y install vsftpd
mkdir /var/ftp/yum
systemctl start vsftpd
2)获取rpm
拷贝镜像中的rpm包
3)制作yum源
yum -y install createrepo
createrepo /var/ftp/yum
[yum客户端 :]
vim /etc/yum.repos.d/ftp.repo
[ftp]
name=ftp repo
baseurl=ftp://服务端ip:port/路径
enable=1
gpgcheck=0
14.克隆yum源updates
yum -y install yum-utils epel-release createrepo
yum -y install nginx
cd /usr/share/nginx/html
rm -rf *
reposync -r base -r epel -r extras -r updates
createrepo base
epel
extras
updates
客户端:
vim /etc/yum.repos.d/nginx.repo
[base]
name=nginx repo
baseurl=http://服务端ip/base
gpgcheck=0
[epel]
name=epel repo
baseurl=http://服务端ip/epel
gpgcheck=0