- Joined
- Jul 10, 2019
- Messages
- 304
Hey guys! Let me look into this script and I'll get back to you all with an updated version!
If you copy/paste the script from the site? If you did, it adds leading white spaces to every line which shouldn’t be there, corrupting the EOF declaration. Does it do the same when downloaded?not work script domain_create_post.sh
from
https://www.knownhost.com/wiki/control-panels/directadmin/custom-package-item-creation-example
write:
/usr/local/directadmin/customscripts.error.log
/usr/local/directadmin/scripts/custom/domain_create_post.sh: line 71: warning: here-document at line 57 delimited by end-of-file (wanted `EOF')
/usr/local/directadmin/scripts/custom/domain_create_post.sh: line 72: syntax error: unexpected end of file
chmod chown 700 diradmin
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
installWP=type=checkbox&string=Install WordPress&desc=Installs WordPress for domains automatically upon creation&checked=yes
chown diradmin. /usr/local/directadmin/scripts/custom/domain_create_post.sh
chmod 700 /usr/local/directadmin/scripts/custom/domain_create_post.sh
#!/bin/bash -x
exec 2>/usr/local/directadmin/customscripts.error.log
if [[ $installWP != 'ON' ]]; then
exit 0;
else
#set up DB variables
dbpass=$(openssl rand -hex 6) > /dev/null
ext=$(openssl rand -hex 2) > /dev/null
dbuser="wp${ext}" # do not include the username_ for dataskq here as DA adds this
wpconfigdbuser="${username}_wp${ext}"
wpadminpass=$(openssl rand -hex 6) > /dev/null
# install wp
if [ -f /home/$username/domains/$domain/public_html/index.php ]; then
echo "WARNING: There appears to be an index file already located in this directory, which indicates that an installation is already present! Empty the directory before running the script again."
exit;
else
#Disable DAs index.html file
if [ -f /home/$username/domains/$domain/public_html/index.html ]; then
mv /home/$username/domains/$domain/public_html/index.html{,.bak}
fi
#Create DB
/usr/bin/mysqladmin --defaults-extra-file=/usr/local/directadmin/conf/my.cnf create ${wpconfigdbuser};
echo "CREATE USER ${wpconfigdbuser} IDENTIFIED BY '${dbpass}';" | mysql --defaults-extra-file=/usr/local/directadmin/conf/my.cnf;
echo "GRANT ALL PRIVILEGES ON ${wpconfigdbuser}.* TO '${wpconfigdbuser}'@'localhost' IDENTIFIED BY '${dbpass}';" | mysql --defaults-extra-file=/usr/local/directadmin/conf/my.cnf;
#Download WP
cd /home/$username/domains/$domain/public_html/
su -s /bin/bash -c "/usr/local/bin/wp core download" $username
#set database details in the config file
su -s /bin/bash -c "/usr/local/bin/wp config create --dbname=$wpconfigdbuser --dbuser=$wpconfigdbuser --dbpass=$dbpass --dbhost=localhost" $username
if [[ $ssl == 'ON' ]]; then
su -s /bin/bash -c "/usr/local/bin/wp core install --url=https://$domain/ --admin_user=admin --admin_password=$wpadminpass --title= --admin_email=admin@$domain " $username
su -s /bin/bash -c "/usr/local/bin/wp rewrite structure '/%postname%/'" $username
printf "\n\nADMIN LOGIN CREDENTIALS:\nURL:https://$domain/wp-admin/\nUSERNAME:admin\nPASSWORD:$wpadminpass\n\n"
if [[ ! -h /home/$username/domains/$domain/private_html ]]; then
echo "Making a symlink for https..."
cd /home/$username/domains/$domain/
rm -rf private_html
su -c "ln -s public_html private_html" $username
fi
else
su -s /bin/bash -c "/usr/local/bin/wp core install --url=http://$domain/ --admin_user=admin --admin_password=$wpadminpass --title= --admin_email=admin@$domain " $username
su -s /bin/bash -c "/usr/local/bin/wp rewrite structure '/%postname%/'" $username
printf "\n\nADMIN LOGIN CREDENTIALS:\nURL:http://$domain/wp-admin/\nUSERNAME:admin\nPASSWORD:$wpadminpass\n\n"
fi
#Create .htaccess
cat << EOF > /home/$username/domains/$domain/public_html/.htaccess
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
EOF
chown $username. /home/$username/domains/$domain/public_html/.htaccess
fi
fi
exit 0;
Where is Custombuild?Here is a guide showing how to setup WordPress for domains and subdomains based on the original script from Knownhost. There is also a script to install WordPress when modifying a domain as well.
How to Automatically Install WordPress with DirectAdmin
WordPress is the most popular Content Management Systems (CMS), and is estimated to have been installed on over 27 million websites worldwide. Part of the reason for WordPress’s success is down to it…www.vpsbasics.com
The old link is dead, use this one to download: https://adema-it.nl/downloads/wordpress-installer.zipHi 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 )
LAST THING: feel free to use it for whatever you want
HeyHi 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 )
LAST THING: feel free to use it for whatever you want
The script is giving errors with the latest WP version, you should not use it. Try softaculous for directadmin it's only 12 dollar for a vps license. You can also check the other method listed in this thread. If you still want the script let me know i can reupload it for you.Hey
Links are down.
Do you have any ss?