Skip to content

Instantly share code, notes, and snippets.

@riipandi
Created June 10, 2012 12:54
Show Gist options
  • Save riipandi/2905411 to your computer and use it in GitHub Desktop.
Save riipandi/2905411 to your computer and use it in GitHub Desktop.
Install i-MSCP Debian Squeeze
#!/bin/bash
#
# http://wiki.i-mscp.net/doku.php?id=start:howto:replace_squirrelmail_with_roundcube
#
#
echo 'siliwangi.kits.or.id' > /etc/hostname
hostname -F /etc/hostname
hostname && hostname -f
rm /etc/apt/sources.list
cat > /etc/apt/sources.list <<EOF
deb http://debian.indika.net.id/debian/ stable main non-free
deb http://backports.debian.org/debian-backports squeeze-backports main non-free
deb http://debian.indika.net.id/debian-security squeeze/updates main non-free contrib
EOF
aptitude update && aptitude safe-upgrade
apt-get install --no-install-recommends -q -y lsb-release nano openssl \
ssh openssh-server curl bzip2 ssl-cert sqlite mysql-server mysql-client \
mysql-common apache2 apache2.2-common apache2.2-common libc6 libgcc1 \
liblua5.1-0 libpcre3 libxml2 dialog libxml-simple-perl php5 php5-common \
php5-cli libapache2-mod-php5 php5-dev php5-mysql php5-curl php5-gd \
php-pear php5-imap php5-mcrypt php5-ming php5-ps php5-pspell php5-recode \
php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php-apc memcached mcrypt
sed -i -e 's/bind-address/#bind-address/g' /etc/mysql/my.cnf
mysql_secure_installation
sed -i 's/ServerTokens Full/ServerTokens Prod/' /etc/apache2/conf.d/security
sed -i 's/ServerTokens OS/ServerTokens Prod/' /etc/apache2/conf.d/security
sed -i 's/ServerSignature On/ServerSignature Off/' /etc/apache2/conf.d/security
sed -i 's/TraceEnable On/TraceEnable Off/' /etc/apache2/conf.d/security
sed -i 's/max_execution_time = 30/max_execution_time = 90/' /etc/php5/apache2/php.ini
sed -i 's/max_file_uploads = 20/max_file_uploads = 32/' /etc/php5/apache2/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 128M/' /etc/php5/apache2/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 96M/' /etc/php5/apache2/php.ini
rm /var/www/index.html && echo "<h1>Still Offline</h1>" > /var/www/index.html
echo "<?php phpinfo(); ?>" > /var/www/i.php
service apache2 reload
a2enmod rewrite unique_id
apache2ctl configtest
service apache2 restart
cat /var/log/apache2/error.log | grep ModSecurity
cd /usr/local/src
wget http://dl.dropbox.com/u/3643528/siliwangi/i-mscp-1.0.3.0-patched.tar.bz2
tar xjvf i-mscp-*.tar.bz2
cd /usr/local/src/i-mscp* && perl ./imscp-autoinstall
aptitude safe-upgrade && aptitude autoclean
# Replace Webmail Client with RoundCube
mv /var/www/imscp/gui/public/tools/webmail /var/www/imscp/gui/public/tools/webmail.old
cd /tmp && wget http://dl.dropbox.com/u/3643528/siliwangi/rcubemail.tar.gz
tar xzvf rcubemail.tar.gz
mv rcubemail /var/www/imscp/gui/public/tools/webmail
sed -i 1i"CREATE DATABASE IF NOT EXISTS rcubemail; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON rcubemail.* TO 'dbmailUser'@'localhost' IDENTIFIED BY 'dbmailPass'; FLUSH PRIVILEGES;USE rcubemail;" /var/www/imscp/gui/public/tools/webmail/SQL/mysql.initial.sql
mysql -u root -p < /var/www/imscp/gui/public/tools/webmail/SQL/mysql.initial.sql
mysql -u root -p rcubemail < /var/www/imscp/gui/public/tools/webmail/SQL/mysql.update.sql
chmod 777 /var/www/imscp/gui/public/tools/webmail/logs
chmod 777 /var/www/imscp/gui/public/tools/webmail/temp
cd /var/www/imscp/gui/public/tools/webmail/config/
rm -Rf /var/www/imscp/gui/public/tools/webmail/installer
rm -Rf /var/www/imscp/gui/public/tools/webmail/SQL
cd /var/www/imscp/gui/public/tools/webmail/config
cp main.inc.php.dist main.inc.php
cp db.inc.php.dist db.inc.php
sed -i 's/roundcube:pass@localhost\/roundcubemail/dbmailUser:dbmailPass@localhost\/rcubemail/' /var/www/imscp/gui/public/tools/webmail/config/db.inc.php
nano /var/www/imscp/gui/public/tools/webmail/config/main.inc.php
#----------------------------------------------------------------------------------------------
# ['product_name'] = 'Roundcube Webmail' -> ['product_name'] = 'Webmail Client'
# ['des_key'] = 'rcmail-!24ByteDESkey*Str' -> ['des_key'] = '0QDLy7EMRCxHUcZS-JS0ltPB'
# ['imap_auth_type'] = null -> ['imap_auth_type'] = LOGIN
# ['default_host'] = '' -> ['default_host'] = 'localhost'
# ['smtp_server'] = '' -> ['smtp_server'] = 'localhost'
# ['smtp_user'] = '' -> ['smtp_user'] = '%u'
# ['smtp_pass'] = '' -> ['smtp_pass'] = '%p'
# ['identities_level'] = 0 -> ['identities_level'] = 3
# ['quota_zero_as_unlimited'] = false -> ['quota_zero_as_unlimited'] = true
# ['create_default_folders'] = false -> ['create_default_folders'] = true
# ['imap_force_lsub'] = false -> ['imap_force_lsub'] = true
# ['message_sort_col'] = '' -> ['message_sort_col'] = 'date'
# ['enable_spellcheck'] = true -> ['enable_spellcheck'] = false
# ['logout_expunge'] = false -> ['logout_expunge'] = true
# ['skin'] = 'default' -> ['skin'] = MobileCube
# ['plugins'] = array() -> ['plugins'] = array('calendar')
#----------------------------------------------------------------------------------------------
# Custom Logo
#----------------------------------------------------------------------------------------------
# /var/www/imscp/gui/public/tools/webmail/skins/default/images/roundcube_logo.gif
# /var/www/imscp/gui/public/tools/webmail/skins/default/images/roundcube_logo.png
# /var/www/imscp/gui/public/tools/webmail/skins/default/images/roundcube_logo_print.gif
# /var/www/imscp/gui/public/tools/webmail/skins/default/images/favicon.ico
#----------------------------------------------------------------------------------------------
rm /var/www/i.php
aptitude safe-upgrade
service mysqld restart
service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment