服务端:
第一个历程:创建yum仓库目录
mkdir /local_yum
第二个历程:修改yum.conf配置文件,开启缓存keepcache=1
第三个历程:下载所需软件
1、yum -y install rsync
2、yum -y install mariadb-server mariadb
rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3、yum -y install php71w php71w-cli php71w-common php71w-devel \
php71w-embedded php71w-gd php71w-mbstring php71w-pdo php71w-xml php71w-fpm \
php71w-mysqlnd php71w-opcache php71w-mcrypt php71w-pecl-memcached php71w-pecl-mongodb php71w-pecl-redis
vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
4.yum install -y nginx
5.yum install -y nfs-utils rpcbind
6.yum -y install ansible
7.yum install -y httpd
8.yum install -y createrepo (必装)
第四个历程:上传rpm包到yum仓库目录
find /var/cache/yum/x86_64/7/ -type f -name "*.rpm"|xargs mv -t /local_yum
第五个历程:初始化yum仓库
createrepo /local_yum
第六个历程:编写yum配置文件
vim /etc/yum.repos.d/local_yum.repo
[local_yum]
name=local_yum
baseurl=file:///local_yum
enabled=1
priority=1
gpgcheck=0
第七个历程:配置nginx文件
vim /etc/nginx/conf.d/local_yum.conf
server {
listen 80;
server_name 10.0.0.61;
root /local_yum;
autoindex on;
index index.html index.htm;
error_page 500 502 503 504 /50x.html;
location / {
root /local_yum;
index index.html;
}
}
systemctl start nginx
PS:每次加入新的rpm包,更新yum仓库
createrepo --update /local_yum