Solved

Rpms & Source Files

Posted on 2002-06-27
23
690 Views
Last Modified: 2013-11-13
What is the difference between rpms & source files?

The reason I ask is because I'm after the latest version of php. When I first installed php on my machine, I installed it using an rpm on the mandrake cd, but now, I've been told I need the source files for php and I need to compile it.

So, what is the difference between an rpm installation, and compiling from source files?

Thanks
0
Comment
Question by:tsuk
  • 10
  • 6
  • 4
  • +3
23 Comments
 
LVL 20

Expert Comment

by:Gns
ID: 7114228
RPMs are (RedHat:-) packages containing runnable binaries and configuration files (usually. There also exist source RPMs, just to confuse the enemy;-).

"Source" ... is the (human readable) program code, that you can compile (with a program called a compiler) into runnable binaries. One could say: The program code is the Source of the binary.

The difference to an end user is *huge*. RPM files are, more or less, easy to install and upgrade, while compiling and installing from source are somewhat more difficult to do.

Sourcecode most often come in a tape archive file (a tar file) that has been compressed (with gzip or bzip), so the first task will be to unpack the archive. Then you'll be able to read the INSTALL/README instructions, if any.
To convert the source into binaries, you'll need to have the pertinent application development environment installed, that is: the compiler (gcc), the linker (ld), an assembler (gas) etc etc.

If your Mandrake install is fairly recent (8.2), you should be able to find/upgrade php to the latest&greatest stable version with Software Manager (rpmdrake). Hm, nope 4.2.1 isn't there it seems, so you'll either have to build from source, or live with 4.1.2. What specifically is it you're after?

'Nuff said.
-- Glenn
0
 
LVL 20

Expert Comment

by:Gns
ID: 7114298
Oh, and to better answer the question, with rpms, you type:
rpm -ivh <package filename><Enter>
at a prompt (logged on as root) to install, or
rpm -Uvh <package filename><Enter>
to upgrade.

With source, you typically do (assuming gziped tar-file):
tar xvzf <tarball-name><Enter>
cd <the directory the tarball unpacked to><Enter>
less -e README INSTALL<Enter> (To see if there are some options etc that you need set, or some file you need to modify)
Most often the source is very portable between platforms, and use automake, so you should be able to do something like:
./configure <any option you deem necessary><Enter>
make<Enter>
make install<Enter>

Please note that the RPM system can get confused if you both have the "package" installed via rpm, and built/installed from source, since the "make install" will install without "telling" rpm (either overwriting the existing files, or installing to a different location (and bringing chaos to which binary will be invoked (well, not chaos, but ... The PATH will need to be modified so that the correct file gets invoked))).

See? Do you really need to build from source?

I've kept this rather general, since I still haven't had the need to actually build php from source (well, once, but that was some years ago), and the question, although specific, actually has a general ramification (sort of;).

-- Glenn
0
 
LVL 40

Expert Comment

by:jlevie
ID: 7114594
To elaborate a bit on one of Glenn's points...

Whenever possible you want to remove an existing rpm before building that package from source. In the case of PHP that's not much of a problem as I doubt that anything else depends on it. There are some things, like BerkeleyDB, OpenSSH, OpenLDAP, that have lots of dependancies with other parts of the system, so you can't just remove the package without breaking lots of other things. In those cases you have to build your copy targeted for someplace other than where the system copy is and possibly modify PATH's and LD_LIBRARY_PATH env vars. It can get to be a mess in a hurry.

The build process for PHP isn't too bad. The INSTALL docs can be a bit daunting, but it isn't difficult if you know what you need in terms of capabilities. As an example, I always build my Apache, PHP, Postgres, etc components of a web server from source. That give me more freedom in what options are enabled/disabled and the ability to use the latest sources. If you'd like to see my build process take a look at http://www.entrophy-free.net/web-server.html
0
 
LVL 20

Expert Comment

by:Gns
ID: 7115803
Good summary Jim!

I might suffer from preconceived impressions, but I deemed it better for tsuk to re-evaluate his need for the "latest and greatest", at least if there are no compelling reasons. If all tsuk needs is what you mention in your excellent summary Jim, he should be "fine enough" with what Mandrake 8.2 provides. At least until he has some basic understanding of the risks and possible pitfalls... and perhaps some basic programming skills... Nah, that’s not really necessary. Although... Jim, do you have a guess on how many "nonprogrammer admins" actually build stuff from source? I'd guess a dwindling minority.

The guidelines Jim has given you tsuk are for RedHat, but should work without modification for Mandrake (The apple don't fall that far from the apple tree;).

One compelling reason to build from source is security. To be able to "plug that hole" moments after the latest security related patch is released is often mentioned as a strong reason for building from source. However emergency patching is (unfortunately) seldom feasible, due to ... management related issues ("Now!? We can't have downtime _NOW_!!!"). The call to make, source build or RPM install, is nonobvious, with the divide usually at the firewall: If it's a public (internet) service, go with sources. If it's in a protected/controlled environment, you can probably wait a couple of days for the RPM update.

Jim mentions the ability to choose/fine-tune functions/parameters that are only possible to influence at buildtime, so I won't go into that (since I concur with Jim:-).

With PHP, the main reason to build from source would be to incorporate a "commercial feature", usually a database. If you need Oracle support, you have little choice but to build from source.

That rather sums it up. A lot of words for such a tiny question;-).

-- Glenn
0
 

Expert Comment

by:choccarlm
ID: 7115969
If I get the lastest php rpm, will I have to first remove the old rpm, and then install the new rpm?

I'm having a lot of trouble with the new rpm, as when I try to install it, it keeps saying that it needs a load of other things like *****.so3 or something like that. I dont know what to do.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 7117116
choccarlm,

If you do the upgrade with 'rpm -F' it's not necessary to first remove the existing rpm. The '-F' option tells rpm to upgrade an existing package.

If you are getting dependancy problems, you'll either have to upgrade those packages or build from source. Upgrading of the packages that php is dependant on can trun into a mess, depending on what packages are involved. We could provide better guidance if we could see what the errors are.

Your problem isn't really a part of this question and probably ought to taken up in another question.

Gns,

One advantage to building from source that I didn't mention is the ability to set up and configure a web server on an isolated "lab" machine. I do that all the time with my production servers because, as you mention it's hard to take them down for any period of time. For those servers that simply can't see any significant amount of down time I maintain a disk image of the server that I can plug into a lab box (it has removable disk drives). I build/configure/test the web server and its related apps, all targeted to /opt as shown in my web page. When I'm ready to place it into production I simply tar up what's new in /opt on the lab box, shut down the web server, db's etc, rename the exiting directories to have a back door and untar the new stuff onto the production server. Fire up the services and off we go. The total down time is usually on the order of a few minutes if rebuilding of a DB isn't required. If there're aren't any surprises from the new stuff I'll remove the old (renamed) packages.
0
 
LVL 20

Expert Comment

by:Gns
ID: 7121293
choccarlm: No, you can usually do "rpm -Uvh <name of new rpm>", so you shouldn't need to uninstall (the -U flag stands for "upgrade or install", while the -F flag stands for Freshen, that is "upgrade if this already is installed, else complain").

I'd guess that you have some dependencies on the php package that will be broken by the upgrade. Check what depends on php with the command "rpm -q --whatrequires php", and then download the latest version of those packages. Finish off by upgrading all the packages at once, "rpm -Uvh php....rpm whatever.rpm whateveragain.rpm ...", to let rpm resolve the dependencies.
What Jim alludes to is that some packages/dependencies simply can't be resolved this way.

Or you might have gotten hold of a package that simply isn't for your "setup"/distribution, the most common being a RPM built against a more recent libc, in which case rpm will say that new package needs this'n'that version of this'n'that. Trying to resolve that dependency chain will either lead to a complete system upgrade(:-), a large dose of frustrated hair pulling, bad language or all of the above.

Whatever you do, don't use the --force, Luke, it'll lead you to the dark power of the source (sorry, couldn’t help myself:-).
Seriously though, never --force an upgrade/freshen. It would lead to untold trouble.

Jim, what you describe is pretty much how I maintain my servers. Good to see I'm not alone:-). If you have some spare Mib on the production server, here's a tip to even more ... erhm, less downtime:
Maintain two partitions for /opt one mounted on /opt, the other mounted somewhere else (/next_opt ;).
When you want to change the services, do the untaring to /next_opt, unmount that, shutdown servers, unmount /opt,edit fstab (or have an already edited fstab ready to "plop" into place), mount the device for /next_opt on /opt, fire up the servers, and finally remount the "original" /opt on /next_opt. If it's tiny webservers residing in /opt it probably isn't worth the effort, but if it's something more substantial (say Oracle:), this can have a very real time factor.

-- Glenn
0
 

Author Comment

by:tsuk
ID: 7124116
Right, Im trying to install the latest php rpm, and I used the command

rpm -Uvh php-4.2.1-7mdk.i586.rpm

It then came back with the following errors.

error: failed dependencies:
        php-common = 4.2.1-7mdk is needed by php-4.2.1-7mdk
        libopenssl0 is needed by php-4.2.1-7mdk
        libphp_common-4.2.0.so.0   is needed by php-4.2.1-7mdk

What do I do now?

Thanks
0
 
LVL 20

Expert Comment

by:Gns
ID: 7124127
Reread my last comment. The second paragraph.

-- Glenn
0
 

Author Comment

by:tsuk
ID: 7124135
But how would I know what requires php? I unistalled the previous version, and there wasnt any dependency problems with that.
0
 

Author Comment

by:tsuk
ID: 7124149
I found the libopenssl0 rpm, and I tried to install it, but it then resulted in another error, with a load more failed dependencies. This happens everytime, and I dont think it should be happening.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:tsuk
ID: 7124228
I've installed both Apache and Php from source, and I didnt get any errors, however when I try and start apache, I get the following error:

/www/bin/apachectl restart: httpd not running, trying to start
Syntax error on line 230 of /www/conf/httpd.conf:
Cannot load /www/libexec/libphp4.so into server: /www/libexec/libphp4.so: undefined symbol: core_globals
/www/bin/apachectl restart: httpd could not be started


Does anyone know what I need to do?

Cheers
0
 
LVL 20

Expert Comment

by:Gns
ID: 7124241
Do the following to check that you really did uninstall all the parts of php (php-common etc):
rpm -qa | egrep -i php<Enter>

I'd guess that you either have some ...cruft... leftover from the previous (RPM) install, or that you did something wrong in the build process.

Did you uninstall apache too, before installing from source?

-- Glenn
0
 

Author Comment

by:tsuk
ID: 7124246
Nothing showed up from the command you told me to run.

I first installed a version of apache that I didnt want to, so I then installed another version, and then installed php afterwards.

Is there anyway I can completely remove the newly installed Apache and Php, and then start again?

Cheers
0
 
LVL 20

Expert Comment

by:Gns
ID: 7124264
Erhm, yes, there is... It's called "rm"...

You'll have to check _where_ the respective installs place binaries, configfiles etc (make -n install will print all that will be done to screen without actually doing anything).

Depending on the choices you've made, you might be lucky and only have to "rm -r" a couple of "root" directories (root here doesn't pertain to "/", but to the "root of the install". If you have followed Jims advice, that would be /opt/apache, or somesuch).

See, this is one of the reasons for prebuilt binaries and package systems like RPM. In a perfect world, that would be all you needed, but... well, it's not a perfect world, now is it?

-- Glenn
0
 

Author Comment

by:tsuk
ID: 7124285
I removed apache and php, and installed again, but I'm still getting the same error.
0
 
LVL 20

Accepted Solution

by:
Gns earned 25 total points
ID: 7124379
You'll have to reexamine all the configuration options, possibly tweak them a bit, and rebuild.

If possible, try to adhere to Jims cookbook example above. I think that should get you past the worst rough patches.

Or you might make another stab at installing from RPM. I just checked on a Mandrake 8.1, and it isn't _that_ many packages that depend on openssl. openssl has some requirements though.
You can check what immediate package requirements a downloaded file (and indirect library dependencies) with:
rpm -qp --requires <RPM package filename>

The indirect dependecies (php depends on libcrypt) can be resolved "by hand":
locate libcrypt
will give a bubch of files
rpm -qf <a filename>
will give what package that file comes from

Or just try it, downloading/adding the packages to your rpm  update commandline as you go.

-- Glenn
0
 
LVL 40

Expert Comment

by:jlevie
ID: 7125140
I'd guess from the Apache startup error that something didn't get build correctly for a PHP enabled Apache. What were your configure options when building Apache and PHP?
0
 
LVL 20

Expert Comment

by:Gns
ID: 8647709
Alnost a year later... Did you ever resolv your problem tsuk?

-- Glenn (Who is going through the "real-old-unlocked-questions" he has commented in)
0
 
LVL 20

Expert Comment

by:Gns
ID: 8647716
Alnost -> Almost

-- Glenn (a.k.a. Le Grand Typo)
0
 

Expert Comment

by:CleanupPing
ID: 9088980
tsuk:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 9105619
I was a side player in this award the question to Gns
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 9648289
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is to:

Accept Gns's Comments as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Paul
EE Cleanup Volunteer
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

One of the most frequently asked questions on EE in the "Windows Installer" zone is how to eliminate self-triggered installation of some product.  The problem occurs when, suddenly, whenever a certain application is launched, or even when a folder i…
Among others, I monitor the Windows Installer zone and Installer zone. I find that many of the questions could be answered much more quickly if a Windows Installer verbose log were submitted with the question.   However, I do not always have t…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now