An alternative installer for Ubuntu 20.04 LTS

I did run with sudo, I am restoring the VM and will try again

Agree with @MartinHBramwell don’t run under sudo, do something like sudo -i to get a full root shell, and then run.

If you run into problems, I’d suggest running each line manually(from line 1), from a clean fresh ubuntu install. See where the problems come up, and then work on those, individually. That’s how I wrote the script.

@MartinHBramwell

I have one question below:

*** USAGE ***
Steps:
1. Create a new user for working with ERPNext, give it ‘sudoer’ privileges
# Create user
sudo adduser erpdev;
# Add to sudoers
sudo usermod -aG sudo erpdev;

from this point should I

su erpdev

and follow up below installation process under this user?

    # Create directory and keys file
    mkdir ${HOME}/.ssh;
    chmod u+x,go-rwx ${HOME}/.ssh;

    # Place pub keys of workstations
    cat > ${HOME}/.ssh/authorized_keys

    <ctrl>-d
 2. Put these files in that user's home directory, and run the command
       # Make scripts executable
       chmod +x ErpNextQikInstall*;
 3. The scripts use 'sudo -A' so you'll need to set up 'SUDO_ASKPASS' (see below)
 4. Execute script #0 to test if 'sudo -A' is working
       ./ErpNextQikInstall_0.sh;
 5. Execute script #1 to set up all of ERPNext's dependencies and install the 'bench' installer
       ./ErpNextQikInstall_1.sh;
 6. Log out and log back in again
 7. Execute script #2 to set up your 'frappe-bench' directory
       ./ErpNextQikInstall_2.sh;
 8. Reboot the virtual machine
 9. Execute script #3 to install the full 'frappe' application
       ./ErpNextQikInstall_3.sh;
10. Open up a second command line connection to your VM.
11. Execute script #4 to create a new site install into it the 'ERPNext' application
12. In the machine running the browser you'll use to work with ERPNext, be sure you have can reference it by name
       Edit your file '/etc/hosts' to include the IP address and name of the machine where you installed everything.
       192.168.122.99  mysite # ** EXAMPLE ***

I think I am still struggling on SUDO_ASKPASS set up. After I do the setup of SUDO_ASKPASS I have to reboot the machine to work properly. However at some point I loose the ability to connect SSH. Putty wont be able to logging anymore under SSH. Which becomes annoying I might be doing something wrong and as well does not create frappe-bench folder @ $Home

As it says in step #2 :

  1. Put these files in that user’s home directory, and run the command
    # Make scripts executable
    chmod +x ErpNextQikInstall*;

By that I meant my five files from the “gist”. I’ll change the README to say something like:

  1. Log out and log in to the machine as the new user, pull and unzip the “gist” files and make them executable.
    # Download from github using the [ Download ZIP ] button
    # Extract the five ErpNextQikInstall*.sh files
    # Make make them executable
    chmod +x ErpNextQikInstall*.sh;

SUDO_ASKPASS is a simple arrangement. You really shouldn’t have to reboot.
It is just an environment variable containing the name of a tiny script that returns your sudo password. The switch “-A” tells sudo it can obtain the password by executing the script named in the SUDO_ASKPASS variable. Some tests to see if it is working:

cat .bashrc | grep SUDO_ASKPASS;

echo ${SUDO_ASKPASS};

ls -la ${HOME}/.ssh/.supwd.sh;

cat ${HOME}/.ssh/.supwd.sh;

sh ${HOME}/.ssh/.supwd.sh;

sh ${SUDO_ASKPASS};

You ought to see:

erpdev@fossa:~$ cat .bashrc | grep SUDO_ASKPASS
export SUDO_ASKPASS=${HOME}/.ssh/.supwd.sh;
erpdev@fossa:~$ 
erpdev@fossa:~$ echo ${SUDO_ASKPASS}
/home/erpdev/.ssh/.supwd.sh
erpdev@fossa:~$ 
erpdev@fossa:~$ ls -la .ssh/.supwd.sh 
-rwx------ 1 erpdev erpdev 37 May 18 10:22 .ssh/.supwd.sh
erpdev@fossa:~$ 
erpdev@fossa:~$ cat .ssh/.supwd.sh 
#!/usr/bin/env bash
echo 'rui_s3cr3t';
erpdev@fossa:~$ 
erpdev@fossa:~$ sh /home/erpdev/.ssh/.supwd.sh
rui_s3cr3t
erpdev@fossa:~$ 
erpdev@fossa:~$ sh ${SUDO_ASKPASS}
rui_s3cr3t
erpdev@fossa:~$ 

I think there is a problem echo ${SUDO_ASKPASS}; is not returning anything

erpdev@distin:~$ cat .bashrc | grep SUDO_ASKPASS;
export SUDO_ASKPASS=${HOME}/.ssh/.supwd.sh;
erpdev@distin:~$
erpdev@distin:~$ echo ${SUDO_ASKPASS};

erpdev@distin:~$

To get the values that .bashrc exports you must either:

  • log out and log back in again OR
  • run the command :
source .bashrc

Oh wait!

Is it possible you skipped the step Append this text to your ${HOME}/.bashrc

perfect worked

source .bashrc

I did
the commands are returning the password now

No issues found with ./ErpNextQikInstall_0.sh;

I think good to add to your readme

source .bashrc

Well, actually it is built into the script at line 145

I was running the script and was not working. maybe the line 145 did not do anything… i am not sure but worked after I input your command directly

Right!

I see the problem. I have added lines 7 & 8 to script zero.

export USERCTX=".bashrc";
source ${HOME}/${USERCTX};

I ran below with no issues than Exit to main use and than SU erpdev

./ErpNextQikInstall_1.sh

Now with ./ErpNextQikInstall_2.sh does not recognize bench command

erpdev@distin:~$ ./ErpNextQikInstall_2.sh;
Press to quit, any other to proceed…^[[C
Calibrating date & time…
18 May 11:29:47 ntpdate[15700]: adjust time server 91.121.216.238 offset -0.005365 sec
./ErpNextQikInstall_2.sh: line 29: bench: command not found
./ErpNextQikInstall_2.sh: line 30: bench: command not found
Firewall is active and enabled on system startup

Done

Please reboot your server and proceed to …

  • script ‘ErpNextQikInstall_3.sh’ in one terminal session

… then when the former is ready …

  • script ‘ErpNextQikInstall_4.sh’ in a 2nd terminal session

Did you do what it says at the end of script #1?

echo -e "
 *** Exit session and log back in to continue with script #2 ***
================================================================
";

ok . i did exit but than SU erpdev . I understand was not enough I did close the SSH session and log back is processing now
thanks

$ ./ErpNextQikInstall_2.sh;
is done
I have reboot the system and messed up with putty
image

There’s something wrong with your SSH connection, but that is really beyond the scope of the scripts.

SUDO_ASKPASS is not causing it.

Are you putting your SSH public key into the authorized_keys file as specified here

        # Place pub keys of workstations
        cat > ${HOME}/.ssh/authorized_keys

        <ctrl>-d

Does that file look like this…

erpdev@fossa:~$ 
erpdev@fossa:~$ cat ${HOME}/.ssh/authorized_keys
AAAAB3NzaC1yc2EAAAADAQABAAABgQCdT2DjarMOjc9AmYdp9Ty8Hkb6xXFK7pChJUHAcqYILx+yM/MmdAl+78JSkNRqESmkxLCkoAR81teu8y8RxWTAzgOUoAJ5Opz6sAec63Y04RJOkc0HF3A21J22V7RBQ4JqJTTBbjfS23G+zr3iJvx6tC2/KVIL8Be6ohm7rnE/NpfW8/WDCk8RtJn7q4XDjNfqbd5GkpYQ9YwrHo31mIP3JrqGN5uqTcBUEjfjXvIS4rFCLWvDP4ZQN1myFRvUN3cf1ofCHFOTMglrpQWdOYzOQxnUFyNb2PNWryglvOzA+qXKEqhnazIGU3YWolCwCMOvEqLNKJzI2Wyre6vF8ArYJaUYql9igfb7o3rdQMfhRV8ZNpxra148ubwpCy0WPedmvGU9QEHc6Njyz8iG5ahI+2AQ/ZkXjS0pTrbW2y2RzJAat1YamIgjlgUVa9EIPvb1cCxrSj9aFwCGHBST0GPh84h9rFgky44JGLKurh4LNs1J45V6439wcKWZ36BJC+0= you@erpclient
erpdev@fossa:~$ 

perfect ok managed the ssh
video below might be useful who knows

1 Like

Hello @MartinHBramwell

I saw you have added to ./ErpNextQikInstall_0.sh below. however even after I run the new updated file, I still need to do call the command source .bashrc

export USERCTX=“.bashrc”;
source ${HOME}/${USERCTX};

the file ./ErpNextQikInstall_3.sh gets stuck on below does not advance.

Rebuilding data_import_tools.min.js

I have tried to run ./ErpNextQikInstall_4.sh in separate terminal and a serie of new command start to appear on terminal with ./ErpNextQikInstall_3.sh , I have feeling not doing correctly.

many thanks

one more think to add
when i run the script ./ErpNextQikInstall_1.sh
it appears it gets stuck as well so I just Ctrl C and continue the process as it is just the final checks? am I right?

many thanks