Installing packages into a different directory


I have a large application (rclone) that I downloaded onto an external drive connected to OpenWRT. There are no dependencies required.

How do I run the application from the external location via CLI?


1 Like

It's hard to know what you are asking without knowing your knowledge level. If you have the zip file with a version that can run on your processor then you just have to unpack it where ever you like and type the path to the binary.

1 Like

Sorry--yes, I know how to do that. I mean I would just like to type the name of the application without having to type the whole directory every single time.

In theory, you could make a symbolic link from your application's full path to the /usr/bin folder.

Assuming that the package is running properly where it's installed, one typical approach is to add it to the PATH for the shell in use.

According to

A login shell first reads commands from the files /etc/profile and .profile if they exist. If the environment variable ENV is set on entry to an interactive shell, or is set in the .profile of a login shell, the shell next reads commands from the file named in ENV. Therefore, a user should place commands that are to be executed only at login time in the .profile file, and commands that are executed for every interactive shell inside the ENV file. To set the ENV variable to some file, place the following line in your .profile of your home directory

If you wanted the change to be present for all users, adding to the bottom of /etc/profile a file in /etc/profile.d/*.sh would be one way to accomplish this.

export PATH="${PATH}:/path/to/the/directory/with/your/bin"

For a specific user, it looks like making the same change to that user's .profile would also accomplish that goal.

Edit: /etc/profile contains

[ -n "$FAILSAFE" ] || {
	for FILE in /etc/profile.d/*.sh; do
		[ -e "$FILE" ] && . "$FILE"
	unset FILE

suggesting this being a "cleaner" way to make the change and have it persist over re-flashes.

So just so I understand I

mkdir /etc/profile.d
nano /etc/profile.d/

add export PATH="${PATH}:/path/to/the/directory/with/your/bin" to and that's it?

Just want to confirm my path above is correct, thanks!

Just to supplement all replies above, opkg already has a -d, --dest option to make install to a different location easier.


This was an application I put onto an external drive (due to the size) that wasn't installed with opkg.

I did exactly this, rebooted, and tried to run the application with just "rclone" but it didn't work :frowning: Any ideas?

export PATH="${PATH}:/mnt/sda1/tools/rclone/rclone"

Make a symlink.
ln -s /mnt/sda1/rclone/rclone /usr/bin/rclone

The PATH isn't supposed to contain the filename, only the path.

1 Like

symlink worked beautifully. Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.