Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Say I'm interested in the source for one particular Linux utility, like factor. Where can I find the source code for that utility?
You can also find out which package the binary comes from an download that packages source code.
On Debian (and Ubuntu and anything else that's based on Debian) you do that like this:
$ dpkg -S /usr/bin/factor
coreutils: /usr/bin/factor
$ apt-get source coreutils
The first command will check which package contains the file you are searching for (use "which factor" to find out which binary is executed when you just type "factor").
The second command will download and unpack the sources (including the patches applied to build the package) to the current directory, so it should be executed in a dedicated or temporary directory.
I'm pretty sure rpm-based distributions have a similar mechanism, but I don't know their commands.
What I did was type
man factor
and went to the bottom and found 'GNU coreutils 6.10'. So I googled 'coreutils' and... found the site joschi just linked to.
To find the package a binary comes from, in rpm based system, you might type:
$ rpm -qf /usr/bin/factor
which will print the package name. Instead, with:
$ rpm -qif /usr/bin/factor
you will get also information on a package, including it's home page in many cases.
Source rpms also exist, but how to get them depends on the high-level package manager used on top of RPM (yum, urpmi, apt-get4 for rpm, ...).
On most systems, also, /usr/share/doc/ contains some documentation on the program, and the website link is pretty often found somewhere there, maybe in the README.
Usually you'll find the source code on the website of the program if it is open source. In this case here since factor is part of coreutils.
On Gentoo, simply look in the ebuild you compiled the package with :D.
If you're not sure?
# which factor
/usr/bin/factor
# grep '/usr/bin/factor' /var/db/pkg/*/*/CONTENTS
/var/db/pkg/sys-apps/coreutils-6.12-r2/CONTENTS:obj /usr/bin/factor 5aaf903daa4345efb11618b3cb47e9a5 1224224574
/var/db/pkg/sys-apps/coreutils-6.12-r2/CONTENTS:obj /usr/lib64/debug/usr/bin/factor.debug 517d965636850633e9b15926dde8c222 1224224575
# cat /var/db/pkg/sys-apps/coreutils-6.12-r2/SRC_URI
ftp://alpha.gnu.org/gnu/coreutils/coreutils-6.12.tar.lzma mirror://gnu/coreutils/coreutils-6.12.tar.lzma mirror://gentoo/coreutils-6.12.tar.lzma mirror://gentoo/coreutils-6.12-patches-1.0.tar.lzma http://dev.gentoo.org/~vapier/dist/coreutils-6.12-patches-1.0.tar.lzma
# cat /var/db/pkg/sys-apps/coreutils-6.12-r2/HOMEPAGE
http://www.gnu.org/software/coreutils/
But of course, the source code is probably still available in /usr/portage/distfiles .
Another, very good approach is to use Google Code Search. For example, a search for factor coreutils (see the man page or factor --help to see that it's from coreutils) came up with the package as the second result. Two clicks away I was browsing factor.c online.
Google Code Search searches most public source code. You can use regexps and many advanced search options, including restricting by language and license.
I usually find a link to the source, homepage, and other useful information by doing a search on freshmeat.
You may want to check out SourceForge.net.
Related
I'd like to compare the contents of an RPM to an installed system (that professes to have the RPM already installed), looking for any files/directories that may have be different (or missing) -- something like pkgchk on Solaris.
It looks like rpm -V can be used to compare the system's filesystem(s) against the system's RPM database -- but I want to be able to compare an offline "golden" RPM with what's on the system (e.g., to avoid depending on a potentially tainted on-system RPM database or on incorrect version information from pre-release RPM files).
I know I could write something to unpack the RPM and then walk through the contents, comparing everything. But is there any existing tool that can do the comparison in-situ?
After looking through the "Similar Questions", I found a reference to a way to do this, add the "-p" option to the command to yield: rpm -Vp some*.rpm. I'd missed the aside on the man page saying that the query options were also applicable to the verification operation.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm not a complete beginner with Linux but I'm using Debian to familiarise myself with it for work.
I have a few quick questions:
To run a binary from a terminal, does it have to be in /bin/? What if it has dependencies, must they also go in /bin/?
I'm used to installing things on Windows by clicking 'next' a lot. If I download a .tgz and it contains an .exe along with several folders, exactly how is it installed?
Is uninstalling in Linux as simple as removing the files, or are there registry style devices that must be modified?
I know these will have been asked before but I cannot get good, clear answers written from a noob friendly point of view. Thanks!
To run a binary from a terminal, does it have to be in /bin/? What if it has dependencies, must they also go in /bin/?
To run a binary just run it from the terminal and see if it works. If it has dependencies they will usually be found automatically or check the readme.
I'm used to installing things on Windows by clicking 'next' a lot. If I download a .tgz and it contains an .exe along with several folders, exactly how is it installed?
Try to double click the .tgz file first then extract and view the README.
Is uninstalling in Linux as simple as removing the files, or are there registry style devices that must be modified?
Depends which Linux OS you are using. Ubuntu is very simple and has a simple interface just like Windows for uninstalling apps.
Not every binary will be in /bin or /usr/bin. To run them from the command line you would set the PATH env var to the directory where executables live. For example, if you create a dir /home/users/foo/bin then set the PATH like so:
export PATH=${PATH}:/home/users/foo/bin
After that, you just type the name of the executable into the shell and the full path is found by searching the directories listed in the PATH.
A .tgz should not contain a .exe since that is a Windows specific executable. Typically, executable on Linux do not have an extension.
No, there is no registry under Linux. That specific insanity is only found under Windows.
1) An executable can be anywhere in directories specified in PATH variable, and you also can run an executable from any location by specifying path to it (if it's in current directory, then write ./<exename>).
2-3) Debian has its own package management system, usually software is installed/uninstalled using sudo apt-get install <package> or sudo apt-get remove package (I recommend reading about apt-get and sudo). Instead of Windows registry, there are many small configuration files in Linux, and some software makes changes to them so it should be carefully uninstalled (but Debian package management usually handles these cases well).
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Just as a preface, sorry if I am missing something obvious. I am mainly a PHP/Python programmer but am doing server config for a friend's startup.
I only have left to install Apache Ant on my friend's Linux VPS server (he wants to compile Android apps on server- just a note I have already somehow manged to get the JDK and LAMP that would also be necessary).
When I did some digging on how to get Ant, this was all I got that really met my needs: http://ant.apache.org/manual/install.html#jpackage
Can someone give me some kind of push on what to do at all? Maybe a wget with the appropriate link? Anything at all is appreciated.
Thanks in advance to all.
Did you search for the package apache-ant in your RPM database?
If you're not using your RPM for installing packages (and why wouldn't you), you can download Ant directly from Apache. (Note that there are directions for JPackage RPMs too. Just in case you change your mind about not using RPMs.
Ant is a Java program, so you must have a Java JDK installed (Ant will run under the JRE, but you couldn't build Java apps with that), and make sure that the java command is in your Path. However, that also means that there is no special version of the Ant binary for each platform, so it's much easier to install.
Download and extract the Ant archive to a suitable directory (/opt or /usr/local or /usr/lib or whatever standard you're using). Inside the archive, when unpacked, will be a bin directory. Those files under bin are mainly shell scripts (the ones that end with *.bat are Windows Batch files, you can ignore those). Just execute those.
I like to symbolically link those files under Apache-Ant's bin directory to a similar name under /usr/local/bin directory. That way, you don't need to put /usr/local/apache-ant-1.8.3/bin in your $PATH.
And that's really about it.
Just follow the "Short Story" section at the top of the page you referenced:
To get up and running with the binary edition of Ant quickly, follow these steps:
Make sure you have a Java environment installed, See System Requirements for details.
Download Ant. See Binary Edition for details.
Uncompress the downloaded file into a directory.
Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed Ant to, and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH. See Setup for details.
Optionally, from the ANT_HOME directory run ant -f fetch.xml -Ddest=system to get the library dependencies of most of the Ant tasks that require them. If you don't do this, many of the dependent Ant tasks will not be available. See Optional Tasks for details and other options for the -Ddest parameter.
Optionally, add any desired Antlibs. See Ant Libraries for a list.
Note that the links in the list above will give more details about each of the steps, should you need them. Or you can just continue reading the rest of this document.
Is there an easy procedure to build an RPM.If so Please explain or provide the link.........
My requirement is very simple ..
I have two other RPMs which should be combined into one single RPM....
Please explain the process....
Thanks in advance..........
Building an RPM itself is rather easy, you just need to run
rpmbuild -ba <mypackage.spec>
The more complex task is creating the .spec file, which controls how the rpm itself is built. A good explanation is the book Maximum RPM, which is available on the rpm homepage. Creating a .spec file is handled here. From my own experience building a .spec file is something that's not easy -- but not too complicated either unless you want to make special things. The standard ./configure && make && make install is usually not too complicated.
Not sure what the problem is; if you've already got two RPMs, why do you need to make them into 1 rpm? Why not just use a shell script to install them both at the same time?
The RPM command will take multiple arguments, so for example:
rpm -ivh one.rpm two.rpm three.rpm
Will install one, followed by two, followed by three.
Otherwise, from what I know, you're going to have to build the packages first, and then build them into an RPM, at which point you will have a custom RPM that will have to be manually updated every time one of the component packages changes. Yuck.
Basic guide for RPM creation is available at:
http://fedoraproject.org/wiki/How_to_create_an_RPM_package
A very good and complete guide for RPM creation (by Fedora community) is available at link: http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/
It is is wonderful.
BTW, for straight answer of your question, you might want to add two packages as a subpackage of another package. For that there are some specific entries in RPM spec file.
You need to create only one SPEC file for all three packages
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
In the linux file system, where should user scripts be placed?
I'm thinking specifically python scripts to be called by cron.
the information i got:
/usr/local/sbin custom script meant for root
/usr/local/bin custom script meant for all users including non-root
chatlog snips from irc.debian.org #debian:
(02:48:49) c33s: question: where is the _correct_ location, to put custom scripts
for the root user (like a script on a webserver for createing everything needed
for a new webuser)? is it /bin, /usr/local/bin,...? /usr/local/scripts is
mentioned in (*link to this page*)
(02:49:15) Hydroxide: c33s: typically /usr/local/sbin
(02:49:27) Hydroxide: c33s: no idea what /usr/local/scripts would be
(02:49:32) Hydroxide: it's nonstandard
(02:49:53) Hydroxide: if it's a custom script meant for all users including
non-root, then /usr/local/bin
(02:52:43) Hydroxide: c33s: Debian follows the Filesystem Hierarchy Standard,
with a very small number of exceptions, which is online in several formats at
http://www.pathname.com/fhs/ (also linked from http://www.debian.org/devel/ and
separately online at http://www.debian.org/doc/packaging-manuals/fhs/fhs-2.3.html)
(02:53:03) Hydroxide: c33s: if you have the debian-policy package installed, it's
also in several formats at /usr/share/doc/debian-policy/fhs/ on your system
(02:53:37) Hydroxide: c33s: most linux distributions follow that standard, though
usually less strictly and with more deviations than Debian.
thanks go out to Hydroxide
If you're talking about scripts created by a user that will be run from that users crontab, I typically put those in either a bin or scripts folder in the home directory, or if they're intended to be shared between users, a /usr/local/scripts directory.
For whom it interests, the Filesystem Hierarchy Standard (FHS) is a standards document and still a very good read. I describes the foundation for almost any Linux distribution and is officially endorsed e.g. by Debian and the Linux Standards Base (LSB).
You won't find any positive answer for that question, though, since ... it's not defined ;-). Only thing I can say: Don't put in /bin (neither in /usr/bin). /usr/local/scripts is unusual as well. $HOME/bin seems to be an acceptable place, iff the script is only used by this single user.
I'm a strong beleiver that if a file is made by a user, it goes in his user directory (/home/username) if he didn't make it then it gets more complicated. I have in the past just put them in either /usr/local/bin, /bin, or /usr/local/scripts, I'm not sure about etch, but you need to check to make sure that /usr/local/scripts is actually in Cron's $PATH.
The Debian guide can be quite useful when it comes to Ubuntu:
Normally, programs install themselves in the /usr/local subdirectories. But, Debian packages must not use that directory, since it is reserved for system administrator's (or user's) private use
/usr/local/bin seems to be acceptable according to the guide.
Personally I put my scripts in $HOME/.scripts.
I wish that LSB would specifically address this question though.
How about /home/username/bin?
Add ~/bin to $PATH and make the script executable with chmod +x filename.
personally I prefer
/home/username/.bin
This way the bin folder is hidden but you can still add it to the PATH and execute all scripts with the x-bit inside.
I like my home directory to be clean (at first glance) with very few folders.
You can also add paths to your crontab file as shown in a previous cron-related question.