CentOS7下的YUM源服務器搭建
2.安裝server端
3.配置server端
4.配置當前系統yum來源repo文件
5.進行同步腳本的創建並執行同步
1.目標要求
yum源服務器要自動更新自身源
使用CentOS官方標準源version6和version7的兩個版本保持更新
客戶端可以直接使用源
國內速度比較快的源服務器
http://mirrors.aliyun.com/
http://centos.ustc.edu.cn/centos/
http://mirrors.163.com
2.安裝server端
關閉防火墻和selinux
[root@localhost ~]# vim /etc/hostname |
yumserver |
[root@localhost ~]# hostnamectl status |
Static hostname: yumserver Icon name: computer-vm Chassis: vm Machine ID: 06490d1675224b898ac71b9ed141cb39 Boot ID: 2a568995acaa4bb2928bdb8e6330ddd3 Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-327.el7.x86_64 Architecture: x86-64 |
[root@localhost ~]# su - root [root@yumserver ~]# systemctl stop firewalld.service [root@yumserver ~]# systemctl disable firewalld.service |
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. |
[root@yumserver ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config [root@yumserver ~]# setenforce 0 |
安裝nginx軟件包
[root@yumserver ~]# yum -y install epel-release [root@yumserver ~]# yum -y install nginx |
Installed: nginx.x86_64 1:1.12.2-1.el7 Dependency Installed: GeoIP.x86_64 0:1.5.0-11.el7 fontconfig.x86_64 0:2.10.95-11.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 gd.x86_64 0:2.0.35-26.el7 gperftools-libs.x86_64 0:2.4-8.el7 libX11.x86_64 0:1.6.5-1.el7 libX11-common.noarch 0:1.6.5-1.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXpm.x86_64 0:3.5.12-1.el7 libjpeg-turbo.x86_64 0:1.2.90-5.el7 libpng.x86_64 2:1.5.13-7.el7_2 libunwind.x86_64 2:1.2-2.el7 libxcb.x86_64 0:1.12-1.el7 libxslt.x86_64 0:1.1.28-5.el7 lyx-fonts.noarch 0:2.2.3-1.el7 nginx-all-modules.noarch 1:1.12.2-1.el7 nginx-filesystem.noarch 1:1.12.2-1.el7 nginx-mod-http-geoip.x86_64 1:1.12.2-1.el7 nginx-mod-http-image-filter.x86_64 1:1.12.2-1.el7 nginx-mod-http-perl.x86_64 1:1.12.2-1.el7 nginx-mod-http-xslt-filter.x86_64 1:1.12.2-1.el7 nginx-mod-mail.x86_64 1:1.12.2-1.el7 nginx-mod-stream.x86_64 1:1.12.2-1.el7 Dependency Updated: openssl.x86_64 1:1.0.2k-8.el7 openssl-libs.x86_64 1:1.0.2k-8.el7 Complete! |
[root@yumserver ~]# find / -name nginx.conf |
/etc/nginx/nginx.conf |
[root@yumserver ~]# vim /etc/nginx/nginx.conf |
autoindex on; #表示自動在index.html的索引打開 autoindex_exact_size on; #表示如果有文件則顯示文件大小; autoindex_localtime on; #表示顯示更改時間,以點前系統的時間為準; error_page 404 /404.html; |
安裝createrepo軟件包
安裝建yum源倉庫的工具,可以用來建立yum倉庫
[root@yumserver ~]# yum -y install createrepo yum-utils |
Installed: createrepo.noarch 0:0.9.9-28.el7 Dependency Installed: deltarpm.x86_64 0:3.6-3.el7 libxml2-python.x86_64 0:2.9.1-6.el7_2.3 python-deltarpm.x86_64 0:3.6-3.el7 Dependency Updated: libxml2.x86_64 0:2.9.1-6.el7_2.3 Complete! |
安裝yum-plugin-priorities軟件包
安裝控制yum源更新優先級工具,這個工具可以用來控制進行yum源檢索的先後順序,建議用在client端。
[root@yumserver ~]# yum -y install yum-plugin-priorities |
Installed: yum-plugin-priorities.noarch 0:1.1.31-42.el7 Complete! |
3.配置server端
[root@yumserver /]# find / -name html |
/usr/share/doc/pam-1.1.8/html /usr/share/nginx/html |
[root@yumserver ~]# mkdir -p /usr/share/nginx/html/CentOS-Yum/CentOS6/x86_64 [root@yumserver ~]# mkdir -p /usr/share/nginx/html/CentOS-Yum/CentOS7/x86_64 [root@yumserver ~]# chmod -R +x /usr/share/nginx/html [root@yumserver ~]# vim /usr/share/nginx/html/index.html |
</head> <body> <h1>Welcome to <strong>nginx</strong> on Fedora!</h1> <div class="content"> <p>This page is used to test the proper operation of the <strong>nginx</strong> HTTP server after it has been installed. If you can read this page, it means that the web server installed at this site is working properly.</p> <div class="alert"> <h2>Website Administrator</h2> <div class="content"> <p style="font-weight:bolder;color:green;font-size:30px;">ALL of the packages in the below:</p> <br/> <a href="http://10.9.254.33/Zabbix-Yum/CentOS6">zabbix3.4-centos6</a><br/> These packagers from of Zabbix3.4-Centos6.<br/> <a href="http://10.9.254.33/Zabbix-Yum/CentOS7">zabbix3.4-centos7</a><br/> These packagers from of Zabbix3.4-Centos7.<br/> <a href="http://10.9.254.33/CentOS-Yum/CentOS6">centos6</a><br/> These packagers from of Centos6.<br/> <a href="http://10.9.254.33/CentOS-Yum/CentOS7">centos7</a><br/> These packagers from of Centos7.<br/> <p style="font-weight:bolder;color:red;font-size:18px;">Please replace the file and fill in the following content:</p> <p style="font-weight:bolder;color:blue;font-size:15px;">Way: /etc/yum.repos.d/CentOS-Base.repo</p> </div> </div> <div class="logos"> <a href="http://nginx.net/"><img src="nginx-logo.png" alt="[ Powered by nginx ]" width="121" height="32" /></a> <a href="http://fedoraproject.org/"><img src="poweredby.png" alt="[ Powered by Fedora ]" width="88" height="31" /></a> </div> </div> </body> </html> |
[root@yumserver ~]# service nginx restart |
4.配置當前系統yum來源repo文件
備份現有CentOS-Base.repo文件
[root@yumserver ~]# cp -p /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back [root@yumserver ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo [root@yumserver ~]# ll /etc/yum.repos.d/CentOS-Base.repo |
下載並查看CentOS-Base.repo文件
[root@yumserver ~]# vim /etc/yum.repos.d/CentOS-Base.repo |
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
|
目前只能是CentOS7的版本的所有yum源,如果需要同步6版本的yum源,將CentOS-Base.repo文件內的7版本號更改為6就可以了。將$releasever替換為6,將$basearch替換為x86_64,將版本7改為6
:1,$s/$releasever/6/g
5.進行同步腳本的創建並執行同步
[root@yumserver ~]# reposync –p /usr/share/nginx/html/CentOS-Yum/CentOS7/x86_64/ [root@yumserver ~]# ls |
anaconda-ks.cfg base extras updates |
[root@yumserver ~]# mv base/ /usr/share/nginx/html/CentOS-Yum/CentOS7/x86_64/ [root@yumserver ~]# mv extras/ /usr/share/nginx/html/CentOS-Yum/CentOS7/x86_64/ [root@yumserver ~]# mv updates/ /usr/share/nginx/html/CentOS-Yum/CentOS7/x86_64/ [root@yumserver ~]# cd /usr/share/nginx/html/CentOS-Yum/CentOS7/x86_64/ [root@yumserver x86_64]# ls |
base extras updates |
[root@yumserver ~]# createrepo -p /usr/share/nginx/html/CentOS-Yum/CentOS7/x86_64/base/Packages/ |
Spawning worker 0 with 4796 pkgs Spawning worker 1 with 4795 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete |
[root@yumserver ~]# createrepo -p /usr/share/nginx/html/CentOS-Yum/CentOS7/x86_64/extras/Packages/ |
Spawning worker 0 with 163 pkgs Spawning worker 1 with 163 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete |
[root@yumserver ~]# createrepo -p /usr/share/nginx/html/CentOS-Yum/CentOS7/x86_64/updates/Packages/ |
Spawning worker 0 with 770 pkgs Spawning worker 1 with 770 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete |
使用同樣方法,同步centos6軟件包。
[root@yumserver yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo [root@yumserver yum.repos.d]# vim /etc/yum.repos.d/CentOS-Base.repo |
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-6 - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/ http://mirrors.aliyuncs.com/centos/6/os/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6 - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/6/updates/x86_64/ http://mirrors.aliyuncs.com/centos/6/updates/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6 - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/6/extras/x86_64/ http://mirrors.aliyuncs.com/centos/6/extras/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages [centosplus] name=CentOS-6 - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/6/centosplus/x86_64/ http://mirrors.aliyuncs.com/centos/6/centosplus/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6 - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/6/contrib/x86_64/ http://mirrors.aliyuncs.com/centos/6/contrib/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 |
將$releasever替換為6,將$basearch替換為x86_64,將版本7改為6 :1,$s/$releasever/6/g |
[root@yumserver yum.repos.d]# yum clean all [root@yumserver yum.repos.d]# yum makecache [root@yumserver yum.repos.d]# yum repolist |
Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com repo id repo name status base CentOS-6 - Base - mirrors.aliyun.com 6,706 extras CentOS-6 - Extras - mirrors.aliyun.com 46 updates CentOS-6 - Updates - mirrors.aliyun.com 834 repolist: 7,586 |
[root@yumserver yum.repos.d]# cd /usr/share/nginx/html/CentOS-Yum/CentOS6/x86_64/ [root@yumserver x86_64]# reposync -p /usr/share/nginx/html/CentOS-Yum/CentOS6/x86_64/ [root@yumserver x86_64]# ls |
base extras updates |
[root@yumserver ~]# createrepo -p /usr/share/nginx/html/CentOS-Yum/CentOS6/x86_64/base/Packages/ |
Spawning worker 0 with 3457 pkgs Spawning worker 1 with 3457 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete |
[root@yumserver ~]# createrepo -p /usr/share/nginx/html/CentOS-Yum/CentOS6/x86_64/extras/Packages/ |
Spawning worker 0 with 23 pkgs Spawning worker 1 with 23 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete |
[root@yumserver ~]# createrepo -p /usr/share/nginx/html/CentOS-Yum/CentOS6/x86_64/updates/Packages/ |
Spawning worker 0 with 417 pkgs Spawning worker 1 with 417 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete |
CentOS7下的YUM源服務器搭建
相關推薦
CentOS7下的YUM源服務器搭建
centos7 yum 源 1.目標要求2.安裝server端3.配置server端4.配置當前系統yum來源repo文件5.進行同步腳本的創建並執行同步1.目標要求yum源服務器要自動更新自身源使用CentOS官方標準源version6和version7的兩個版本保持更新客戶端可以直接使用源國內
搭建本地yum源服務器
yum源 yum源的搭建可分為兩種方法:使用本地鏡像進行搭建,鏡像中的rpm版本比較舊搭建Apache服務器掛載ISO鏡像,將鏡像中的包放至Apache服務器目錄下用yum源服務器的包同步到本地在Apache服務器目錄下建立對應目錄用rsync同步一、使用本地鏡像搭建Apache服務器 使用yum安裝,
Linux下的SVN服務器搭建
括號 reat image tab 細節 inpu 犯錯 res min 鑒於在搭建時,參考網上很多資料,網上資料在有用的同時,也坑了很多人 本文的目的,也就是想讓後繼之人在搭建svn服務器時不再犯錯,不再被網上漫天的坑爹作品所坑害,故此總結 /******開始******
實現centos7下對ftp服務器賬戶權限的控制
pam.d acc rwx 下載 sbin vpd nag ado 安全 一、建立虛擬用戶vim /etc/vsftpd/vsuserftp1centosftp2linuxftp3Debain轉換成.db文件 【註意:必須是.db結尾】db_load -T -t ha
Linux運維高級篇—CentOS 7下Postfix郵件服務器搭建
linux下構建postfix郵件服務器第一章 實驗環境 硬件環境:Linux服務器一臺,IP地址:192.168.80.10;WIN7客戶端一臺,擁有OUTLOOK2013,測試用,與服務器在同一局域網內。 Linux系統環境,如下圖: 第二章 實驗內容一:搭建DNS服務器二:搭建postfix服務
連接到放置本地yum源服務器之前的註意事項
tar art body sta http bsp start pos yum源 1.確認系統防火墻關閉 2.啟動httpd服務 service httpd start 如果提示沒有httpd服務: 安裝httpd服務 yum install
001.YUM源服務端搭建
一 前期準備 1.1 地址規劃 主機名 IP地址 備註
yum-內網yum源服務器配置(CentOS6.5)
tar img pan 內網 check 服務器 掛載點 x86_64 版本 一、安裝apache服務1.安裝httpd服務 yum -y install httpd (純內網用rpm包安裝也可以)2.啟動httpd服務 service httpd sta
centos7下SVN服務器搭建
位置 安裝 -perm svn服務器搭建 fire 啟動 ups 所在 creat 1,安裝 yum install subversion 2,輸入rpm -ql subversion查看安裝位置 3,創建svn版本庫目錄 mkdir -p /var/svn/svnr
centos7的yum源配置,web和ftp服務器掛載
yum源 web服務開啟 ftp服務開啟 一、配置軟件倉庫 1.yum簡介 基於rpm軟件包的安裝部署機制 自動解決軟件包的依賴關系 需要先配置軟件倉庫 2.配置本地的軟件倉庫 a.放入centos7.iso鏡像文件到光驅中,確保電源開啟 b.命令操作 # umount /dev/cdrom /
linux 中 yum 源本地的搭建 ----以及web、ftp服務器的搭建
yum源的搭建# 今天簡單的給大家介紹以下yum源的搭建 #在介紹yum源搭建時,大家可以仔細想想我們在windows中是如何安裝軟件的,或者再想想我們整天愛不離手的手機,是如何安裝軟件的 #我們一般在windows中安裝軟件,是從網上下載到本地,一般下載下來的文件名都為.exe
CentOS7下dns服務器搭建
將不 更新數據 -- service master p地址 ftp 聯系人 -c 在centos7系統下: [[email protected] ~]# yum install -y bind bind-utils bind-chroot 安裝完成後
CentOS6.4下郵件服務器搭建
alias 主機名 啟動 -type 根據 under 服務器安裝 dovecot 資料 CentOS6.4下郵件服務器搭建 linux下郵件服務器的搭建大致分為三個步驟 準備工作(真實的生產環境下需要) 發送服務器安裝及配置 (Postfix) 接收服務器安裝及
基於tinyproxy搭建yum代理服務器
mtu packet onf adc enca 容器 back user spa 在我們實際的工作當中,經常會遇到這種情況,我們對線上服務器進行操作時是通過跳板機來進行的,出於安全性及投入資金來考慮非必要情況下除跳板機以外的服務器是沒有內網ip的,所以當我們位於內網的服務器
Centos7單臺服務器搭建FastDFS+Nginx
服務器 下載安裝 Fastdfs+Nginx配置操作單臺配置安裝包下載:wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gzwget http://jaist.dl.sourceforge.net/projec
centos7服務器搭建javaweb運行環境及代碼部署
運行環境 java logs jdk8 star 字符 命名 系列 服務器 之前在一直在學習java web終於寫完了第一個小demo,於是在阿裏雲上買了一個服務器,開始了配置服務器環境的踩坑之旅。。。。 ps:本文不討論服務器配置的具體步驟,網上都很多,按部就班就是,本文
ubuntu下 SVN 服務器搭建及使用
root version use packages ups mar 運行 登錄 file 1.安裝Subversion ServerSubversion server binaries maintained by the Ubuntu Project. Packages i
Linux下GitLab服務器搭建
art 組件 blog tro www 占用 linux下 常用 關閉 系統環境 操作系統:CentOS6.9關閉防火墻 安裝步驟 1. 安裝Postfix 2. 下載rpm包並安裝 3. 配置gitlab,vim /etc/gitlab/gitlab.rb,
Windows下基於http的git服務器搭建-gitstack
amp 自帶 tin hover from 服務器搭建 started col cts 版權聲明:若無來源註明,Techie亮博客文章均為原創。 轉載請以鏈接形式標明本文標題和地址: 本文標題:Windows下基於http的git服務器搭建-gitstack 本文
Linux 下 Samba 服務器搭建
快捷 cat image alt config 回車 虛擬 輸入密碼 哪些 初學,分享 環境和條件--- 虛擬機:VMware虛擬機 系統:Linux ubuntu 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 1