In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Build your own yum warehouse, add your own rpm package to your yum source. The server configuration of yum warehouse is as follows:
1. Create a yum warehouse directory
Mkdir-p / data/yum_data/
Cd / data/yum_data/
# you can upload rpm packages to this directory, and folders can also be included under this directory
two。 Install createrepo softwar
[root@yum yum_data] # yum-y install createrepo 3. Initialize the repodata index file
Createrepo-pdo / data/yum_data/ / data/yum_data/
4. Provide yum services
# you can use Apache or nginx to provide web service, which is suitable for private network environment
Yum Source configuration based on HTTP
Install apache softwar
[root@yum yum_data] # yum install-y httpd
[root@yum yum_data] # / etc/init.d/httpd start
Starting httpd: [OK]
[root@yum yum_data] # netstat-lntup | grep httpd
Tcp 0 0: 80: * LISTEN 6403/httpd
# configure according to your server ip address
[root@yum yum_data] # echo "192.168.30.130 yum.nulige.com" > > / etc/hosts
[root@yum yum_data] # tail-1 / etc/hosts
192.168.30.130 yum.nulige.com
# add hosts parsing to window system
192.168.30.130 yum.nulige.com
# visit the website
Enter: yum.nulige.com in the browser
# modify configuration file / etc/httpd/conf/httpd.conf
Point the default www directory to the locally created yum repository directory
[root@yum yum_data] # cd / etc/httpd/conf
[root@yum conf] # ll
Total dosage 52
-rw-r--r--. 1 root root 34419 July 12 19:00 httpd.conf
-rw-r--r--. 1 root root 13139 July 18 23:24 magic
# backup before operation (operation and maintenance must keep this in mind)
[root@yum conf] # cp httpd.conf httpd.conf.backup.nulige.2016-11-19
[root@yum conf] # ll
Total dosage 88
-rw-r--r--. 1 root root 34419 July 12 19:00 httpd.conf
-rw-r--r--. 1 root root 34419 November 19 18:02 httpd.conf.backup.nulige.2016-11-19
-rw-r--r--. 1 root root 13139 July 18 23:24 magic
[root@yum conf] # vi httpd.conf
DocumentRoot "/ data/yum_data/" # search / DocumentRoot method
# 317 lines
# modify the owner and group of the / usr/local/yumrepo directory to apache
[root@yum conf] # chown-R apache.apache / data/yum_data/
[root@yum conf] # ll-l / data/yum_data/
Total dosage 12
Drwxr-xr-x. 3 apache apache 4096 November 19 16:49 centos
Drwxr-xr-x. 3 apache apache 4096 November 19 16:50 epel
Drwxr-xr-x. 2 apache apache 4096 November 19 17:50 repodata
# delete the default home page
[root@yum conf] # pwd
/ etc/httpd/conf
[root@yum conf] # cd..
[root@yum httpd] # ll
Total dosage 8
Drwxr-xr-x. 2 root root 4096 November 19 18:07 conf
Drwxr-xr-x. 2 root root 4096 November 19 17:50 conf.d
Lrwxrwxrwx. 1 root root 19 November 19 17:50 logs->.. /.. / var/log/httpd
Lrwxrwxrwx. 1 root root 29 November 19 17:50 modules->.. /.. / usr/lib64/httpd/modules
Lrwxrwxrwx. 1 root root 19 November 19 17:50 run->.. /.. / var/run/httpd
# move the configuration to the tmp directory and use less rm commands.
[root@yum httpd] # mv conf.d/welcome.conf / tmp
Restart the service:
# service httpd restart
Or
[root@yum httpd] # / etc/init.d/httpd restart
Stop httpd: [OK]
Starting httpd: [OK]
# in the windows system, enter yum.nulige.com through the browser to access
5. Add a new rpm package
# download software only but not install it
Yumdownloader pcre-devel openssl-devel
# do not delete the installation package when keeping the yum installation software
[root@node5 yum_data] # sed-I "s#keepcache=0#keepcache=1#g" / etc/yum.conf
[root@node5 yum_data] # grep keepcache / etc/yum.conf
Keepcache=1
# installation package storage directory
Cachedir=/var/cache/yum/$basearch/$releasever
Ll / var/cache/yum/x86_64/6/base/packages
# move the reserved rpm package to the yum server directory
[root@yum x86_64] # cd / var/cache/yum/x86_64/6/base/packages
[root@yum packages] # mv * / data/yum_data/centos/6/os/x86_64
[root@yum x86_64] # ll
The total dosage is 8120
-rw-r--r--. 1 root root 15824 July 6 2011 apr-util-ldap-1.3.9-3.el6_0.1.x86_64.rpm
-rw-r--r--. 1 root root 98392 May 12 2016 createrepo-0.9.9-24.el6.noarch.rpm
-rw-r--r--. 1 root root 72520 July 3 2011 deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
-rw-r--r--. 1 root root 15936 July 3 2011 dos2unix-3.1-37.el6.x86_64.rpm
-rw-r--r--. 1 root root 4830620 March 24 2016 git-1.7.1-4.el6_7.1.x86_64.rpm
-rw-r--r--. 1 root root 72436 July 3 2011 lrzsz-0.12.20-27.1.el6.x86_64.rpm
-rw-r--r--. 1 root root 2884068 June 10 2014 nmap-5.51-4.el6.x86_64.rpm
-rw-r--r--. 1 root root 27748 July 3 2011 python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
-rw-r--r--. 1 root root 239316 May 12 2016 sysstat-9.0.4-31.el6.x86_64.rpm
-rw-r--r--. 1 root root 36884 January 14 2015 tree-1.5.3-3.el6.x86_64.rpm
# update every time you add a rpm package
Createrepo-update / data/yum_data/
Configure client configuration
# centos6.X system yum source configuration
Cd / etc/yum.repos.d
[root@B yum.repos.d] # vi localyum.repo [localyum] name=centos6baseurl= http://yum.nulige.com/centos/6/os/x86_64/enable=1gpgcheck=0[localepel]name=epelbaseurl=http://yum.nulige.com/epel/6/x86_64/enable=1gpgcheck=0[localextra]name=extrabaseurl=http://yum.nulige.com/centos/6/extras/x86_64/enable=1gpgcheck=0
Note: pay attention to change to your own domain name address
Yum Source configuration method for centos7 system
[root@B yum.repos.d] # vi localyum.repo [localyum] name=centos7baseurl= http://yum.nulige.com/centos/7/os/x86_64/enable=1gpgcheck=0[localepel]name=epelbaseurl=http://yum.nulige.com/epel/7/x86_64/enable=1gpgcheck=0[localextra]name=extrabaseurl=http://yum.nulige.com/centos/7/extras/x86_64/enable=1gpgcheck=0
# specify the use of the localyum library, and temporarily use the private network yum source, which will expire after the server restarts.
[root@YUM] # yum-- enablerepo=localyum-- disablerepo=base,extras,updates,epel list
# permanent use requires modifying the configuration file to close the default repo file
Cd / etc/yum.repos.d/
Vi CentOS-Base.repo# is enabled at each startup source with the addition of # enabled=0 # to 1, and is enabled without this parameter. [base]. Enabled=0 [updates]. Enabled=0 [extras]. Enabled=0
Note: there are other open warehouses that use this method to close.
Or
Use the following method to move all the repo ending files under / etc/yum.repos.d/ to other directories.
1 mkdir-p / home/nulige/yum_backup 2 3 cd / etc/yum.repos.d 4 5 mv * / home/nulige/yum_backup synchronous Mirror Public Network Image YumSource configuration method
But there is also a kind of enterprise demand, to be more specific, usually everyone downloads yum installation software from the public network and takes up bandwidth, so set up an intranet yum server in the company, but also take into account that if the database file repodata of yum software is different, there will be a problem. So the solution I can think of is to directly use the repodata of the public network yum source. Mirror synchronization public network yum source
The upstream yum source must support the rsync protocol, otherwise rsync cannot be used for synchronization.
Http://mirrors.ustc.edu.cn/status/
Official standard source of CentOS: rsync://mirrors.ustc.edu.cn/centos/
Epel source: rsync://mirrors.ustc.edu.cn/epel/
Synchronization command:
# use rsync to synchronize yum sources. In order to save bandwidth, disk and download time, I only synchronized CentOS6 rpm packages, so that all rpm packages take up only 21G, and all synchronization takes about 300G.
# synchronize base feeds, tips. The CD image of our installation system contains some rpm packages, about 3G, so you don't have to download them again.
# create four directories to synchronize public network yum sources
Mkdir-p / data/yum_data/centos/6/os/x86_64/
Mkdir-p / data/yum_data/centos/6/extras/x86_64/
Mkdir-p / data/yum_data/centos/6/updates/x86_64/
Mkdir-p / data/yum_data/epel/6/x86_64/
# if the following four commands are copied and executed at the same time, you will start to synchronize the yum source to the local official website.
/ usr/bin/rsync-av rsync://mirrors.ustc.edu.cn/centos/6/os/x86_64/ / data/yum_data/centos/6/os/x86_64/ / usr/bin/rsync-av rsync://mirrors.ustc.edu.cn/centos/6/extras/x86_64/ / data/yum_data/centos/6/extras/x86_64/ / usr/bin/rsync-av rsync://mirrors.ustc.edu.cn/centos/ 6/updates/x86_64/ / data/yum_data/centos/6/updates/x86_64/ / usr/bin/rsync-av-- exclude=debug rsync://mirrors.ustc.edu.cn/epel/6/x86_64/ / data/yum_data/epel/6/x86_64/
# View the size of the yum source after synchronization:
[root@yum yum_data] # cd. [root@yum data] # du-sh yum_data12G yum_ data [root @ yum data] # [root@yum data] # tree-L 3 yum_data/yum_data/ |-- centos | `--6 | |-- extras | |-- os |`-- updates |-- epel | `--x8664`-- repodata |-- 401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93-filelists.xml.gz |- -6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670-other.xml.gz |-77a287c136f4ff47df506229b9ba67d57273aa525f06ddf41a3fef39908d61a7-other.sqlite.bz2 |-- 8596812757300b1d87f2682aff7d323fdeb5dd8ee28c11009e5980cb5cd4be14-primary.sqlite.bz2 |-- dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9-primary.xml.gz |-- f8606d9f21d61a8bf405af7144e16f6d7cb1202becb78ba5fea7d0f1cd06a0b2-filelists.sqlite.bz2 `--repomd.xml9 directories 7 files
Fault handling:
Error:
ERROR: max connections (20) reached-- try again later
Rsync error: error starting client-server protocol (code 5) at main.c (1503) [receiver=3.0.6]
Solution:
The yum source server exceeds the maximum number of connections. Please try again later. (try a few more times and you will succeed.)
Error:
# rsync: getaddrinfo: mirrors.ustc.edu.cn 873: Name or service not known
Solution:
DNS cannot be parsed, add mobile DNS
[root@node5 ~] # echo "nameserver 120.196.165.7" > > / etc/resolv.conf
[root@node5 ~] # cat / etc/resolv.conf
Nameserver 120.196.165.7
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 244
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.