搭建一个网络仓库
1.服务端:10.0.0.200
准备软件包(1.光盘2.缓存3.联网下载4.同步)
1.挂载镜像
mount /dev/cdrom /mnt
2.通过ftp共享软件包存放的目录
[root@oldboy ~]# yum install vsftpd -y
[root@oldboy ~]# systemctl start vsftpd
[root@oldboy ~]# systemctl stop firewalld
[root@oldboy ~]# setenforce 0
3.将光盘中的软件包都拷贝至ftp的共享目录下
[root@oldboy ~]# mkdir /var/ftp/centos7/
[root@oldboy ~]# find /mnt/ -type f -name "*.rpm" exec cp {} /var/ftp/centos7/ ;
4.将共享的目录设置成yum仓库
[root@oldboy ~]# yum install createrepo -y
[root@oldboy ~]# createrepo /var/ftp/centos7/
2.客户端
10.0.0.199
1.关闭所有公网的yum仓库
[root@oldboy-199 yum.repos.d]# gzip /etc/yum.repos.d/*
2.新建一个rep文件,文件的baseurl指向服务端
[root@oldboy-199 ~]# cat /etc/yum.repos.d/ftpcentos7.repo
[ftp-centos7] name = This is Base Repo
baseurl = ftp://10.0.0.200/centos7/
enable = 1
gpgcheck = 0
测试是否能正常安装软件
[root@oldboy-199 ~]# yum install httpd -y
如果客户机需要通过共享的仓库安装zabbix软件怎么办?
1.服务端需要提供zabbix软件相关的仓库10.0.0.200
curl https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/ > zabbix_1.txt
vim zabbix_1.txt
grep "<a href" zabbix_1.txt
grep "<a href" zabbix_1.txt | awk -F '"' '{print 2}' > zabbix_2.txt
grep "<a href" zabbix_1.txt | awk -F '"' '{print "https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/"2}'
grep "<a href" zabbix_1.txt | awk -F '"' '{print "wget https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/"$2}' > zabbix_3.txt
chmod +x zabbix_3.txt
./zabbix_3.txt
zabb2.获取zabbix的软件包
[root@oldboy ~]# mkdir /var/ftp/zabbix
[root@oldboy ~]# find ./ -type f -name "*.rpm" -exec mv {} /var/ftp/zabbix/ ;
3.将zabbix目录生成一个yum仓库
[root@oldboy ~]# createrepo /var/ftp/zabbix
4.zabbix还缺少四个软件包
wget http://repo.zabbix.com/nonsupported/rhel/7/x86_64/fping-3.10-1.el7.x86_64.rpm
wget http://repo.zabbix.com/nonsupported/rhel/7/x86_64/iksemel-1.42.el7.centos.x86_64.rpm
wget http://repo.zabbix.com/nonsupported/rhel/7/x86_64/iksemel-devel-1.42.el7.centos.x86_64.rpm
wget http://repo.zabbix.com/nonsupported/rhel/7/x86_64/iksemel-utils-1.42.el7.centos.x86_64.rpm
5.客户端新建一个reop文件指向服务端提供的zabbix仓库10.0.0.198
[root@oldboy-199 ~]# cat /etc/yum.repos.d/ftpzabbix.repo
[ftp-zabbix]
name = ftp share zabbix repo
baseurl = ftp://10.0.0.200/zabbix/
enable = 1
gpgcheck = 0
6.客户端测试zabbix仓库是否可用
[root@oldboy-199 ~]# yum clean all
[root@oldboy-199 ~]# yum install zabbix-agent
[root@oldboy-199 ~]# yum install zabbix-get
[root@oldboy-199 ~]# yum install zabbix-server
源码包管理
congiure,生成makefile文件
[root@oldboy nginx-1.16.1]# ./configure -prefix=/usr/local/nginx-1.16 --with-http_mp4_module
[root@oldboy nginx-1.16.1]# yum install pcre pcredevel -y
[root@oldboy nginx-1.16.1]# yum install zlib zlibdevel -y
编译
[root@oldboy nginx-1.16.1]# make
安装
[root@oldboy nginx-1.16.1]# make install
测试
ln -s /usr/local/nginx-1.16/ /usr/local/nginx /usr/local/nginx/sbin/nginx
最后该浏览器访问服务器的地址就可以