prepare a tar package


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers prepare a tar package
# 1  
Old 09-24-2012
prepare a tar package

I have installed apache2 on Solaris machine with the binary. So i dont want to install the same binary across all the systems but only want to copy the lib files and the files which have been updated in this installation process.

So in order to get those lib files and then prepare a tar package it will be easier to extract this tar on all machines.

Can you please guide me on how to proceed further.

So in the installation process, i have run the below.

Quote:
./configure, make and make install
So if we go to /usr/local/apache2 you can see

Quote:
unix@test1 >ls -la /usr/local/apache2
total 54
drwxr-xr-x 15 root root 512 Sep 24 18:03 .
drwxr-xr-x 23 root root 512 Sep 24 17:08 ..
drwxr-xr-x 2 root root 512 Sep 24 17:10 bin
drwxr-xr-x 2 root root 512 Sep 24 17:11 build
drwxr-xr-x 2 root root 512 Sep 24 17:10 cgi-bin
lrwxrwxrwx 1 root root 16 Sep 24 18:03 conf -> /opt/apache/conf
drwxr-xr-x 4 root root 512 Sep 24 17:10 conf.bak
drwxr-xr-x 3 root root 1024 Sep 24 17:10 error
drwxr-xr-x 2 root root 512 Sep 10 17:57 htdocs
drwxr-xr-x 3 root root 3584 Sep 24 17:10 icons
drwxr-xr-x 2 root root 3072 Sep 24 17:10 include
drwxr-xr-x 4 root root 512 Sep 24 17:08 lib
drwxr-xr-x 2 root root 512 Sep 24 18:04 logs
drwxr-xr-x 4 root root 512 Sep 24 17:11 man
drwxr-xr-x 14 root root 5632 Sep 10 17:57 manual
drwxr-xr-x 2 root root 1536 Sep 24 17:09 modules

unix@test1 >cd /usr/local/apache2/bin
unix@test1 >ls -la
total 3256
drwxr-xr-x 2 root root 512 Sep 24 17:10 .
drwxr-xr-x 15 root root 512 Sep 24 18:03 ..
-rwxr-xr-x 1 root root 85724 Sep 24 17:09 ab
-rwxr-xr-x 1 root root 3428 Sep 24 16:43 apachectl
-rwxr-xr-x 1 root root 7058 Sep 24 17:08 apr-1-config
-rwxr-xr-x 1 root root 6478 Sep 24 17:08 apu-1-config
-rwxr-xr-x 1 root root 22649 Sep 24 16:43 apxs
-rwxr-xr-x 1 root root 24896 Sep 24 17:09 checkgid
-rwxr-xr-x 1 root root 8921 Sep 24 16:43 dbmmanage
-rw-r--r-- 1 root root 978 Sep 24 16:43 envvars
-rw-r--r-- 1 root root 978 Sep 24 16:43 envvars-std
-rwxr-xr-x 1 root root 52296 Sep 24 17:09 htcacheclean
-rwxr-xr-x 1 root root 38332 Sep 24 17:09 htdbm
-rwxr-xr-x 1 root root 31436 Sep 24 17:09 htdigest
-rwxr-xr-x 1 root root 38272 Sep 24 17:09 htpasswd
-rwxr-xr-x 1 root root 1220796 Sep 24 17:10 httpd
-rwxr-xr-x 1 root root 31268 Sep 24 17:09 httxt2dbm
-rwxr-xr-x 1 root root 31956 Sep 24 17:09 logresolve
-rwxr-xr-x 1 root root 35104 Sep 24 17:09 rotatelogs
unix@test1 >ldd -d ab
libm.so.2 => /lib/libm.so.2
libaprutil-1.so.0 => /usr/local/apache2/lib/libaprutil-1.so.0
libexpat.so.1 => /usr/local/lib/libexpat.so.1
libiconv.so.2 => /usr/local/lib/libiconv.so.2
libapr-1.so.0 => /usr/local/apache2/lib/libapr-1.so.0
libuuid.so.1 => /lib/libuuid.so.1
libsendfile.so.1 => /lib/libsendfile.so.1
librt.so.1 => /lib/librt.so.1
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libpthread.so.1 => /lib/libpthread.so.1
libc.so.1 => /lib/libc.so.1
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
libaio.so.1 => /lib/libaio.so.1
libmd.so.1 => /lib/libmd.so.1
libmp.so.2 => /lib/libmp.so.2
libscf.so.1 => /lib/libscf.so.1
libdoor.so.1 => /lib/libdoor.so.1
libuutil.so.1 => /lib/libuutil.so.1
libgen.so.1 => /lib/libgen.so.1
/platform/SUNW,Sun-Fire-T200/lib/libc_psr.so.1
/platform/SUNW,Sun-Fire-T200/lib/libmd_psr.so.1
Btw i dont want to copy any source files and i just want to make a tar package with the files involved with the installation (i.e) lib files and binaries.

Please assist.

Thanks
# 2  
Old 09-24-2012
Code:
tar c tar_file_name.tar relative_path_to_executables relative_path_to_dynamic_libs/*.so relative_path_to_any_other_files_like_starter_config_or_info_or_doc_or_man

# 3  
Old 09-24-2012
Quote:
Originally Posted by DGPickett
Code:
tar c tar_file_name.tar relative_path_to_executables relative_path_to_dynamic_libs/*.so relative_path_to_any_other_files_like_starter_config_or_info_or_doc_or_man

Thank you for the reply. an you guide me in gathering all of these required files. I mean the best procedure to gather the files and i dont want any files to be missing.

Thanks
# 4  
Old 09-24-2012
Well, 'ldd -rsv' will tell you every library used by an executable, and 'strace' can tell you every file a running app opens (very educational). Usually, libraries go in a 'lib' dir and that dir is in the LD_LIBRARY_PATH, and executables, script or compiled, go in a 'bin' dir that is in the $PATH variable. Throwing everything in /bin and /lib is a bad practice. Directories /usr/local/bin and /usr/local/lib are popular, but it is ok to keep every app separate. If you create the desired relative path on the tar end, it will create the relative directories wherever untarred. You can write and include a little script to move them from the untar directory, if that feels more comfortable.

Packaging like an rpm is a bit past me, and I prefer simple archives. Compression is nice, too. New tar has that, or you can use zip, or gzip the tar (.tar.gz or .tgz).
# 5  
Old 09-25-2012
So i need to go under /usr/local/apache2 and run the command ldd -rss for all the directories under /usr/local/apache2?

Can you briefly explain as i am new to unix?

---------- Post updated 09-25-12 at 11:20 AM ---------- Previous update was 09-24-12 at 04:09 PM ----------

Quote:
Originally Posted by DGPickett
Code:
tar c tar_file_name.tar relative_path_to_executables relative_path_to_dynamic_libs/*.so relative_path_to_any_other_files_like_starter_config_or_info_or_doc_or_man

If we want to copy only selected files as shown in the below eg how can we write the tar command? So as below there are several other directories that we need to tar up. Btw if i am installing for apache do i need to look for only apache dependencies or all the lib files under /usr/local/lib?

Quote:
unix@test1 >ldd -d ab
libm.so.2 => /lib/libm.so.2
libaprutil-1.so.0 => /usr/local/apache2/lib/libaprutil-1.so.0
libexpat.so.1 => /usr/local/lib/libexpat.so.1
libiconv.so.2 => /usr/local/lib/libiconv.so.2
libapr-1.so.0 => /usr/local/apache2/lib/libapr-1.so.0
libuuid.so.1 => /lib/libuuid.so.1
libsendfile.so.1 => /lib/libsendfile.so.1
librt.so.1 => /lib/librt.so.1
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libpthread.so.1 => /lib/libpthread.so.1
libc.so.1 => /lib/libc.so.1
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
libaio.so.1 => /lib/libaio.so.1
libmd.so.1 => /lib/libmd.so.1
libmp.so.2 => /lib/libmp.so.2
libscf.so.1 => /lib/libscf.so.1
libdoor.so.1 => /lib/libdoor.so.1
libuutil.so.1 => /lib/libuutil.so.1
libgen.so.1 => /lib/libgen.so.1
/platform/SUNW,Sun-Fire-T200/lib/libc_psr.so.1
/platform/SUNW,Sun-Fire-T200/lib/libmd_psr.so.1
# 6  
Old 09-26-2012
for each executable you need to trace all the libraries it uses and include those not already on the destination host. Locations can vary as long as they are in the ld() ENV variable dir:dir list (usually $LD_LIBRARY_PATH). This bit runs ldd -rsv on my hp-ux java an lists the libraries it uses.
Code:
$ find ... -type f | xargs -r file | sed -n '
    s/:.*executable dynamically linked.*//p
  ' | while read f
do
  ldd -rsv $f
done 2>&1 | sed -n '
    s/.*=>[ \t]*//p
  ' | sed '
    s/[^/]*\/\.\.\///g
  ' | sort -u
/home/myhome/myroot/usr/local/jre/lib/PA_RISC2.0/jli/libjli.sl
/usr/lib/libc.2
/usr/lib/libdld.2
/usr/lib/libpthread.1
 .
 .
 .
 .
$

Narrative: find all files in package trees that might be executable compiled objects, run file on them to find just executables dynamically linked (your file messages may vary), run ldd on each, capture libraries located, remove any parent dir zigzag references, e.g., "xxx/bin/../lib/libxxx.sl" and sort unique. Turn the '\t' into a real tab.

If you build your app in a dir with dirs under it like /usr/local/*/ (bin,lib,man), you run itin place using PATH, LD_LIBRARY_PATH, MANPATH or copy your_dir/* into /usr/local/.

Last edited by DGPickett; 09-26-2012 at 04:41 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

Problem when trying to remove a package using rpm command - error: package is not installed

Hello, i have installed a package by using the command sudo rpm -i filepackage.rpm package filepackage is already installed when i try to remove it, i get an error saying "is not installed": sudo rpm -e filepackage.rpm error: package filepackage is not installed How can... (4 Replies)
Discussion started by: g_p
4 Replies

2. UNIX for Dummies Questions & Answers

Can't install rpm package with --prefix in new path.Error: package is not relocatable

Hello, i have downloaded an rpm package "hadoop-0.20.205.0-1.amd64.rpm" in /usr/local/ directory. I'm trying to install the rpm package in a new path/location (/usr/local/hadoop-0.20.205), but i can't. I did: 1st try: Didn't work sudo rpm -i --prefix=/usr/local/hadoop-0.20.205... (1 Reply)
Discussion started by: g_p
1 Replies

3. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

4. UNIX for Advanced & Expert Users

How to find dependancies of .dstream package (Solaris) & .rpm package( linux)

Friends, Please let meknow, How we can find the dependancies of .dstream package & .rpm package before installation ? For AIX, We can use the inutoc . command to create the .toc file for the bff package, What about Solaris & Linux ? (0 Replies)
Discussion started by: yb4779
0 Replies

5. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

6. Linux

The install tar.gz package must be specified as the first argument!

I just tried to unzip the tar.gz installation file with gzip -d file.tar.gz and then tar -xvf file.tar. ThenI tried to install with command ./install.sh, i got the following error... The install tar.gz package must be specified as the first argument! Any one have an idea why this error.... (1 Reply)
Discussion started by: s_linux
1 Replies

7. Linux

how to restore original package after uninstalling the upgraded package using rpm

have following package installed rpm -qa |grep ADMIN It will give the following package installed: ADMIN-4.0.0.1 Now I will upgrade the ADMIN package using the following command. rpm --upgrade ADMIN-4.1.0.1 It will upgrade the ADMIN packagge to ADMIN-4.1.0.1 Now I want that... (0 Replies)
Discussion started by: amitpansuria
0 Replies

8. Shell Programming and Scripting

prepare log for access

I need help with one of my log files I got following format: This is only a smal part of the file ! ......... -------------------------------------- 2003-08-05 12:23:13.939781 logNo : 1380008 Server started - Activate; 10.48.4.51 -------------------------------------- 2003-08-05 ... (4 Replies)
Discussion started by: joerg
4 Replies
Login or Register to Ask a Question