-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-ws-primary-image.sh.bak
53 lines (51 loc) · 3.2 KB
/
create-ws-primary-image.sh.bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# Copy the original ubuntu image to primary image
cp ubuntu-image.img ubuntu-primary.img
# Customize the image
virt-customize -a ubuntu-primary.img \
--root-password password:juniper123 \
--hostname ws-primary \
--firstboot ws-primary-fb.sh \
--run-command 'echo "ubuntu ALL=(root) NOPASSWD:ALL" | tee -a /etc/sudoers.d/ubuntu' \
--chmod 0440:/etc/sudoers.d/ubuntu \
--install apache2,tasksel,mysql-server,mysql-client,arp-scan,sshpass,expect \
--install php7.0,libapache2-mod-php7.0,php7.0-mysql \
--install php7.0-curl,php7.0-json,php7.0-cgi \
--install php-curl,php-gd,php-mbstring,php-mcrypt,php-xml,php-xmlrpc \
--run-command 'sed -i "s/PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config' \
--run-command 'sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config' \
--run-command 'sed -i "/^KeepAlive/c\KeepAlive On" /etc/apache2/apache2.conf' \
--run-command 'sed -i "/^MaxKeepAliveRequests/c\MaxKeepAliveRequests 50" /etc/apache2/apache2.conf' \
--run-command 'sed -i "/^KeepAliveTimeout/c\KeepAliveTimeout 5" /etc/apache2/apache2.conf' \
--run-command 'a2dismod mpm_event' \
--run-command 'a2enmod mpm_prefork' \
--run-command 'systemctl restart apache2' \
--run-command 'cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf' \
--copy-in jnpr-example.com.conf:/etc/apache2/sites-available/ \
--run-command 'sudo mkdir -p /var/www/html/jnpr-example.com/logs' \
--run-command 'sudo mkdir -p /var/www/html/jnpr-example.com/public_html' \
--run-command 'a2ensite jnpr-example.com.conf' \
--run-command 'a2dissite 000-default.conf' \
--run-command 'systemctl reload apache2' \
--run-command 'sed -i "/^error_log/c\error_log = /var/log/php/error.log" /etc/php/7.0/apache2/php.ini' \
--run-command 'sed -i "/^error_reporting/c\error_reporting = E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_ERROR | E_CORE_ERROR" /etc/php/7.0/apache2/php.ini' \
--run-command 'sed -i "/^max_input_time/c\max_input_time = 30" /etc/php/7.0/apache2/php.ini' \
--run-command 'sed -i "/^;error_log/c\error_log = /var/log/php/error.log" /etc/php/7.0/apache2/php.ini' \
--run-command 'sed -i "/^;error_reporting/c\error_reporting = E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_ERROR | E_CORE_ERROR" /etc/php/7.0/apache2/php.ini' \
--run-command 'sed -i "/^;max_input_time/c\max_input_time = 30" /etc/php/7.0/apache2/php.ini' \
--run-command 'mkdir /var/log/php' \
--run-command 'chown www-data /var/log/php' \
--run-command 'systemctl restart apache2' \
--run-command 'mkdir /var/www/html/jnpr-example.com/src/' \
--run-command 'chown -R www-data:www-data /var/www/html/jnpr-example.com/' \
--run-command 'wget http://wordpress.org/latest.tar.gz' \
--run-command 'tar -xvf latest.tar.gz' \
--run-command 'mv wordpress/* /var/www/html/jnpr-example.com/public_html/' \
--run-command 'chown -R www-data:www-data /var/www/html/jnpr-example.com/public_html' \
--install lsyncd \
--run-command 'sudo mkdir /etc/lsyncd' \
--copy-in lsyncd.conf.lua:/etc/lsyncd/ \
--run-command 'curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar' \
--run-command 'php wp-cli.phar --info' \
--run-command 'chmod +x wp-cli.phar' \
--run-command 'sudo mv wp-cli.phar /usr/local/bin/wp'