Possible to create stackscripts from A to Z with instruction from howtoforge.com - perfect server?

159 views Asked by At

I tried to deploy below stackscripts following the tutorial from howtoforge.com https://www.howtoforge.com/tutorial/perfect-server-debian-8-4-jessie-apache-bind-dovecot-ispconfig-3-1/

From linode manager I see below message.

Disk Create From StackScript 
Entered: 22 minutes 18 seconds ago - Took: 12 seconds   Setting password for root... done  

However, I think it doesn't work. I tried to type php -v and it shows command not found. Below is the stackscript I wrote. Is there any log available when we executing the stackscript?

#!/bin/bash
# <UDF name="DB_PASSWORD" Label="MySQL root Password" />
# <UDF name="MAILMAN_EMAIL" Label="Mailman Email" default="" example="Mailman Email" />
# <UDF name="MAILMAN_PWD" Label="Mailmen Password" default="" example="Mailmen Password" />
# <UDF name="db_user_password" Label="MySQL User's Password" default="" example="User's password" />

source <ssinclude StackScriptID="1">

apt-get install ssh openssh-server
apt-get install nano

# 4 Configure the Hostname


# 5 Update Your Debian Installation 
echo "" >> /etc/apt/sources.list
echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list
echo "" >> /etc/apt/sources.list
echo "deb http://security.debian.org/ jessie/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://security.debian.org/ jessie/updates main contrib non-free" >> /etc/apt/sources.list

apt-get update
apt-get upgrade

# 6 Change The Default Shell
dpkg-reconfigure dash

# 7 Synchronize the System Clock
apt-get install ntp ntpdate

# 8 Install Postfix, Dovecot, MySQL, phpMyAdmin, rkhunter, binutils
postfix_install_loopback_only
mysql_install "$DB_PASSWORD" && mysql_tune 40

apt-get install postfix-mysql postfix-doc 
apt-get install openssl getmail4 rkhunter binutils dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-lmtpd sudo

# mysql_secure_installation - https://gist.github.com/Mins/4602864
aptitude -y install expect

SECURE_MYSQL=$(expect -c "
set timeout 10
spawn mysql_secure_installation

expect \"Change the root password?\"
send \"n\r\"
expect \"Remove anonymous users?\"
send \"y\r\"
expect \"Disallow root login remotely?\"
send \"y\r\"
expect \"Remove test database and access to it?\"
send \"y\r\"
expect \"Reload privilege tables now?\"
send \"y\r\"
expect eof
")
echo "$SECURE_MYSQL"
# aptitude -y purge expect

# 9 Install Amavisd-new, SpamAssassin, and Clamav
apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl postgrey

service spamassassin stop
systemctl disable spamassassin

# 10 Install Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear, and mcrypt
INSTALL_APACHE_WITH_PHP=$(expect -c "
set timeout 3600
spawn apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libruby libapache2-mod-python php5-curl php5-intl php5-memcache php5-memcached php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl memcached libapache2-mod-passenger

expect \"Web server to reconfigure automatically:\"
send \"apache2\r\"
expect \"Configure database for phpmyadmin with dbconfig-common?\"
send \"yes\r\"
expect \"Enter the password of the administrative user?\"
send \"$DB_PASSWORD\r\"
expect \"Enter the phpmyadmin application password?\"
send \"\r\"
expect eof
")

echo "$INSTALL_APACHE_WITH_PHP"

a2enmod suexec rewrite ssl actions include dav_fs dav auth_digest cgi headers

echo "<IfModule mod_headers.c>" >> /etc/apache2/conf-available/httpoxy.conf
echo "    RequestHeader unset Proxy early" >> /etc/apache2/conf-available/httpoxy.conf
echo "</IfModule>" >> /etc/apache2/conf-available/httpoxy.conf

a2enconf httpoxy
service apache2 restart

# 10.1 Install HHVM (HipHop Virtual Machine)
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
echo deb http://dl.hhvm.com/debian jessie main | tee /etc/apt/sources.list.d/hhvm.list
apt-get update
apt-get install hhvm

# 11 Install Let's Encrypt
mkdir /opt/certbot
cd /opt/certbot
wget https://dl.eff.org/certbot-auto
chmod a+x ./certbot-auto

# ./certbot-auto

# 12.1 PHP-FPM (recommended)
apt-get install libapache2-mod-fastcgi php5-fpm
a2enmod actions fastcgi alias
service apache2 restart

# 12.2 Install XCache
apt-get install php5-xcache
service apache2 restart

# 13 Install Mailman
INSTALL_MAILMAN=$(expect -c "
set timeout 3600
spawn apt-get install mailman

expect \"Languages to support:\"
send \"en\r\"
expect \"Missing site list\"
send \"ok\r\"
expect eof
")

echo "$INSTALL_MAILMAN"

CONF_MAILMAN=$(expect -c "
set timeout 3600
spawn newlist mailman

expect \"Enter the email of the person running the list:\"
send \"$MAILMAN_EMAIL\r\"
expect \"Initial mailman password:\"
send \"$MAILMAN_PWD\r\"
expect \"Hit enter to notify mailman owner...\"
send \"\r\"
expect eof
")

echo "$CONF_MAILMAN"

echo "" >> /etc/aliases
echo "## mailman mailing list" >> /etc/aliases
echo "mailman:              \"|/var/lib/mailman/mail/mailman post mailman\"" >> /etc/aliases
echo "mailman-admin:        \"|/var/lib/mailman/mail/mailman admin mailman\"" >> /etc/aliases
echo "mailman-bounces:      \"|/var/lib/mailman/mail/mailman bounces mailman\"" >> /etc/aliases
echo "mailman-confirm:      \"|/var/lib/mailman/mail/mailman confirm mailman\"" >> /etc/aliases
echo "mailman-join:         \"|/var/lib/mailman/mail/mailman join mailman\"" >> /etc/aliases
echo "mailman-leave:        \"|/var/lib/mailman/mail/mailman leave mailman\"" >> /etc/aliases
echo "mailman-owner:        \"|/var/lib/mailman/mail/mailman owner mailman\"" >> /etc/aliases
echo "mailman-request:      \"|/var/lib/mailman/mail/mailman request mailman\"" >> /etc/aliases
echo "mailman-subscribe:    \"|/var/lib/mailman/mail/mailman subscribe mailman\"" >> /etc/aliases
echo "mailman-unsubscribe:  \"|/var/lib/mailman/mail/mailman unsubscribe mailman\"" >> /etc/aliases

newaliases
service postfix restart
ln -s /etc/mailman/apache.conf /etc/apache2/conf-enabled/mailman.conf
service apache2 restart
service mailman start

# 14 Install PureFTPd and Quota
apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool

# nano /etc/default/pure-ftpd-common
# STANDALONE_OR_INETD=standalone
# VIRTUALCHROOT=true
# echo 1 > /etc/pure-ftpd/conf/TLS

mkdir -p /etc/ssl/private/
# openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
# chmod 600 /etc/ssl/private/pure-ftpd.pem
# service pure-ftpd-mysql restart
# nano /etc/fstab
# mount -o remount /
# quotacheck -avugm
# quotaon -avug

# 15 Install BIND DNS Server
apt-get install bind9 dnsutils
apt-get install haveged

# 16 Install Vlogger, Webalizer, and AWStats
apt-get install vlogger webalizer awstats geoip-database libclass-dbi-mysql-perl
# nano /etc/cron.d/awstats

apt-get install build-essential autoconf automake libtool flex bison debhelper binutils

cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.19.tar.gz
tar xvfz jailkit-2.19.tar.gz
cd jailkit-2.19
./debian/rules binary

cd ..
dpkg -i jailkit_2.19-1_*.deb
rm -rf jailkit-2.19*

apt-get install fail2ban
# nano /etc/fail2ban/jail.local
0

There are 0 answers