1.下载公网rpm 包
例: zabbix nginx mongodb
创建zabbix 目录 进入该目录
[root@wangjc ~]# mkdir zabbix
[root@wangjc ~]# ls
zabbix
[root@wangjc ~]# cd zabbix
[root@wangjc zabbix]#
下载 公网包网页内容
[root@wangjc ~]# curl https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/ >1.txt
[root@wangjc ~]# tail 1.txt
zabbix-web-pgsql-4.0.3-1.el7.noarch.rpm 20-Dec-2018 12:28 8160
zabbix-web-pgsql-4.0.4-1.el7.noarch.rpm 04-Feb-2019 11:02
选一个包的下载地址 查看
https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.1-1.el7.x86_64.rpm
#与网页内容 比对
编写所有rpm包 下载地址到 2.txt
筛选网页内容中的包名 | awk取出所有包名 | sed 选用模式 将所有下载地址重定向到 2.txt
[root@wangjc ~]# grep "href" 1.txt | awk -F '"' '{print $2}'|sed -r 's#(.*)#wget https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/\1#g' >2.txt
sh 执行2.txt
2.通过 http 或 ftp 让客户端 得到rpm包
安装 ftp 服务
yum install vsftpd -y #安装vsftpd软件
systemctl start vsftpd #开启ftp 服务
setenforce 0 #关闭selinux
systemctl stop firewalld #关闭防火墙
访问ftp://10.0.0.200 验证
3.将rpm包所在的目录 创建一个仓库
安装 createrepo
yum install createrepo -y
[root@wangjc ~]# createrepo /var/ftp/zabbix/
[root@wangjc ~]# createrepo /var/ftp/mongodb/
4.客户端 使用yum库
进入客户端 yum源目录 注释所有源
root@my-centos ~]# cd /etc/yum.repos.d/
[root@my-centos yum.repos.d]# gzip *
[root@my-centos yum.repos.d]# ls
CentOS-Base.repo.gz CentOS-fasttrack.repo.gz CentOS-Vault.repo.gz
CentOS-CR.repo.gz CentOS-Media.repo.gz
CentOS-Debuginfo.repo.gz CentOS-Sources.repo.gz
编辑yum仓库 源配置文件
[root@my-centos yum.repos.d]# vi test.repo
[root@my-centos yum.repos.d]# cat test.repo
[test]
name = test
baseurl = ftp://10.0.0.200/mongodb
enabled = 1
gpgcheck = 0
安装 mongodb-org 测试
[root@my-centos yum.repos.d]# yum install mongodb-org -y
Loaded plugins: fastestmirror
Determining fastest mirrors
test | 2.9 kB 00:00:00
test/primary_db | 79 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:3.0.15-1.el7 will be installed
--> Processing Dependency: mongodb-org-tools = 3.0.15 for package: mongodb-org-3.0.15-1.el7.x86_64
--> Processing Dependency: mongodb-org-shell = 3.0.15 for package: mongodb-org-3.0.15-1.el7.x86_64
--> Processing Dependency: mongodb-org-server = 3.0.15 for package: mongodb-org-3.0.15-1.el7.x86_64
--> Processing Dependency: mongodb-org-mongos = 3.0.15 for package: mongodb-org-3.0.15-1.el7.x86_64
--> Running transaction check
---> Package mongodb-org-mongos.x86_64 0:3.0.15-1.el7 will be installed
---> Package mongodb-org-server.x86_64 0:3.0.15-1.el7 will be installed
---> Package mongodb-org-shell.x86_64 0:3.0.15-1.el7 will be installed
---> Package mongodb-org-tools.x86_64 0:3.0.15-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
mongodb-org x86_64 3.0.15-1.el7 test 5.8 k
Installing for dependencies:
mongodb-org-mongos x86_64 3.0.15-1.el7 test 4.6 M
mongodb-org-server x86_64 3.0.15-1.el7 test 9.7 M
mongodb-org-shell x86_64 3.0.15-1.el7 test 5.0 M
mongodb-org-tools x86_64 3.0.15-1.el7 test 38 M
Transaction Summary
==========================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 57 M
Installed size: 166 M
Downloading packages:
(1/5): mongodb-org-3.0.15-1.el7.x86_64.rpm | 5.8 kB 00:00:00
(2/5): mongodb-org-mongos-3.0.15-1.el7.x86_64.rpm | 4.6 MB 00:00:00
(3/5): mongodb-org-shell-3.0.15-1.el7.x86_64.rpm | 5.0 MB 00:00:00
(4/5): mongodb-org-server-3.0.15-1.el7.x86_64.rpm | 9.7 MB 00:00:00
(5/5): mongodb-org-tools-3.0.15-1.el7.x86_64.rpm | 38 MB 00:00:00
------------------------------------------------------------------------------------------
Total 81 MB/s | 57 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mongodb-org-server-3.0.15-1.el7.x86_64 1/5
Installing : mongodb-org-shell-3.0.15-1.el7.x86_64 2/5
Installing : mongodb-org-mongos-3.0.15-1.el7.x86_64 3/5
Installing : mongodb-org-tools-3.0.15-1.el7.x86_64 4/5
Installing : mongodb-org-3.0.15-1.el7.x86_64 5/5
Verifying : mongodb-org-tools-3.0.15-1.el7.x86_64 1/5
Verifying : mongodb-org-mongos-3.0.15-1.el7.x86_64 2/5
Verifying : mongodb-org-shell-3.0.15-1.el7.x86_64 3/5
Verifying : mongodb-org-3.0.15-1.el7.x86_64 4/5
Verifying : mongodb-org-server-3.0.15-1.el7.x86_64 5/5
Installed:
mongodb-org.x86_64 0:3.0.15-1.el7
Dependency Installed:
mongodb-org-mongos.x86_64 0:3.0.15-1.el7 mongodb-org-server.x86_64 0:3.0.15-1.el7
mongodb-org-shell.x86_64 0:3.0.15-1.el7 mongodb-org-tools.x86_64 0:3.0.15-1.el7
Complete!
5.源码包管理
./configure #我想做什么菜,给哪个客人 --> 弄成一份清单
make #按照清单做成对应的食物
make install #将食物端到客人的桌上
下载 源码包
[root@wangjc ~]# wget http://nginx.org/download/nginx-1.16.1.tar.gz
[root@wangjc ~]# mkdir /soft
[root@wangjc ~]# tar xf nginx-1.16.1.tar.gz -C /soft/
[root@wangjc ~]# cd /soft/nginx-1.16.1/
[root@wangjc nginx-1.16.1]# ./configure --prefix=/usr/local/nginx-1.16
[root@wangjc nginx-1.16.1]# make
[root@wangjc nginx-1.16.1]# make install
为了后期好升级
[root@wangjc nginx-1.16.1]# ln -s /usr/local/nginx-1.16/ /usr/local/nginx
#停止此前的httpd服务,避免端口被占用造成nginx无法启动
[root@wangjc nginx-1.16.1]# systemctl stop httpd
#启动nginx
[root@wangjc nginx-1.16.1]# /usr/local/nginx/sbin/nginx
---------------------------------------------------------------------------
#报错信息
./configure: error: the HTTP rewrite module requires the PCRE library.
[root@wangjc nginx-1.16.1]# yum install pcre-devel -y
./configure: error: the HTTP gzip module requires the zlib library.
[root@wangjc nginx-1.16.1]# yum install zlib-devel -y