LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 03-08-2016, 08:59 PM   #1
islammanjurul
LQ Newbie
 
Registered: Dec 2015
Posts: 26

Rep: Reputation: Disabled
How to link to different install location


Hi

I want to install some application, but not on default install location, rather to another. See the attached screenshot. Look how pgsql is linked to /home/pgsql from its default /var/lib/pgsql so whenever I go to /var/lib/pgsql it points or take me to /home/pgsql.

Actually I want to install two new application, grafana and Influxdb. Instead of them installing on default location, I have added a new storage drive, mounted and created partition like /mnt/influx
So instead of them installing at default /var/lib/Influxdb I want them to be here /mnt/influx/Influxdb , so that whenever I go to /var/lib/Influxdb it will take me to /mnt/influx/Influxdb and same for grafana too to /mnt/influx/grafana . the attached screenshot I have collected, so I don't know how it was done (pointing the pgsql location to somewhere else).

I found it is done using ln command, but not sure how to and what exact parameters to use.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20160309-084930.jpg
Views:	22
Size:	205.4 KB
ID:	21092  
 
Old 03-09-2016, 01:53 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
You have two options. You can actually install it to the intended location, or you can install it to the default location and then move it and symlink it back.

Installing to the intended location is usually only possible with codes you build from source, you can pass the installation directory to the configure script.
Installing to the default location and then moving it is easy and works with anything, but it does result in slightly more "clutter" (symlinks hanging around pointing to the actual location).
Code:
# install program
mv /path/to/dir /path/to/new/dir
ln -s /path/to/new/dir /path/to/dir
 
1 members found this post helpful.
Old 03-09-2016, 05:12 PM   #3
islammanjurul
LQ Newbie
 
Registered: Dec 2015
Posts: 26

Original Poster
Rep: Reputation: Disabled
I'll check and report back to you, however one question, does symlinking cause the application not to work properly? Like if I install postgreSQL or Nginx on a different location and also the data moved there?
 
Old 03-09-2016, 05:22 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
It should behave as if it's still in the normal spot. The program still thinks it's running from the default location while the symlink transparently redirects all I/O to the actual location. Unless the program goes out of the way to check if its directory is actually a symlink (which I can't think of any reason why it would) it should be none the wiser.
 
Old 03-09-2016, 07:36 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
The system or at least mine does, even links itself to other directories

Code:
 %userx@voided 07:33:54 ~ >>$ cd /
 %userx@voided 07:34:04 / >>$ ls -la
total 60
drwxr-xr-x  17 root root  4096 Mar  7 06:13 .
drwxr-xr-x  17 root root  4096 Mar  7 06:13 ..
lrwxrwxrwx   1 root root     7 Mar  1 13:30 bin -> usr/bin
drwxr-xr-x   3 root root  4096 Mar  9 05:32 boot
drwxr-xr-x  19 root root  3460 Mar  9 06:29 dev
drwxr-xr-x  64 root root  4096 Mar  9 07:08 etc
drwxr-xr-x   5 root root  4096 Mar  1 13:04 home
lrwxrwxrwx   1 root root     7 Mar  1 13:30 lib -> usr/lib
lrwxrwxrwx   1 root root     9 Jun 15  2015 lib32 -> usr/lib32
lrwxrwxrwx   1 root root     7 Jun 15  2015 lib64 -> usr/lib
drwx------   2 root root 16384 Jun 15  2015 lost+found
drwxr-xr-x   3 root root  4096 Mar  1 15:24 media
drwxr-xr-x   2 root root  4096 Mar  1 13:04 mnt
drwxr-xr-x   7 root root  4096 Mar  8 22:44 opt
dr-xr-xr-x 199 root root     0 Mar  8 23:17 proc
drwxr-x---  17 root root  4096 Mar  9 05:23 root
drwxr-xr-x  21 root root   660 Mar  9 07:17 run
lrwxrwxrwx   1 root root     8 Mar  1 13:30 sbin -> usr/sbin
dr-xr-xr-x  13 root root     0 Mar  8 23:17 sys
drwxrwxrwt   7 root root   240 Mar  9 07:33 tmp
drwxr-xr-x  11 root root  4096 Mar  2 12:57 usr
drwxr-xr-x  12 root root  4096 Mar  6 03:00 var
 %userx@voided 07:34:08 / >>$
when ever I install something that needs boot up start I link it in /var/service and it works -- I've had installs from source that installed into other directories link it -- it works

this is simply what links are designed for

Last edited by BW-userx; 03-09-2016 at 08:33 PM.
 
Old 03-09-2016, 08:02 PM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
it depends a bit on WHAT it is

i build a lot of programs in a second tree
the OS is / and /usr
i install my software to
/DATA/SUSE/

if i am installing programs to /usr or /DATA/SUSE/
i add the install location to the "prefix" in configure

Code:
./configure --prefix=/DATA/SUSE
these locations ARE ALSO in the $PATH and $LD_LIBRARY_PAT and $PKG_CONFIG_PATH
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Actual location of the unix link tech_xavier Linux - Newbie 4 03-19-2013 07:44 AM
Can I link multiple directories to one location? jim.thornton Linux - Newbie 4 03-14-2012 03:13 AM
Find a link in web folder location tanveer Linux - General 2 10-16-2007 09:56 PM
Create symbolic link of remote location Belgian_Penguin Linux - Software 6 11-26-2004 08:13 AM
What does link to location do? BajaNick Linux - General 8 03-14-2004 12:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:56 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration