brew install - neither as root nor as user, so how

Created on 1 Feb 2018  路  9Comments  路  Source: Linuxbrew/brew

Hi,

Sorry for this lame question, but

I would like ot install brew on debian 9.

  • If I run the comand you suggest in the repo brew-install as root, it returns that I shouldn't do it as root.

Ok

  • If I run it as an other ssh user, is says that i'll need a password to install it in /home/linuxbrew/.linuxbrew, but if I press enter, linuxbrew is installed in a diferent directory /var/www/some/IPSConfig/folders/.linuxbrew
  • if I run su, before install, I logically end up as root, and
  • if I run sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" ; I'm asked for a password but neither my ssh user password nor my root password works.

So how ? As you suggest to install brew in /home/linuxbrew/.linuxbrew

Thank's in advance

question

Most helpful comment

Forgot to add that we should explicitly say which commands we're going to execute as root.

All 9 comments

Use su to create a user named linuxbrew, and give the linuxbrew user password-less access to sudo. See for example:
https://github.com/Linuxbrew/docker/blob/ae70717907c35770fc7b5b78050f63c37a049548/debian/Dockerfile#L22-L23
Even easier if you like is to use su to create an empty directory named /home/linuxbrew/.linuxbrew owned by the current non-root user.

Thank you very much !

may I suggest an upadate to the install page.

I
Remove your second sentence from where it is and

II
Slightly edit the "Install Linuxbrew" section" as such :

Linuxbrew can be installed in your home directory and does not require root access.
The installation script installs Linuxbrew to /home/linuxbrew/.linuxbrew if possible and in your home directory at ~/.linuxbrew otherwise.
You may thus create a new user named linuxbrew with password-less access to sudo, but It' not mandatory. If so use sudo to run the install script.

useradd -m -s /bin/bash linuxbrew \
&& echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers

Paste at ...

Follow the Next steps instructions to add Linuxbrew to your PATH and to your bash shell profile script, either
on Debian/Ubuntu

test -d ~/.linuxbrew && PATH="$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin:$PATH"
echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.profile

On CentOS/Fedora/RedHat

test -r ~/.bash_profile && echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.bash_profile
echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.profile

You're done, check the dependencies and Try installing a package.


Any how thank's again.

Good suggestion. I have my hands full this week. Feel free to ping me again next week if it slips my mind.

I agree, installing is very confusing...

The intention is that the one-line installation at http://linuxbrew.sh/#install-linuxbrew works. Please report a bug if it doesn't work for you.

I was already logged in as root, and then i ran the one-line installation. It only installed ruby (i think), but i _thought_ that the installation that run was the complete Linuxbrew install. After the installation i got the warning "don't run this as root". It created /home/linuxbrew/ with some stuff inside, but not the linuxbrew binaries.

Perhaps it would be useful to display the "don't install as root" before anything happens at all, so you don't end up with a partly installed folder?

Anyways, in the end the one-line installation worked, after i removed the half-installed-folder.

Perhaps it would be useful to display the "don't install as root" before anything happens at all, so you don't end up with a partly installed folder?

That's a good suggestion. An alternative would be that when the install script is run as root it could create a user named linuxbrew if one doesn't already exist. This feature would be particularly useful for installing Linuxbrew in a Docker container. Alternatively, it could print the commands to the console to create the linxubrew user. I think the latter is probably the least surprise. Or it could prompt the user to hit Enter to create a linuxbrew user or Control-C to cancel installation. I like this last idea the best.
@iMichka @maxim-belkin Which is your preference?

I think it is totally reasonable to expect system admins to be installing Linuxbrew for their users. So, I think it should ask admin if he really wants to create linuxbrew user (y/n) and proceed based on response. I'm not a fan of just pressing Enter but it will work too.

Forgot to add that we should explicitly say which commands we're going to execute as root.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwhite007 picture jwhite007  路  5Comments

dlukes picture dlukes  路  5Comments

mercer picture mercer  路  4Comments

nnmrts picture nnmrts  路  5Comments

rojinsafavi picture rojinsafavi  路  3Comments