Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Check root privileges
- if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root"
- exit 1
- fi
- #
- apt-get update && sudo apt-get -y upgrade
- apt-get install software-properties-common vim git
- #
- # Install MariaDB 10.0
- apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
- add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main'
- apt-get update
- apt-get install -y mariadb-server
- # secure your installation
- mysql_secure_installation
- # Install PowerDNS
- apt-get install pdns-server pdns-backend-mysql
- # Select Yes to create and configure database for pdns-backend-mysql with dbconfig-common.
- # Provide the password of the database’s administrative user (MySQL root user password)
- # and choose a password for the pdns-backend-mysql user.
- # The database information will be written to the pdns.local.gmysql.conf file.
- #
- # Clone Poweradmin
- git clone https://github.com/poweradmin/poweradmin.git /var/www/html/pdns.myDomain.com/
- # Set the correct permissions
- chown -R www-data: /var/www/html/pdns.myDomain.com/
- # Install and configure PHP and required PHP modules
- add-apt-repository -y ppa:ondrej/php5-5.6
- sudo apt-get update
- sudo apt-get -y install php5-fpm php5-cli php5-gd php5-mysqlnd php5-mcrypt
- # Edit the PHP-FPM pool configuration file
- mv /etc/php5/fpm/pool.d/www.conf{,.bak}
- #
- cat >/etc/php5/fpm/pool.d/www.conf <<-EOF
- [www]
- user = www-data
- group = www-data
- listen = /var/run/php5-fpm.sock
- listen.owner = www-data
- listen.group = www-data
- listen.mode = 0666
- pm = ondemand
- pm.max_children = 5
- pm.process_idle_timeout = 10s;
- pm.max_requests = 200
- chdir = /
- EOF
- #
- # Restart PHP-FPM
- service php5-fpm restart
- #
- # Install and configure Nginx
- #
- # Ubuntu 14.04 comes with nginx version 1.4, to install the latest stable version of Nginx version 1.8
- add-apt-repository -y ppa:nginx/stable
- apt-get update
- apt-get -y install nginx
- # Create a new Nginx server block with the following content
- #
- cat >/etc/nginx/sites-available/pdns.myDomain.com <<-EOF
- server {
- server_name pdns.myDomain.com;
- listen 80;
- root /var/www/html/pdns.myDomain.com;
- access_log /var/log/nginx/pdns-access.log;
- error_log /var/log/nginx/pdns-error.log;
- index index.php;
- location / {
- try_files $uri $uri/ /index.php?$query_string;
- }
- location ~ \.php$ {
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_index index.php;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_intercept_errors off;
- fastcgi_buffer_size 16k;
- fastcgi_buffers 4 16k;
- }
- location ~ /\.ht {
- deny all;
- }
- }
- EOF
- #
- # Activate the server block by creating a symbolic link
- ln -s /etc/nginx/sites-available/pdns.myDomain.com /etc/nginx/sites-enabled/pdns.myDomain.com
- # Test the Nginx configuration and restart nginx
- nginx -t
- service nginx restart
- #
- clear
- echo "Install Poweradmin"
- echo " "
- echo "To start the installation wizard, open your browser and type http://pdns.myDomain.com/installer"
- echo " Step 1: Select the desired language,"
- echo " Step 2: Click on the “Go to step 3” button"
- echo " Step 3: Fill the database information fields:"
- echo " – Username: pdns"
- echo " – Password: yourPdnsUserPassword"
- echo " – Database type: MySQL"
- echo " – Hostname: localhost"
- echo " – DB Port: 3306"
- echo " – Database: pdns"
- echo " – Poweradmin administrator password: setYourPoweradminAdminPassword"
- echo " Step 4: Set the username and password for Poweradmin, Hostmaster and Primary and Secondary nameservers."
- echo " Step 5: Before going to next step, perform the mariadb command shown on the screen..."
- #
- mysql -uroot -p<password> -e"GRANT SELECT, INSERT, UPDATE, DELETE ON pdns.* TO 'yourUser'@'localhost' IDENTIFIED BY 'yourUserPassword'"
- # or
- mysql -uroot -p << EOF
- GRANT SELECT, INSERT, UPDATE, DELETE
- ON example.*
- TO 'yourUser'@'localhost'
- IDENTIFIED BY 'yourUserPassword';
- EOF
- #
- echo " Step 6: If you have set the correct permissions the installer will"
- echo " Step 7: create a Poweradmin php configuration file."
- # After the installation wizard completes,
- # remove the install directory using the following command:
- rm -rf install/
- # You have successfully installed PowerDNS and Poweradmin
- # You can now login to the Poweradmin interface using
- # admin as username and setYourPoweradminAdminPassword as password.
Advertisement
Add Comment
Please, Sign In to add comment