Tutorial topology:
---------------------------------------------------------
| Server IP: 192.168.1.100 | <------- bridge --------> | Client IP: 192.168.1.101 |
---------------------------------------------------------
Ideas:
1. [server] confirm httpd Installation
12 |
rpm -q httpd httpd-2.2.15-29.el6.centos.i686 |
If not, install
2.[Server]Copy the package file to the webpage file directory
1 |
cp /media/cdrom/Packages/ * /var/www/html/Packages/ |
Here, I have created a packages file under the webpage file directory to store RPM package files.
It was copied from the CD image.
3.[Server]Create the repository file createrepo/path
1 |
createrepo /var/www/html/Packages/ # Create the source data file of the package file in this file |
In this way, the RMP package server is ready. Now we can download and test it.
4. [client] modify the yum configuration file
Open another virtual machine. Of course, the two machines must first be connected to the Internet.
12345 |
ping 192.168.1.100 PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data. 64 bytes from 192.168.1.100: icmp_seq=1 ttl=64 time =2.57 ms 64 bytes from 192.168.1.100: icmp_seq=2 ttl=64 time =0.396 ms 64 bytes from 192.168.1.100: icmp_seq=3 ttl=64 time =0.400 ms |
Yum repo configuration file path:
Specify the available Yum repository/etc/yum. conf,/etc/yum. Repo. d/*. Repo
Configuration File Format: consists of two segments, similar to the Windows ini configuration file
[Main]: Main configuration segment
[Repo]: Repository configuration section
Structure of the yum repo configuration file:
1234567 |
[reop_ID] # Note that the repo_id must not be the same as the ID in other configuration files. name=String # Repository name baseurl=http: //server/path/to/repo # Repository access path. For more information, see server access method: enabled={1|0} # Whether to enable this repository, which is enabled by default gpgcheck={1|0} # Check the package source validity and integrity gpgkey= # When GPG detects the public key file path, it can be local or on the server. cost= # Define the overhead of this repository. The default value is 1000. The smaller the value, the higher the priority. |
OK! Ping, start configuring the client's yum repo configuration file, set each repository in the CentOS-Base.repo to Enabled = 0, so that we do not use the default repository, if there is no enabled project under [base], we can manually add enabled = 0.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
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 mirrorlist=http: //mirrorlist .centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey= file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 enabled=0 # Note that this parameter is set to 0. #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http: //mirrorlist .centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey= file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 enabled=0 # Note that this parameter is set to 0. #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=http: //mirrorlist .centos.org/?release=$releasever&arch=$basearch&repo=extras #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey= file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 enabled=0 # Note that this parameter is set to 0. #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 # Note that this parameter is set to 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 # Note that this parameter is set to 0. gpgkey= :wq # Released after saving vim /etc/yum .repos.d /Httpd-test-Base .repo # Configure a repo configuration file as follows: [httpd-192.168.1.100] name= test enabled=1 baseurl=http: //192 .168.1.100 /Packages/ gpgcheck=0 :wq # Save and exit yum repolist # Let's take a look at the repo list of yum. If the output result is similar to the following, you can set a repo. Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile repo id repo name status httpd-192.168.1.100 test 2,695 repolist: 2,695 |
5. [client] installation and testing
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
yum install httpd Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package httpd.i686 0:2.2.15-29.el6.centos will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================== Package Arch Version Repository ==================================================================== Installing: httpd i686 2.2.15-29.el6.centos httpd-192.1 Transaction Summary ==================================================================== Install 1 Package(s) Total download size: 828 k Installed size: 2.8 M Is this ok [y /N ]: ^CExiting on user Command [[email protected] yum.repos.d] # yum install httpd Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package httpd.i686 0:2.2.15-29.el6.centos will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================== Package Arch Version Repository Size ==================================================================== Installing: httpd i686 2.2.15-29.el6.centos httpd-192.168.1.100 828 k Transaction Summary ==================================================================== Install 1 Package(s) Total download size: 828 k Installed size: 2.8 M Is this ok [y /N ]: y Downloading Packages: httpd-2.2.15-29.el6.centos.i686.rpm | 828 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered outside of yum. Installing : httpd-2.2.15-29.el6.centos.i686 1 /1 Verifying : httpd-2.2.15-29.el6.centos.i686 1 /1 Installed: httpd.i686 0:2.2.15-29.el6.centos Complete! |
It's hard
Httpd self-built Yum installation Source