CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Installation

[OpenFOAM.com] How to change installation from root to new user ??

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 12, 2021, 15:18
Default How to change installation from root to new user ??
  #1
New Member
 
Chattisgarh
Join Date: Oct 2020
Posts: 5
Rep Power: 5
nikag123 is on a distinguished road
Hello Everyone.
I have accidentally installed my openfoam 8.0 in the root directory. By this I mean that the setup files (the ones which include pre loaded tutorials) are in /opt/openfoam8 and the case files (which are accessed by $FOAM_RUN, where I copy the tutorials) are stored in /root/OpenFOAM/root-8/run.

But now I created a new user, copied the tutorials in it from /opt/openfoam8/tutorials and performed blockMesh in the cavity tutorial.
The error appeared was "Cannot find 'blockMesh' command". This is I suppose occurred due to location of openfoam in different directory.

So my question is, how to move the openfoam installation from the /root folder to the new user directory (which is /home/new_user ). I have tried by giving all types of root privileges to the new_user but was unable to run the case files while I login in the new user directory.

Any help would be great !!
nikag123 is offline   Reply With Quote

Old   February 12, 2021, 15:43
Default
  #2
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12
HPE is on a distinguished road
Hi,
- maybe just remove (`rm -rf`) all OF from the root, and reinstall it locally?
HPE is offline   Reply With Quote

Old   February 12, 2021, 16:10
Default
  #3
New Member
 
Chattisgarh
Join Date: Oct 2020
Posts: 5
Rep Power: 5
nikag123 is on a distinguished road
hii HPE,
I can surely do that, but was hoping for some other way without re-installing
nikag123 is offline   Reply With Quote

Old   February 13, 2021, 14:28
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by nikag123 View Post
hii HPE,
I can surely do that, but was hoping for some other way without re-installing
It would certainly help with understanding if you define what you mean by "installing openfoam". Are you unpacking a precompiled binary pack somewhere, downloaded source and compiled in the wrong directory etc? In general it does not pose a problem to compile OpenFOAM in a particular directory and then move everything into another directory (this is after all what we do when creating binary packs for ubuntu, centos/redhat opensuse, or with spack or easybuild) so there must be something that I am missing.
olesen is offline   Reply With Quote

Old   February 14, 2021, 02:34
Default
  #5
New Member
 
Chattisgarh
Join Date: Oct 2020
Posts: 5
Rep Power: 5
nikag123 is on a distinguished road
Thank You Olesen
What I meant was I could not perform commands like blockmesh when I am logged in as normal user. Of Course, when I am logged in as root user, I easliy run the blockmesh command for a file in any directory.

This was because, as I understood, I do not have the permission to access the /root folder (root user's home directory) when I am logged in as a normal user

With sudo, I was able to give the new user access to commands like "ls -" but not access the /root folder.

So I now figured that it may be vulnerable to give the new user access to the /root folder in order to accomplish my problem.

I should rather install the OpenFOAM folder (which is currently in the /root directory) in the my new user directory.

If the above is true, now my question is how to install openfoam such that I can run the case files when I am logged in as new user?
nikag123 is offline   Reply With Quote

Old   February 21, 2021, 03:00
Default
  #6
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Still not sure if this is indeed an issue with running blockMesh, or if it is because you are trying create files in a location that doesn't belong to that particular user.
In general, you will want to change the ownership of the OpenFOAM installation. Use the chown command. Next ensure that the OpenFOAM files are usable by all users. For that the 'chmod -R a+rX' command is what you want. It is important to notice that it is a large 'X', which on adjusts the execution permission if the file is already executeable. This probably is your issue in the first place. Usually the root user will have a strict umask that prevents non-group members from having permissions.
olesen is offline   Reply With Quote

Old   December 4, 2021, 09:24
Default Moving my old foam-extend-3.1 installation
  #7
Senior Member
 
Jon Elvar Wallevik
Join Date: Nov 2010
Location: Reykjavik, ICELAND
Posts: 103
Rep Power: 19
JonW will become famous soon enough
Just now I had to move my old foam-extend-3.1 installation.
What I did was open my etc/baschrc and replace $HOME with the home directory of the new place.

Here is what I did for this case
NOTE username is explicit, . . . do not replace it with $HOME

/users/home/username is the new place

cd /users/home/username/foam/foam-extend-3.1/etc
gedit bashrc
---------------------------------------------------------
# foamInstall=$HOME/$WM_PROJECT
foamInstall=/users/home/username/$WM_PROJECT

# foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$USER"
foamOldDirs="$FOAM_INST_DIR /users/home/username/$WM_PROJECT/$USER"

# export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
export WM_PROJECT_USER_DIR=/users/home/username/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
---------------------------

….and in my .bashrc for the new location
alias foam31_ihpc='source /users/home/username/foam/foam-extend-3.1/etc/bashrc && PS1="\[\e[0;35m\][E.3.1.ihpc]\[\e[0m\]\[\e[0;31m\][\W]\[\e[0m\]: " '

I have been testing this now (by doing some mpi runs), and all seems to work perfectly. Note, this will be different for other installs like of-v2012, but the approach would be the same.

hope this helps
cheers
JE.
JonW is offline   Reply With Quote

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i fix installation error of ansys 19.0 on ubuntu 18.04 rid_taki ANSYS 15 June 7, 2021 06:32
User Code to change optical properties at certain temperature RageofaMonkey STAR-CCM+ 0 June 21, 2018 11:46
[foam-extend.org] A smooth installation of foam-3.0-extend on OpenSUSE 13.1 64-bits cookcaptain OpenFOAM Installation 7 May 26, 2015 11:22
Is it safe to change owner of src to root? chrisb2244 OpenFOAM Programming & Development 2 February 20, 2014 06:59
Installation hints OF141 on openSUSE103 markc OpenFOAM Installation 1 February 15, 2008 06:58


All times are GMT -4. The time now is 01:50.