Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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?
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.
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/liblrwxrwxrwx 1 root root 9 Jun 15 2015 lib32 -> usr/lib32lrwxrwxrwx 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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.