If you use our LAMP installer script and want to add a new domain afterwards, we’ve created a simple script to ease up the process. This script creates a new user, adds the domain settings for Apache, adds a new MySQL Database and user, restarts necessary services.

Simply get our script from here or on your server via wget.

git clone https://github.com/VeriTeknik/plugged.sh.git

Run the script (as root) to learn about the usage.

sh hostingadd.sh

Usage: hostingadd.sh -u username -p password -d domain -ip IP -dbu dbuser -dbn dbname -dbp dbpass

 -u username : Set the LOGIN name (FTP user)
 -p password : Set the Password
 -d domain : Set the Domain
 -ip ip : Set the IP address for the domain
 -dbu dbuser : Set the MySQL User
 -dbn dbname : Set the MySQL Database Name
 -dbp dbpass : Set the MySQL User Password

The parameters are explained above. The script will try to create the MySQL databases as root, so it will need access to MySQL. In order to manage it, you’ll have to create a .my.cnf file under your /root  path. The /root/.my.cnf file should be like this :

[client]
user=root
pass=yourMySQLrootPassword

Don’t worry about writing your password in clear text. This file is restricted by root access anyway, so if someone can read this file, your server is already compromised.

You can access via FTP by using the username and password provided while running the script. You can also check if the database is successfully added via phpmyadmin (which is installed by plugged.sh)

There isn’t an uninstall script yet, but I’ll write one asap.

Leave a Reply

Your email address will not be published. Required fields are marked *