''' How to Install OpenVPN Access Server on Ubuntu 14.04.4 '''

from random_mysql_pass import password_generator
password = password_generator()

ubuntu_version = input("Ubuntu version [10, 12, 13, 14]: ")
architecture   = input("Architecture [32, 64]: ")
ovpn_version   = input("OpenVPN Access Server Version [2.0.25]: ")
ip_address     = input("IP Address of Cloud Server: ")

if len(ovpn_version) == 0: ovpn_version = '2.0.25' 

arch_suffix = {'32':'.i386.deb', '64':'.amd_64.deb'}
pfix_url = 'http://swupdate.openvpn.org/as/'
filename = 'openvpn-as-' + ovpn_version + '-Ubuntu' + ubuntu_version + arch_suffix[architecture]
full_url = pfix_url + filename

output = """

# Login as root
sudo su

# Fetch package
sudo wget {full_url}

# Install
dpkg -i "{filename}"

# Change Pass of 'openvpn' User
sudo passwd openvpn
'''Install Wordpress on Ubuntu 12.04'''

from random_mysql_pass import password_generator

username = input("current_username: "******"domain: ")
db_name = input("db_name: ")
wp_user = input("wp_user: "******"/var/www/" + domain + "/public_html/blog/"

output = """

wget http://wordpress.org/latest.tar.gz

tar -xzvf latest.tar.gz


# start of mysql promt
mysql -u root -p

CREATE DATABASE {db_name};

CREATE USER {wp_user}@localhost;

SET PASSWORD FOR {wp_user}@localhost= PASSWORD("{wp_user_password}");

GRANT ALL PRIVILEGES ON {db_name}.* TO {wp_user}@localhost IDENTIFIED BY '{wp_user_password}';
''' How to Install Wordpress with nginx on Ubuntu 12.04 '''

from random_mysql_pass import password_generator

username = input("current_username: "******"domain: ")
db_name = input("db_name: ")
wp_user = input("wp_user: "******"""
wget http://wordpress.org/latest.tar.gz

tar -xzvf latest.tar.gz

# start of mysql prompt
mysql -u root -p

CREATE DATABASE {db_name};

CREATE USER {wp_user}@localhost;

SET PASSWORD FOR {wp_user}@localhost= PASSWORD("{wp_user_password}");

GRANT ALL PRIVILEGES ON {db_name}.* TO {wp_user}@localhost IDENTIFIED BY '{wp_user_password}';

FLUSH PRIVILEGES;

exit
# end of mysql prompt
'''Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu'''


from random_mysql_pass import password_generator

mysql_root_pass = password_generator()

output = """
# install Apache
sudo apt-get update
sudo apt-get install apache2

# verify the installation
ifconfig eth0 | grep inet | awk '{ print $2 }'

# install MySQL
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

# activate MySQL
sudo mysql_install_db

# run setup script (enter root pass; [N]; [Y]*4)
sudo /usr/bin/mysql_secure_installation


# install PHP ([Y]*2)
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

#add php to the directory index, to serve the relevant php index files
sudo nano /etc/apache2/mods-enabled/dir.conf
''' Initial Server Setup with Ubuntu 12.04 '''

from random_mysql_pass import password_generator

ipaddr = input("ipaddr: ")
username = input("username: "******"ssh_port: ")
root_pass = password_generator()
user_pass = password_generator()

output = """
# root login
ssh root@{ipaddr}

# change password
passwd

adduser {username}

visudo

# User privilege specification
# root    ALL=(ALL:ALL) ALL
# Under there, add the following line, granting all the permissions to your new user:
{username}    ALL=(ALL:ALL) ALL


# change port number (1025 - 65536) and disable root login
nano /etc/ssh/sshd_config

Port {ssh_port}