Easy Wordpress installation for new customers.

litedesign

New member
Joined
Jun 28, 2020
Messages
2
Location
Drenthe, Netherlands
Hi there!

I wanted a simple Wordpress installer but besides softaculous or installatron there is no free version. I only want my users to install Wordpress so i made a little script.
The files are placed in the /domains/default/ folder of the reselling user so every new user has the script in his public_html at default. The only thing the user has to do is click the install link and enter server, username and password for directadmin. The script then unzips the wordpress zip-file, creates a wp-config.php and a database and password using a random string. After this the script removes itself and redirects to the final setup of Wordpress where you can enter your Site title, username and so on.

You can check the personalized page at https://dev.adema-it.nl/wordpress-installer/default/ i added a whois checker and a few shortlinks to our homepage.
The version in the download link looks like this: https://dev.adema-it.nl/wordpress-installer/wpinstall/
Download link: https://dev.adema-it.nl/wordpress-installer/wordpress-installer.zip

Why i created this:
1. No need to upload Wordpress to every new user.
2. Update once per server for all new users.
3. Add custom plugins and themes to Wordpress default installation.

IMPORTANT: You need to create a new Wordpress zip-file as you can't use the one from the Wordpress site. All the Wordpress files have to be directly in the wordpress.zip. In the official zip-file the files are located in a subfolder called "wordpress" which i didn't want, i wanted Wordpress to be installed in the root of the public_html.

ALSO IMPORTANT: I'm an amateur/hobby scripter. If you like it (or not) let me know. If you have any improvements or tips: let me know. ( i know it's not responsive,yet :p )

LAST THING: feel free to use it for whatever you want :)
 

SmallWeb

Verified User
Joined
Jul 1, 2019
Messages
90
Last edited:

sysdev

Verified User
Joined
Jul 16, 2007
Messages
237
I have tried this but it only completed 'Disable DAs index.html file' and 'Create DB'. Maybe I'm missing something but this is a really good concept.


As per the OP, thanks for providing your script. I will for sure be taking a look @litedesign
Did you install the wp core client, as this is not installed bij default?

$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
$ chmod +x wp-cli.phar
$ sudo mv wp-cli.phar /usr/local/bin/wp
 

litedesign

New member
Joined
Jun 28, 2020
Messages
2
Location
Drenthe, Netherlands

Tobagin

New member
Joined
Aug 13, 2020
Messages
9

sysdev

Verified User
Joined
Jul 16, 2007
Messages
237
I already mentioned this somewhere but got no replies on it. The problem is that the $installwp is only passed to the first directadmin script, creating the user. It is NOT passed to the second script to create the domain, where it is needed.

The alternative method you has indeed an error, that's why it installs for every package. The variable just does not exist there. You can work around this by using the user_create_post.sh script to 'touch' a file somewhere and check if it exists in this alternative method script instead of checking for the non existing variable.
 
Last edited:

Tobagin

New member
Joined
Aug 13, 2020
Messages
9
I already mentioned this somewhere but got no replies on it. The problem is that the $installwp is only passed to the first directadmin script, creating the user. It is NOT passed to the second script to create the domain, where it is needed.

The alternative method you has indeed an error, that's why it installs for every package. The variable just does not exist there. You can work around this by using the user_create_post.sh script to 'touch' a file somewhere and check if it exists in this alternative method script instead of checking for the non existing variable.
thanks for you reply.
 

Tobagin

New member
Joined
Aug 13, 2020
Messages
9
I already mentioned this somewhere but got no replies on it. The problem is that the $installwp is only passed to the first directadmin script, creating the user. It is NOT passed to the second script to create the domain, where it is needed.

The alternative method you has indeed an error, that's why it installs for every package. The variable just does not exist there. You can work around this by using the user_create_post.sh script to 'touch' a file somewhere and check if it exists in this alternative method script instead of checking for the non existing variable.

I've created a file under "/home/$username/.installwp"

how are you checking for the file existence on domain_create_post.sh if you don't mind me asking? I've tried a lot of different ways but was unable to achieve anything this way.

thanks in advance
 

Peter Laws

Verified User
Joined
Sep 13, 2008
Messages
2,028
Location
London UK
You mean to say, site owners are so lazy, they can't install a simple bit of software? Bit like saying I'm a sysadmin but know nothing about being a sysadmin.

If anyone wants to run a website, they need to know how to run one, not just click a button then do nothing for years.....

This is why I hate cPanel, it can babysit admins instead of teaching......
 

sysdev

Verified User
Joined
Jul 16, 2007
Messages
237
I've created a file under "/home/$username/.installwp"

how are you checking for the file existence on domain_create_post.sh if you don't mind me asking? I've tried a lot of different ways but was unable to achieve anything this way.

thanks in advance
 

Tobagin

New member
Joined
Aug 13, 2020
Messages
9
I acutally followed this too but i am unable to verify the existence of the file... weird... once again thank you for the reply
 

Tobagin

New member
Joined
Aug 13, 2020
Messages
9
I just actually tested on my server and for some reason the file created by the user_create_post.sh is only created on the user folder after domain_create_post.sh is executed...
 

Tobagin

New member
Joined
Aug 13, 2020
Messages
9
its seems that the server is executing domain_create_post.sh before user_create_post.sh
 

Attachments

  • Screenshot_20200816_191830.png
    Screenshot_20200816_191830.png
    26 KB · Views: 4

sysdev

Verified User
Joined
Jul 16, 2007
Messages
237
Yes, I see my typo. You should use the user_create_pre.sh with something like:

#!/bin/sh

if [ -n "$installwp" ]; then
/bin/touch /tmp/$username
fi

and the domain_create_post.sh with your check for the file:

#!/bin/sh

FILE=/tmp/$username
if test -f "$FILE"; then
// do the wp-cli install etc...
rm -rf /tmp/$username
fi
 

Tobagin

New member
Joined
Aug 13, 2020
Messages
9
Yes, I see my typo. You should use the user_create_pre.sh with something like:

#!/bin/sh

if [ -n "$installwp" ]; then
/bin/touch /tmp/$username
fi

and the domain_create_post.sh with your check for the file:

#!/bin/sh

FILE=/tmp/$username
if test -f "$FILE"; then
// do the wp-cli install etc...
rm -rf /tmp/$username
fi
thank you, will look into it! really appreciate the help!
 
Top