Skip to content

Instantly share code, notes, and snippets.

@jniltinho
Last active March 26, 2021 06:53
Show Gist options
  • Save jniltinho/7734f4879c4469b9a47f3d3eb4ff0bfb to your computer and use it in GitHub Desktop.
Save jniltinho/7734f4879c4469b9a47f3d3eb4ff0bfb to your computer and use it in GitHub Desktop.
#!/bin/bash
## Install ISPConfig 3.x on OpenSUSE 42.2 64Bits
## ISPConfig3 3.x + Apache2 + openSUSE Leap 42.2 64Bits
## VM HD 50GB, swap 2GB, / 19GB, /srv/www all | Filesystem EXT4
## Run as root
SUSE_VERSION=$(cat /etc/issue | awk '{ print $4 }' | head -n1)
zypper ar http://download.opensuse.org/repositories/home:/munix9/openSUSE_Leap_42.2/ hhvm
zypper ar http://download.opensuse.org/repositories/server:/http/openSUSE_Leap_42.2/ server_http
zypper ar http://download.opensuse.org/repositories/devel:/languages:/php/openSUSE_Leap_42.2/ php5_7
zypper --no-gpg-checks refresh
zypper in findutils readline findutils-locate wget make vim vim-data telnet cron iputils sudo perl-TimeDate quota tar
zypper in postfix
zypper in mariadb mariadb-client libmysqlclient-devel pwgen
zypper in python net-snmp git-core patch hhvm
zypper in apache2 apache2-mod_fcgid pure-ftpd webalizer perl-Date-Manip
zypper in php5-bcmath php5-bz2 php5-calendar php5-ctype php5-curl php5-dom php5-ftp php5-gd php5-pdo
zypper in php5-gettext php5-gmp php5-iconv php5-imap php5-ldap php5-mbstring php5-mcrypt php5-intl php5-mssql
zypper in php5-mysql php5-openssl php5-pcntl php5-posix php5-shmop php5-snmp php5-soap php5-sockets php5-zip php5-json
zypper in php5-sqlite php5-sysvsem php5-tokenizer php5-wddx php5-xmlrpc php5-xsl php5-zlib php5-exif php5-fileinfo
zypper in php5-fastcgi php5-pear php5-sysvmsg php5-sysvshm ImageMagick curl apache2-mod_php5 apache2-mod_fastcgi php5-phar
zypper in FastCGI php5-fpm
a2enmod socache_shmcb
a2enmod logio
a2enmod rewrite
a2enmod ssl
a2enmod actions
a2enmod fcgid
a2enmod dav
a2enmod dav_fs
a2enmod dav_lock
a2enmod suexec
a2enmod php5
chown root:www /usr/sbin/suexec2
chmod 4755 /usr/sbin/suexec2
a2enflag SSL
echo 'hhvm.mysql.socket = /var/run/mysql/mysql.sock' >> /etc/hhvm/php.ini
cp /etc/php5/fpm/php-fpm.conf.default /etc/php5/fpm/php-fpm.conf
cp /etc/php5/cli/php.ini /etc/php5/fpm/
sed -i 's|;error_log = log/php-fpm.log|error_log = /var/log/php-fpm.log|' /etc/php5/fpm/php-fpm.conf
sed -i 's|;cgi.fix_pathinfo=1|cgi.fix_pathinfo=0|' /etc/php5/fpm/php.ini
sed -i 's|sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES|sql_mode=NO_ENGINE_SUBSTITUTION|' /etc/my.cnf
chmod 1733 /var/lib/php5
a2enmod actions
a2enmod fastcgi
a2enmod alias
## PURE-FTPD
sed -i 's|# TLS|TLS|' /etc/pure-ftpd/pure-ftpd.conf
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
systemctl restart pure-ftpd.service
## Mudar ini do PHP
for i in /etc/php5/*/php.ini;do
sed -i 's|max_execution_time = 30|max_execution_time = 120|' $i
sed -i 's|upload_max_filesize = 2M|upload_max_filesize = 32M|' $i
sed -i 's|post_max_size = 8M|post_max_size = 32M|' $i
sed -i 's|error_reporting = E_ALL & ~E_DEPRECATED|error_reporting = E_ERROR|' $i
sed -i 's|short_open_tag = Off|short_open_tag = On|' $i
sed -i "s|date.timezone = 'UTC'|date.timezone = 'America\/Sao_Paulo'|" $i
done
systemctl enable php-fpm.service
chkconfig -a php-fpm
/etc/init.d/php-fpm start
systemctl enable apache2
systemctl start apache2
systemctl enable pure-ftpd
systemctl start pure-ftpd
systemctl enable mysql
systemctl start mysql
systemctl enable postfix
systemctl start postfix
### Configure MariaDB Password
mysql_secure_installation
systemctl restart mysql
systemctl restart apache2.service
## Add Quota in /srv/www in /etc/fstab:
## Backup /etc/fstab
cp /etc/fstab /etc/fstab.bkp_$$
sed -i "s|www[ ]*ext4[ ]*acl,user_xattr|www ext4 acl,user_xattr,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0|" /etc/fstab
mount -o remount /srv/www
quotacheck -avugm
quotaon -avug
## Download ISPConfig 3.1.X
cd /tmp
get_isp=https://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
wget -c ${get_isp}
tar xvfz $(basename ${get_isp})
cd ispconfig3_install/install && php -q install.php
## Depois reinicie o Servidor com o comando init 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment