NodeJs/NestJs which directory to install on Unix - node.js

Hi I have nodejs/nestjs microservice running in forever. I have installed in /home directory. I Have been reading around and home is not the correct place for this to be installed.
What is the correct directory to install it into? I is /srv or /usr/local or something else completely?

I think the best directory for things like that is /opt
You can read more about /opt and whole Filesystem Hierarchy here:
https://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/opt.html
https://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/index.html

Related

Where to put application so I can use them no matter working directory?

I installed ngrok and put it in the /bin folder. But I can only use the command ./ngrok when I'm in the /bin directory. I'm pretty new to using Linux but I'm quite shure that /bin apps/command can be used everywhere. Anybody know where to put applications so I can use them no matter what's my current working directory.
If /bin is in the $PATH, you can call it with ngrok, without specifying the current directory ./.

Getting folder conflicts when running yum groupupdate inside a chroot environment

I have a chroot environment where i am getting folder conflicts when I am running the below command.
/usr/bin/yum --verbose --assumeyes --installroot /home/prateek/project/.ova_work_dir/mnt/dst_root --config=/home/prateek/project/.ova_work_dir/mnt/dst_root/etc/yum.repos.d/project-upgrade.repo --obsoletes groupupdate '*' project
Below is the error
Running transaction test
Transaction check error:
file /usr from install of messagebus_c-1.0.0-0.x86_64 conflicts with file from package filesystem-3.2-20.el7.x86_64
I have below two questions to ask:
1) Why i am getting folder conflict when yum is running transaction test as I have seen file conflicts but not folder conflicts.
2) How would I resolve this folder conflicts.
The messagebus_c RPM specfile needs to be edited to not "own" /usr but instead all the files in it, e.g. /usr/*.
Can you try this ?
/usr/bin/yum --verbose --assumeyes --installroot=/home/prateek/project/.ova_work_dir/mnt/dst_root --config=/home/prateek/project/.ova_work_dir/mnt/dst_root/etc/yum.repos.d/project-upgrade.repo --obsoletes groupupdate '*' project
issue was
missing equal to sign --installroot /home
expected like this --installroot=/home
This can happen when messagebus_c spec file has:
%install
touch %{buildroot}/usr
%files
/usr
I.e. here the /usr is a file. While filesystem provides it as a directory. You cannot have both. A directory cannot be a file. And vice versa.

How to make directory at Linux root directory from terminal when in sub-directory?

Background: OS is Debian GNU/Linux.
I am trying to make a directory at root, when I am in a sub-directory. In other words, let's say I am at the directory /a/b/c, and I want to make a directory at the root level, called d. How do I go about doing that?
In case you can't tell, I also don't know all the right wording/terms.
UPDATE: I did not understand difference between home directory and root directory. I learned about pwd command, and that solved the problem. What I actually wanted was to make a directory within the home directory.
Assuming that you have the required permissions, you could do mkdir /d.
It should be like sudo mkdir /name_of_directory

Change ownership of linux directory

Hi I'm very new to Linux..
Once I have changed ownership of /usr my sudo command failed working ..
Once I changed ownership of /var some other things broke ..
1: I just want to know which are folders where one should never change it's default ownership..
2: what if someone gets permission_denied for /var during installing some packages .. chmod or chown should be used ...
I would never change the ownership in folders unlike /home/* /opt/. Sometimes you have to change the owner if you put your own stuff to /etc/, but you should now what to do.
To install software, even in Ubuntu use the provided tools, 'apt' and 'dpkg' for example. Often the installation needs root rights. Give them with the usage of and additional 'sudo'.
# f.e. installation of a command line browser
sudo apt install w3m

Remove a file from usr/include?

I am trying to run a program from command line in ubuntu and I have a directory that is in the usr/include/ directory that I need to remove so that it will run. How can I do this from command line?
rm -r /usr/include/...
Just use that. But if you need to do that, there is something wrong with your program. If a package installed the directory, use:
sudo apt-get purge package-name
All in all, the directories directly under /usr are under the charge of the package manager, and if you want to do things without that, use the /usr/local dir. Changing other programs resources is a bad idea. Also, don't run anything you don't have to with sudo. That will end badly. And what program would require the removal of a dir in /usr/include?

Resources