LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 12-23-2010, 10:01 PM   #1
bcarl6
LQ Newbie
 
Registered: Dec 2010
Posts: 4

Rep: Reputation: 1
Question How can I install a program and have it accessible as a command from any directory?


I want to install a program (specifically metasploit), and have it accessible from any directory in the terminal. I have it installed correctly, but I have to travel to the directory it is installed in to run it (by using ./msfconsole ). I want to be able to be in any directory and just run "msfconsole" and have metasploit run. How do I do this? I'm pretty sure that I have to copy the metasploit folder to the /opt/ directory? Maybe the /usr/bin/ directory? I am not sure, and any help would be appreciated. Thanks in advance!
 
Old 12-23-2010, 10:21 PM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,850

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
Either symlink the Metasploit binaries to /usr/bin so they are in your path, or add the Metasploit directory to your PATH variable.
 
Old 12-23-2010, 10:30 PM   #3
chickenjoy
Member
 
Registered: Apr 2007
Distribution: centos,rhel, solaris
Posts: 200

Rep: Reputation: 30
Edit .bash_profile of the user:
Code:
# User specific environment and startup programs

#PATH=$PATH:$HOME/bin				<--- comment out the existing
PATH=$PATH:$HOME/bin:/path/to/metasploit	<--- path to the directory where the program is

export PATH
Now logout and log back in.

Edit: I guess MS3FGX's suggestion is better if you want all existing users and future users to have instant access to the program without having to modify their bash_profile individually.

Last edited by chickenjoy; 12-23-2010 at 10:33 PM.
 
Old 12-23-2010, 10:34 PM   #4
zer0signal
Member
 
Registered: Oct 2010
Location: Cleveland
Distribution: Slackware, Fedora, RHEL (4,5), LFS 6.7, CentOS
Posts: 258

Rep: Reputation: 29
step by step:

at the prompt type

updatedb

wait till it finishes

then

locate msfconsole

once it shows you the path to "msfconsole"

type:

cd /usr/bin

ln -sf /path/to/msfconsole msfconsole

ln [OPTION]... [-T] TARGET LINK_NAME (1st form)
ln [OPTION]... TARGET (2nd form)
ln [OPTION]... TARGET... DIRECTORY (3rd form)
ln [OPTION]... -t DIRECTORY TARGET... (4th form)

that will place a symlink in /usr/bin/msfconsole pointing to >>>> /path/to/msfconsole


you can verify this happend by typing

ls -l in the /usr/bin directory

Last edited by zer0signal; 12-23-2010 at 11:04 PM.
 
  


Reply

Tags
bin, directory, install, program


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Line Accessible Bittorrent Client Geneset Linux - Server 2 07-23-2007 02:23 PM
Samba - home directory not accessible essdeeay Linux - General 2 03-31-2006 11:59 AM
Image Directory Not Accessible on the Web kylee Linux - Newbie 4 01-15-2006 11:14 PM
Which directory should I install a program in? LinuxPadawan Linux - General 6 04-11-2005 05:20 PM
putting shell script accessible in all directory demmylls Linux - General 1 02-23-2004 10:37 AM


All times are GMT -5. The time now is 10:02 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration