Linux云计算运维工程师day20

yum仓库

  1. 服务器批量下载 rpm 包(光盘、下载、同步)
#下载nginx
curl http://nginx.org/packages/centos/7/x86_64/RPMS/ > 1.txt
grep "gref" 1.txt | awk -F '"' '{print $2}' sed -r 's#(.*)#wget  http://nginx.org/packages/centos/7/x86_64/RPMS/\1#g' > 2.txt
sh 2.txt
#下载zabbix
curl https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/  >1.txt
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' |bash
#下载mongodb
curl https://mirrors.aliyun.com/mongodb/yum/redhat/7/mongodb-org/3.0/x86_64/RPMS/ >1.txt
grep "href"  1.txt  | awk -F '"' '{print $2}' | sed -r 's#(.*)#wget https://mirrors.aliyun.com/mongodb/yum/redhat/7/mongodborg/3.0/x86_64/RPMS/\1#g' |bash
yum install vsftpd -y	#下载ftp
systemctl start vsftpd	#启动ftp
setenforce 0			#关闭selinux
systemctl stop firewalld	#关闭firewalld防火墙
  1. 将 rpm 包的目录制成仓库
yum install createrepo -y
createrepo /var/ftp/mongodb
createrepo /var/ftp/zabbix
createrepo /var/ftp/nginx
  1. 客户端配置源
vim /etc/yum.repos.d/ftp/mongodb.repo
#---------------mongodb.repo---------
[mongodb]
name = db
baseurl = ftp://10.0.0.200/mongodb/
enabled = 1
gpgcheck = 0
#-----------------------------------
yum install mongodb-org	

vim /etc/yum.repos.d/ftp_zabbix.repo
#--------------zabbix.repo-----------
[zabbix-rep]
name = zabbix monitor
baseurl = ftp://10.0.0.200/zabbix/
enable = 1
gpgcheck = 0
#----------------------------------
yum install zabbix-agent
  1. 源码包管理
wget http://nginx.org/download/nginx-1.16.1.tar.gz
mkdir  /soft
tar xf nginx-1.16.1.tar.gz  -C /soft/
cd /soft/nginx-1.16.1/
./configure --prefix=/usr/local/nginx-1.16
make
make install
#为了后期好升级
ln -s /usr/local/nginx-1.16/ /usr/local/nginx
#停止此前的httpd服务,避免端口被占用造成nginx无法启动
systemctl stop httpd
#启动nginx
/usr/local/nginx/sbin/nginx
#报错信息
./configure: error: the HTTP rewrite module requires the PCRE library.
yum install pcre-devel -y	#处理方法
./configure: error: the HTTP gzip module requires the zlib library.
yum install zlib-devel -y	#处理方法

你可能感兴趣的:(Linux云计算运维工程师)