Centos 6.4 is a clustered Yum source server

Source: Internet
Author: User
Tags gpg

The previous article said, in the case of the Internet can not be used to build local Yum source, but when we have a group of servers also can not surf the internet, this time to install things if each server is attached to a CD, then it is disgusting.

Original blog from: www.51niux.com bo: Busy Firewood less

At this time we have two options, one is to build a simple version of the cluster local Yum source, the other is to set up a real with the public network Yum source synchronization local Yum source server. At this time to see our needs, if we are a group of servers is installed in a certain environment, for example, are all built LNMP environment will no longer install other software (like my home company, our company has a public Internet app, One of the big customers want an internal LAN to use the environment for the company's internal office use, they do not have the server Sisu network, if you want to connect to the network will apply a lot of trouble, the environment after the deployment will not install other software. ), then we can consider the simple version of the local Yum source server.

Another situation is that our server cluster is huge, occasionally may want to install some other things, this time we have to consider the big on the public network synchronization with the local Yum source scheme.

Say so much nonsense, we here first combined with previous CD Yum source, do a simple version of the cluster Yum source server.

My system environment or CentOS 6.4 64-bit operating system, is now a brand-new environment ha, let him be able to sisu Internet cafes, why should I join some of my own ideas.

Our Yum source server end-bit 192.168.1.105, the client is 192.168.1.109.

First, the service side operation:

1. Install Nginx as a file in the HTTP Server shared system CD (similar to FTP sharing)

[Email protected] tools]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
[Email protected] tools]# tar zxf pcre-8.35.tar.gz #安装pcre使nginx支持正则
[Email protected] tools]# CD pcre-8.35

[[email protected] pcre-8.35]#./configure-prefix=/usr/local/pcre && make && make install

[Email protected] tools]# wget nginx.org/download/nginx-1.2.9.tar.gz #下载编译安装包

[Email protected] tools]# tar zxf nginx-1.2.9.tar.gz

[Email protected] tools]# CD nginx-1.2.9

[Email protected] nginx-1.2.9]#./configure--prefix=/usr/local/nginx--with-http_stub_status_module--with-pcre=/ tools/pcre-8.35 #如果是搭建web环境就不能这样安装了, the compile time is to add parameters, but we are here to make it a shared function.

[[email protected] nginx-1.2.9]# make && make install

2.2 Creating a Site directory and configuring Nginx files

[Email protected] nginx-1.2.9]# mkdir/data/yum_repo/#创建站点目录

[Email protected]/]# mkdir/data/yum_repo/centos-6 #创建以不同linux版本命令的目录

Note: If you want the Yum server to be a different version of the Linux service, you can create a different version of the directory under the Site directory, and then copy all the files in the disc to the corresponding directory.

[Email protected] yum_repo]# vim/usr/local/nginx/conf/nginx.conf #修改为下面的部分

server {
listen       80;    #默认端口80端口
Server_Name 192.168.1.105;   #网站名称192.168.1.105
Index index.html index.htm index.php;
root /data/yum_repo/;   #自定义站点目录为/data/yum_repo
#error_page 502 =/502.html;
AutoIndex on;    #开启nginx的目录浏览功能
autoindex_exact_size off; #文件大小从kb开始显示
Autoindex_localtime on ; #显示文件的修改时间为服务器的本地时间

Location ~. *\. (PHP|PHP5)? $ {
#fastcgi_pass Unix:/tmp/php-cgi.sock;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Include fastcgi.conf;
}
Location ~. *\. (Gif|jpg|jpeg|png|bmp|swf|mp3) $ {
Expires 30d;
}
Location ~. *\. (JS|CSS)? $ {
Expires 12h;
}
}
Log_format access ' $remote _addr-$remote _user [$time _local] "$request"
' $status $body _bytes_sent ' $http _referer '
' "$http _user_agent" $http _x_forwarded_for ';
Access_log/data/logs/access.log access;

[Email protected] nginx-1.2.9]#/usr/local/nginx/sbin/nginx-t #检测一下是否配置成功

Nginx:the configuration file/usr/local/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/usr/local/nginx/conf/nginx.conf test is successful #这是表示成功的意思.

[Email protected] nginx-1.2.9]#/usr/local/nginx/sbin/nginx #启动nginx服务

Here is the page:



Second, the configuration of the client

2.1 Client-side Yum configuration file modification

[Email protected] ~]# cd/etc/yum.repos.d/#进入客户端的yum配置文件目录
[email protected] yum.repos.d]# CP Centos-base.repo centos-base.repo.bak20150308 #操作前备份

[Email protected] yum.repos.d]# VI Centos-base.repo
[Base]
name=centos-$releasever-base
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=os
Baseurl=http://192.168.1.105/centos-6
Gpgcheck=1
Enable=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

#released Updates
[Updates]
name=centos-$releasever-updates
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=updates
Baseurl=http://192.168.1.105/centos-6
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

#additional packages that could be useful
[Extras]
name=centos-$releasever-extras
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=extras
Baseurl=http://192.168.1.105/centos-6
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

#additional packages that extend functionality of existing packages
[Centosplus]
name=centos-$releasever-plus
mirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=centosplus
#baseurl =http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
Gpgcheck=1
Enabled=0
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

#contrib-packages by Centos Users
[Contrib]
name=centos-$releasever-contrib
mirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=contrib
#baseurl =http://mirror.centos.org/centos/$releasever/contrib/$basearch/
Gpgcheck=1
Enabled=0
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

#基本上就是将mirrorlist注释掉, then change the BaseURL's link address. [Centosplus] [Contrib] do not change, because Enabled=0, indicates that the module is not enabled.

2.2 Testing

[Email protected] yum.repos.d]# Ping 202.106.0.20 #我把网关去掉了现在网上不去了
Connect:network is unreachable
[Email protected] yum.repos.d]# Ping 192.168.1.105 #能ping通内网yum源服务器
PING 192.168.1.105 (192.168.1.105) bytes of data.
Bytes from 192.168.1.105:icmp_seq=1 ttl=64 time=0.805 ms
^c
---192.168.1.105 ping statistics---
1 packets transmitted, 1 received, 0% packet loss, time 556ms
RTT Min/avg/max/mdev = 0.805/0.805/0.805/0.000 ms

We download a time server to try, online posts regardless of success will be successful, the real environment which has so idealized, you see I did not succeed, in fact, these packages are some, but the version of some subtle differences, so unsuccessful.


2.3 Clever use of Yum cache function

[Email protected] yum_repo]# vim/etc/yum.conf

Keepcache=1 #这里变为1, after Yum installs the software, the software will also remain in the directory/var/cache/yum/x86_64

Now we're on 192.168.1.105. Yum downloads the NTP service:

[email protected] packages]# Yum install ntp-y

[Email protected] packages]# cd/var/cache/yum/x86_64/6/updates/packages/
[email protected] packages]# ll #看到没我们yum的关联rpm包找到了
Total 672
-rw-r--r--. 1 root root 607020 Dec 11:01 ntp-4.2.6p5-2.el6.centos.x86_64.rpm
-rw-r--r--. 1 root root 76952 Dec 11:01 ntpdate-4.2.6p5-2.el6.centos.x86_64.rpm

[[email protected] packages]# CP */data/yum_repo/centos-6/packages/#将所有的关联包拷贝到对应的站点目录中去.

Now we go back to the client to continue testing:


The first failure, but we have a little operation on the Yum server, the client also implemented in the case of the Internet can not be installed in the Yum software.

Here are some personal insights:

1. Thought is live, copy copy is not, take this document example, you go online to find the first half should find similar, but this last third part, online should not find, is I from the actual work, think out of a simple small plan. may not be applicable in large-scale cluster scenarios, but in some scenarios it is still possible to start simplifying rapid deployment.

2. Tools are for human use, flexible use can bring us convenience, efficiency.

3. The third sentence is left to own, about the third part of the flexible use, basically make a can machine alone when the Yum source, if the same version of the client is not idle egg pain Update, basically on the Yum server yum and then copy the package to the corresponding site directory on the line. If the server has yum over the package, and the client Yum package version fails, try the Yum remove software name on the server side, then re-yum and then copy the package to the corresponding site directory.

Original blog from: www.51niux.com bo: Busy Firewood less


This article from "Technology in the progress of sharing" blog, declined reprint!

Centos 6.4 is a clustered Yum source server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.