Magento - Shell Install Script

I am trying to update the following script - by changing the values as per my server details:

bin/magento setup:install \
--base-url=http://123.123.123.123 \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password="[email protected]" \
--admin-firstname=bob \
--admin-lastname=smith \
[email protected] \
--admin-user=bob \
[email protected] \
--language=en_US \
--currency=GBP \
--timezone=Europe/London \
--use-rewrites=1

But when I am trying to paste the updated file (Which I edited separately in Brackets - the code is not getting copied as desired.

Can anyone please suggest - what is the best way to edit the shell commands as per my needs?

Kindly let me know. Thank you.

Are you saying that you’re writing a script that contains this command, but doesn’t format correctly? Or are you saying that you’re unable to paste this into the CLI? I’m not sure I understand.

For the record, I’m pretty sure you can run this as a single line by removing the “\” and line breaks. So, the aforementioned command would look like this:

bin/magento setup:install --base-url=http://123.123.123.123 --db-host=localhost --db-name=magento --db-user=magento --db-password="[email protected]" --admin-firstname=bob --admin-lastname=smith [email protected] --admin-user=bob [email protected] --language=en_US --currency=GBP --timezone=Europe/London --use-rewrites=1

Not very clear to a human, but possibly less problematic if you’re trying to incorporate it into a script.

Thanks for your message, Craig.

When I am trying to enter the install command on to my shell - the syntax is getting disturbed and my command is not getting pasted as desired.

To avoid this - I am thinking to save the install commands with multiple lines into a shell script - which I would like to execute in order to get the installation processed.

When I try using the way - you shared - I am running into an issue as noted below:

SQLSTATE[HY000] [1045] Access denied for user ‘myuser’@‘localhost’ (using password: YES)

In InstallCommand.php line 274: Parameter validation failed

Can I just install Magento using

bin/magento setup:install

and later on pass on the values for parameters - login, DB and so on?

My install command script - is noted below:

bin/magento setup:install --base-url=http://xx.xxx.xxx.xx --db-host=localhost --db-name=mydb --db-user=myuser --db-password=“mypassword” --admin-firstname=myuser --admin-lastname=myuserpw [email protected] --admin-user=meabc --admin-password=myabcpw --language=en_US --currency=CAD --timezone=America/Toronto --use-rewrites=1

Kindly suggest.

I finally managed to create a separate shell script - with the code I wanted to run on the command prompt.

vi filename.sh

chmod +x filename.sh

Once that is completed - I ran the shell script using the following command on the command prompt.
./filename.sh

Thank you, Craig!

1 Like

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