How to rebuild rpm for centos4 / el4

in order to rebuild rpm package for centos4 or RHEL4 equivalent..

Step :
1. create the directory structure as required for building rpm.

You may already have one in /usr/src/RPM, but as rebuilding package as root is evil, we recommend that you create one to a place where your normal user account allows you to write, such as your home directory. This build tree should have the following structure:

rpm
|-- BUILD
|-- RPMS
|   |-- i386
|   |-- i586
|   `-- noarch
|-- SOURCES
|-- SPECS
|-- SRPMS
`-- tmp

2. create simple rpm-macro ..for a normal user.

because compiling using root is devil. hahahaha.

Now you need to do some rpm configuration. A simple ~/.rpmmacros with the following contents should be enough:

%_topdir        %(echo ${HOME}/rpm)
%_tmppath       %{_topdir}/tmp

%packager       Firstname Lastname <[email protected]>
%distribution JPackage
%vendor JPackage Project

# Uncomment to have built RPMs land in RPMS/ instead of RPMS/<arch>/
#%_rpmfilename  %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm

# Uncomment for signing your packages with GPG
#%_gpg_name FirstName LastName <email address>
#%_gpg_path /path/to/keys

Of course, substitute your own name to the above. Note that all macros are only default values for tags not explicitly filled in spec files.

3.get the source tgz or rpm.

4. rpmbuild -ba source-<version>-.tgz

or..

rpm -i source-<version>.rpm

this one will create the spec into SPECS folder.

else…

Normal command for rebuilding a standard source package (.src.rpm) is:
rpmbuild --rebuild foo-x.y.z-wjpp.src.rpm If you are using an older (pre-4.0.2?) version of rpm, substitute rpmbuild with rpm in the command. Note that rpmbuild is usually part of the rpm-build package.

Further, packages from non-free section are actually .nosrc.rpm, meaning that they don’t contain all sources due to legal issues (prohibited redistribution). So, you’ll have to proceed in several steps here.

  1. Install the source package:
    rpm -i foo-x.y.z-wjpp.nosrc.rpm
  2. Get the missing sources from their original location. File names and base URLs can be found in the spec file, installed into rpm/SPECS/foo.spec by the above command.
  3. Put the sources you’ve downloaded to rpm/SOURCES.
  4. Build package from spec file:
    rpmbuild -ba rpm/SPECS/foo.spec
    (again, substituting rpmbuild with rpm if necessary)

Unless something fails in the process, you should obtain the source package in rpm/SRPMS and binary package in relevant subdirectory of rpm/RPMS.

5. rebuild for SPECS.

rpmbuild -ba SPECS/source-<version>.spec

6. create a repos directory folder which will hold all the file that you want to publish.

let say /home/user/repos

copy all the necessary rpms and SRPMS into this folder..

if want to divide by the architecture also can.

so that we will have something like /home/user/repos/i386/

will all the RPMs and SRPMs.

7. now create all necessary file to make it as a valid yum/repos

cd /home/user/repos/i386

yum-arch .

createrepo .

Basically is done.

8. publish it into your ftp folder.

cd /home/user/repos/i386

ftp -i hostname.net

cd public_html/repository/i386

mkdir repodata

mkdir headers

mput *.rpm

cd headerslcd headers

mput *

lcd ../repodata

cd ../repodata

mput *

9.now create some repos conf.

[namran-CentOS-Misc]
name=CentOS.namran-EL$releasever - Stable
gpgcheck=0
enabled=1
baseurl=http://my.namran.net/repository/centos$releasever/misc/$basearch/

http://my.namran.net/repository/namran-CentOs-misc.repo

10 . so that the end user

can just ..

cd /e tc/y um.repos.d/

“wget” http://my. namran.net/repository/namran-CentOs-misc.repo

References :

1. jpackage.org

2. openvpn.org

Related Post

6 Responses

  1. Stotti says:

    Hi namran, you should not use MD5 hashing as “encryption” for passwords. Why? I wrote in my blog how easy it is to crack MD5 passwords using local software (see http://www.stottmeister.com/blog/2009/06/29/how-to-crack-md5-passwords-with-john-the-ripper-a-live-example-exploiting-typo3/ ) and using online services (see http://www.stottmeister.com/blog/2009/04/14/how-to-crack-md5-passwords/ ). These articles tell you how to crack MD5 hashes quite easily (for educational purposes only). So please don’t use MD5 as password “encryption”.

    Even SHA-1 is considered unsafe nowadays. Better use a new hashing mechanism such as SHA-256 or something similiar.

    Best regards
    Stotti

    Reply
    • namran says:

      Hi Stotti,

      Thanks for your comment.

      apparently to change that to use SHA-256 ..
      just need to change the line ..
      md5()
      to use sha256 by …
      sha256()

      and have to make sure the password field length in SQL table is long enough to store the hash..
      .. and you’ll be not able to add new user via phpMyAdmin interface as no built in sha256 interface there and have to calculate your password yourself..

      correct ?

      Reply
  2. Brian says:

    Be sure to salt your hashes if you do use the MD5 algorithm. Simple reverse lookup attacks could crack your hashes otherwise. There are sites such as http://ww.netmd5crack.com and http://gdataonline.com that specialize in this sort of attack.

    Brian

    Reply
  3. Alessandro says:

    Hash cracker is a web-service that allows you to encrypt your passwords
    or crack your hashed passwords with MD5, SHA1 or NTLM algorithms.
    You can also encode or decode texts with Base64 system.

    http://www.hash-cracker.com

    Video tutorial:

    http://www.youtube.com/watch?v=JVxdQPdGXec

    Reply
  4. sterewete says:

    Mueller Sports Medicine Turnover http://www.mishymashy.com/ – effexor sale The medication usually needs to be tapered slowly to avoid the withdrawal symptoms that can be very uncomfortable. cheapest effexor

    Reply
  5. Janett Dopazo says:

    Sweet blog! I found it while surfing around on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Many thanks

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *