Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5088848
  • 博文数量: 1609
  • 博客积分: 18684
  • 博客等级: 上将
  • 技术积分: 14930
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-02 10:28
文章分类

全部博文(1609)

文章存档

2020年(26)

2019年(27)

2018年(44)

2017年(50)

2016年(47)

2015年(15)

2014年(21)

2013年(43)

2012年(143)

2011年(229)

2010年(263)

2009年(384)

2008年(246)

2007年(30)

2006年(38)

2005年(2)

2004年(1)

分类: 系统运维

2013-10-16 10:59:54

cd /usr/src/redhat/SOURCES
wget http://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz
cd /usr/src/redhat/SRPMS


{err:http://www.osterman.com/wordpress/2011/04/27/porting-fedora-rpm-spec-file-centos-error-find-invalid-predicate}


vi hello-2.1.1.spec


BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Summary: GNU Hello
Name: hello
Version: 2.1.1
Release: 1
Source: http://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz
URL: http://www.gnu.org/software/hello/hello.html
License: GPL
Group: System Environment/Libraries
%description
This project is an example that demonstrates GNU coding standards.
%prep
%setup
%build
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix}
make
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AUTHORS BUGS ChangeLog COPYING INSTALL NEWS README THANKS TODO
%{_prefix}/bin/hello
%{_prefix}/info/dir
%{_prefix}/info/hello.info.gz
%{_prefix}/man/man1/*
%{_prefix}/share/locale/*/LC_MESSAGES/hello.mo
%changelog
* Wed Dec 23 2009 ykyuen
- First draft of the spec file




生成rpm
rpmbuild -ba hello-2.1.1.spec




接下来,把上面的变成akin-2.1.1.tar.gz的包!
很简单,略过......




[root@mongodb ~]# cd /my_repo/
[root@mongodb my_repo]# ls
noarch  x86_64
[root@mongodb my_repo]# find /my_repo/ -type f
/my_repo/x86_64/akin-debuginfo-2.1.1-1.x86_64.rpm
/my_repo/x86_64/akin-2.1.1-1.x86_64.rpm


接下来生成repo文件
yum install createrepo -y


[root@mongodb my_repo]# createrepo /my_repo/
2/2 - x86_64/akin-2.1.1-1.x86_64.rpm                                            
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@mongodb my_repo]# ls
noarch  repodata  x86_64




vi /etc/httpd/conf/httpd.conf
....
Alias /my_repo/ "/my_repo/" 
 
Options Indexes MultiViews         
AllowOverride None  
Order allow,deny  
Allow from all  
 




/etc/init.d/httpd restart


url:http://192.168.14.117/my_repo




认证:
cd /my_repo/repodata
# gpg -q --gen-key
gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.


gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
Please select what kind of key you want:
   (1) DSA and Elgamal (default)
   (2) DSA (sign only)
   (5) RSA (sign only)
Your selection? 1
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 1024
Requested keysize is 1024 bits
Please specify how long the key should be valid.
         0 = key does not expire
       = key expires in n days
      w = key expires in n weeks
      m = key expires in n months
      y = key expires in n years
Key is valid for? (0) 0
Key does not expire at all
Is this correct? (y/N) y


You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) "


Real name: Akin Yum Repo
Email address: h3ewhack@163.com
Comment: Create Yum Repo
You selected this USER-ID:
    "Akin Yum Repo (Create Yum Repo) "


Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.


We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
++++++++++.++++++++++++++++++++.+++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...+++++++++++++++++++++++++>+++++..................................................................+++++


Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 271 more bytes)


We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++++++++++++++++++++++.+++++++++++++++..++++++++++.+++++++++++++++.+++++++++++++++++++++++++...++++++++++++++++++++++++++++++.++++++++++>+++++...............................................................+++++^^^^^^^^^^^
gpg: key E418FA2E marked as ultimately trusted
public and secret key created and signed.


gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   1024D/E418FA2E 2012-12-16
      Key fingerprint = 5F5E 7624 ACA9 CBA8 B709  BEDC FCF9 CC26 E418 FA2E
uid                  Akin Yum Repo (Create Yum Repo)
sub   1024g/5A86ADBE 2012-12-16










[root@mongodb repodata]# gpg --list-key
/root/.gnupg/pubring.gpg
------------------------
pub   1024D/E418FA2E 2012-12-16
uid                  Akin Yum Repo (Create Yum Repo)
sub   1024g/5A86ADBE 2012-12-16


[root@mongodb repodata]# gpg -a --detach-sign repomd.xml 


You need a passphrase to unlock the secret key for
user: "Akin Yum Repo (Create Yum Repo) "
1024-bit DSA key, ID E418FA2E, created 2012-12-16


[root@mongodb repodata]# ls -al
total 28
drwxr-xr-x 2 root root 4096 Dec 17 06:52 .
drwxr-xr-x 5 root root 4096 Dec 17 06:38 ..
-rw-r--r-- 1 root root  622 Dec 17 06:38 filelists.xml.gz
-rw-r--r-- 1 root root  364 Dec 17 06:38 other.xml.gz
-rw-r--r-- 1 root root  975 Dec 17 06:38 primary.xml.gz
-rw-r--r-- 1 root root  951 Dec 17 06:38 repomd.xml
-rw-r--r-- 1 root root  189 Dec 17 06:52 repomd.xml.asc
[root@mongodb repodata]# gpg -a --export "Akin Yum Repo" >repomd.xml.key
[root@mongodb repodata]# ls
filelists.xml.gz  primary.xml.gz  repomd.xml.asc
other.xml.gz      repomd.xml      repomd.xml.key




YUM升级repo
[root@mongodb yum.repos.d]# cat akin.repo 
[Akin]
name=Akin Yum Repo for Enterprise Linux 5 - $basearch
baseurl=http://192.168.14.117/my_repo
enabled=1
gpgcheck=0
gpgkey=http://192.168.14.117/my_repo/repodata/repomd.xml.key






[root@mongodb yum.repos.d]# yum install akin
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * epel: mirrors.sohu.com
 * extras: mirror.bit.edu.cn
 * rpmforge: ftp.riken.jp
 * updates: mirror.bit.edu.cn
Akin                                                                    |  951 B     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package akin.x86_64 0:2.1.1-1 set to be updated
--> Finished Dependency Resolution


Dependencies Resolved


===============================================================================================
 Package             Arch                  Version                   Repository           Size
===============================================================================================
Installing:
 akin                x86_64                2.1.1-1                   Akin                 62 k


Transaction Summary
===============================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)


Total size: 62 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : akin                                                                    1/1 


Installed:
  akin.x86_64 0:2.1.1-1                                                                        


Complete!


[root@mongodb yum.repos.d]# hello 
Hello, world!






刚添加的文件,不能随便查找到,可以个修改/etc/yum.conf
metadata_expire=600 #秒,默认1小时

阅读(1579) | 评论(0) | 转发(0) |
0

上一篇:大公司的一些中间件

下一篇:openstack hacker

给主人留下些什么吧!~~