Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,588 members, 7,809,128 topics. Date: Friday, 26 April 2024 at 12:24 AM

Questions About UNIX OS - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Questions About UNIX OS (1670 Views)

Linux/unix OS Users / Bash Shell Vulnerability Affects Linux, Unix And Mac OS X / Few Questions About Aptech Computer Institute??? (2) (3) (4)

(1) (Reply) (Go Down)

Questions About UNIX OS by sbucareer(f): 6:36pm On Mar 11, 2006

Momoh-mi, this may not be the appropriate thread to ask this question but I have watch and listen to most of your IT skills and knowledge, it seems to include advance experience with Unix. I started learning UNIX OS later last year June. Where I work I do not necessary use UNIX because java can be ported to any environment with JVM, hence I used windows. I have fedora core 4 running at home as I used it for personal tutorial and learning the OS.

The issues I cannot get my head around very quickly is the directory structure. I seem to understand most of them i.e. /home, /usr, / , the problem comes when I am installing application program. I find it very difficult to make a choice of the directory unlike windows most of the application is installed in c:\program files\, besides Unix is heavy on permission and file owner.

What I'd like to know is where to install program so that every user can lunch or execute the application or general guidance to UNIX directory structure. I have been doing some google search and have learned few ideas but it would be nice to tap your ideas if possible.

Also, can you shed lights on package installer utilities i.e. rpm, gunzip, etc and how to install application in Unix.

I use rpm installer in most of my application downloads and use the ./filename to extract the content and then use rpm -iv filename to install the application. Also If you can touch on symbolic links and the importance of it. What is the different between Symbolic and Hard links?

Most of these things I already know but I would like if you can disseminate your knowledge on Unix background since you are very strong in that area. Thanks in advance.

Re: Questions About UNIX OS by BashiBazoo: 11:12pm On Mar 11, 2006
@sbucareer
I hope I can help in a way until mimoh_mi adds his ideas. My background is HP-UX & Tru64 UNIX, but can swing with Linux which seems to be your OS.

You are correct that UNIX is heavy on permission and file ownership. I would say the closest you have to c:\program files\ is the /opt, usually the default directory for application packages such as java, cobol etc

The objective will be to create a new directory for your application, create a group to manage access to your application, create a user to install and own the application. If your are installing stuff such as java, patches etc you of cause use root and do not need this process.

On choice of directory to install, best bet is to create (mkdir) a new directory from free space you have on your hard drive. You have to have made this decision to have left unallocated space that you can later create specific filesystem that will only be used for your application.
One thing you should remember, if you are in / and you make a directory without mapping it to a filesystem, you risk filling up you root filesystem. BAD.

If you have already created without leaving space, no problem, you can create a sub directory under the filesystem with more space. For example:

webenv:/ # df -b
/bea                   (/dev/data/bea         ) :   944573 Kbytes free
/home                  (/dev/vg00/lvol5       ) :    18136 Kbytes free
/opt                   (/dev/vg00/lvol6       ) :   631152 Kbytes free
/tmp                   (/dev/vg00/lvol4       ) :   202328 Kbytes free
/tuxedo                (/dev/data/tuxedo      ) :  1336390 Kbytes free
/u01                   (/dev/data/u01         ) :  2046394 Kbytes free
/u02                   (/dev/data/u02         ) :  2046393 Kbytes free
/u03                   (/dev/data/u03         ) :  1227394 Kbytes free
/usr                   (/dev/vg00/lvol7       ) :   748888 Kbytes free
/var                   (/dev/vg00/lvol8       ) :  1192960 Kbytes free
/stand                 (/dev/vg00/lvol1       ) :   204888 Kbytes free
/                      (/dev/vg00/lvol3       ) :    77144 Kbytes free

I will create my sub directory under /u01, notice how small / is?

#cd /u01
#mkdir bea

One word of advice will be to create an OS user for each major application you want to run, for example if you want to install weblogic, create a weblogic user to run the application, same if you have oracle, tuxedo etc installed. This makes easier management and also would reduce shared memory issues you might have if you are using one user (root for example) to run all you applications. You can use the useradd command to add users from the command line, a very usefull tool to get the right syntax is man

#man useradd

The man command will give you more details of any command you are trying to use.

Now I will add a group called users

#groupadd users

Next will be to create a user that will install and run the application

#useradd -g users -d /u01/bea -s /usr/bin/ksh -c "application owner" -m -k /etc/skel weblogic

This will create the user weblogic, home directory /u01/bea default shell /usr/bin/ksh and user profile copied from /etc/skel

Now still as root change the ownership of the /u01/bea to weblogic and group to users

#chown weblogic:users /u01/bea

Next we can restrict which users will have access to that directory and thus the application within

#chmod 750 /u01/bea

This will create the files as rwxr-x--- This means the user weblogic will have full permission to read, write execute in that directory. Any subsequent user you create and belongs to the "users" group will have read execute permission. Any other user on the system excluding root will not have access to the directory and thus the application.

Now you can login as user weblogic, unpack your application and install it to /u01/bea. Any user you do not give membership to "users" group will be restricted.

Let me quickly touch on soft and hard symbolic links, 1st do a man on "ln"

#man ln


Reason for having symbolic links is for example a file is required to be in two different directories at the same time. Think for example of a configuration file that is required by two different software packages that are looking for the file in different directories. You could simply copy, but to have to replicate changes in more than one place could be an admin headache.

#ln <source> <dest.> (hard link)
#ln -s <source> <dest.> (Soft link)


Now differences:
1)soft links can be created across the filesystem while a hard link can't be. (for example I cannot link a file in /u01 and u02 above using a hard link)
2)soft link can be created for directories, but hard link can't be.
3)for a hard symbolic link, if you delete the source, the destination still exists
4)for a soft symbolic link, if you delete the source, the destination points to nothing

Ok, I have touched on some of your questions, my background is more HPUX/Tru64 so sorry if I havent been very linux specific.

By the way I sent u a post on the TUSC tutorial (https://www.nairaland.com/nigeria/topic-5335.0.html), I was having some issues, I am not a guru on java and I am trying to brush up.
Thanks
Re: Questions About UNIX OS by sbucareer(f): 1:22am On Mar 12, 2006

Thank you very much BashiBazoo, your explanation was very helpful. I would like other unix gurus to add there comments if possible. Thanks again BashiBazoo.
Re: Questions About UNIX OS by c0dec(m): 1:02pm On Mar 12, 2006
linux experience only

sbucareer:

The issues I cannot get my head around very quickly is the directory structure. I seem to understand most of them i.e. /home, /usr, / , the problem comes when I am installing application program. I find it very difficult to make a choice of the directory unlike windows most of the application is installed in c:\program files\, besides Unix is heavy on permission and file owner. What I'd like to know is where to install program so that every user can lunch or execute the application or general guidance to UNIX directory structure.

the filesystem varies slightly across linux distros and other unix platforms. coming from a mandrake & slackware background. like bashibazoo said, i would usually install apps (that don't have a default install path) to the /opt directory. but then most apps i install usually have a default install path which can be accessed by all users. i tend to install most of my apps from source (i just love optimisation flags).

sbucareer:

Also, can you shed lights on package installer utilities i.e. rpm, gunzip, etc and how to install application in Unix.

rpms are popular with red hat based distros, debs are popular with debian-based distros. slackware used a *tgz package which i more or a less a tarball of the binaries with install scripts. most source packages come in tarballs (tar.gz, tar.bz). install from source varies but it's usually along the lines of
- configure
- make
- make install
the problem with installing from source sometimes, is uninstalling it. you might want to check out a tool called [url=http://asic-linux.com.mx/~izto/checkinstall/]checkinstall[/url]. if installing from source, this tool can be very handy. i used it with slackware then. instead of using "make install", using "checkinstall" can create a slackware, rpm or deb package. and uninstalling is trivial.

some other packaging systems are available some of which are specific to a distribution. eg. Gentoo. AbujaBoy, here's your cue.

ps: forgive any typos u may find - was in a hurry
Re: Questions About UNIX OS by oasis: 2:31am On Mar 13, 2006
To touch on symlinks vs hard links, it's something that can be confusing.

Symlink is like Windows' shortcut.  Just a path to a file or directory.
A hard link on the other hand actually has the contents of the target object.  So, if you delete the target for a particular hard link, the hard link is still usable.

See if these illustrations make sense:

symlink---------------------------|
symlink-----------------------|main_filename---------->mainfile
symlink---------------------------|


hard link---------------------------|
hard link-----------------------|mainfile
hard link---------------------------|

See how hard links always point directly to the mainfile?

If you're linking between different file systems, your only option is to use symlinks.  For example, if you have linux and windows computers networked together via NTFS, only symlinks will allow you to read across those different file systems.

Hard links create problems when you're doing backups.

A hard link is a file just like a symbolic link, but the contents are different. A symbolic link contains a pointer to the actual file, while a hard link is the actual file itself.

Therefore, during backup, a hard linked file is copied as many times as there are hard links to it, such that during restore, the actual file is restored, instead of the hard links.

If I've managed to confuse you more, sorry bro. That's the nature of the beast. smiley
Re: Questions About UNIX OS by Nobody: 10:17pm On Mar 25, 2006
@sbucareer:
I have like 3-4 yrs experience playing with Linux, and unix being his grandmama, (i havent even seen UNIX b4), i guess this are the rules:

Think of the structure like this:

/usr/bin - where user-installed binaries are kept and run from
/etc - global system/application settings - similar to the c:\windows directory
/usr/sbin - user installed system binaries, usually these ones can only be exec by root


when u write an app, the binaries to the /usr/bin directory, settings for THAT app go to /etc/[name_of_your_app], and individual user settings for that app are placed in a file called /home/[user]/.[name_of_your_app]. this seems to be the standard, though we have a few deviants.

if u use rpm, the packaging process will instruct rpm to install these files in these palces. files in etc are usually world-readable, but only root/a special user can write them. files in /bin are chmod chmod 755. files in the user's home belong wholly to him.

I dont remember where shared files go: these are typically called "something-something.so.1" or similar. these are the linux counterparts of DLLs, and they are kept in their own special folder.

my 2 cents
Re: Questions About UNIX OS by vanso(m): 8:02pm On Apr 02, 2006
My advice to anyone who wants to learn UNIX and by UNIX I mean any POSIX compliant SYS V, BSD or LINUX variants is to install it and go straight to http://www.ugu.com/sui/ugu/show?I=help.beginners . It will make learning easier and less painful. And one more piece of advice, learn to program in C and you will truly be a master of any UNIX domain.
Re: Questions About UNIX OS by CHRISTFUCKER: 6:09pm On Feb 03
Op is a senior dev at faang

(1) (Reply)

Rich Internet Applications - What Do They Mean? / This May Sound Cheesy Or Desperate,but Pls Do Not Ignore! / A Seemingly Simple Logic That Took Me 3 Evening To Code

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 43
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.