Last active
June 26, 2023 04:15
-
-
Save eusonlito/1f1490efacc26bbf575a327e14730efc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "`whoami`" != 'root' ]; then | |
echo "" | |
echo "This script only can be executed by root" | |
echo "" | |
exit 1 | |
fi | |
cat <<EOF > /etc/environment | |
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | |
LC_ALL=en_US.UTF-8 | |
LANG=en_US.UTF-8 | |
EOF | |
echo 'export LC_ALL="en_US.UTF-8"' >> /root/.bashrc | |
if [ -d /var/lib/locales/supported.d ]; then | |
cat <<EOF > /var/lib/locales/supported.d/local | |
en_US.UTF-8 UTF-8 | |
es_ES.UTF-8 UTF-8 | |
EOF | |
fi | |
update-locale LANG=en_US.UTF-8 | |
dpkg-reconfigure locales | |
locale-gen | |
cd /etc/apt/ | |
sed -i -e 's/^deb-src/# deb-src/' \ | |
-e 's/#\s*deb /deb /' \ | |
-e 's/^deb cdrom.*//' \ | |
sources.list | |
cd /usr/local/bin/ | |
cat <<EOF > update | |
apt-get clean | |
apt-get autoclean | |
apt-get update && apt-get dist-upgrade --assume-yes --allow-unauthenticated | |
apt-get autoremove --assume-yes | |
EOF | |
chmod 700 update | |
update | |
mysqlpassword=`cat /dev/urandom | tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=' | fold -w 18 | head -n 1` | |
debconf-set-selections <<< "mysql-server mysql-server/root_password password $mysqlpassword" | |
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $mysqlpassword" | |
cat <<EOF > $HOME/.my.cnf | |
[mysql] | |
user=root | |
password=$mysqlpassword | |
EOF | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get install software-properties-common | |
add-apt-repository ppa:ondrej/nginx | |
add-apt-repository ppa:ondrej/php | |
wget https://dev.mysql.com/get/mysql-apt-config_0.8.16-1_all.deb -O /tmp/mysql-apt.deb | |
dpkg -i /tmp/mysql-apt.deb | |
apt install -y certbot curl debconf-utils git htop language-pack-en language-pack-es lynx mysql-server nginx ntpdate \ | |
php8.0 php8.0-cli php8.0-common php8.0-curl php8.0-dev php8.0-gd php8.0-imagick php8.0-mysql \ | |
php8.0-opcache php8.0-readline php8.0-tidy php8.0-xml php8.0-bcmath php8.0-bz2 \ | |
php8.0-fpm php8.0-intl php8.0-mbstring php8.0-soap php8.0-xsl php8.0-zip php-apcu php-imagick \ | |
php-memcached php-redis memcached redis-server rsync screen supervisor tree vim-scripts vim-tiny | |
cd /etc/php/8.0/fpm/ | |
timezone=`cat /etc/timezone | sed -e 's#/#\\\/#'` | |
sed -i -e 's/^expose_php =.*$/expose_php = Off/' \ | |
-e 's/^max_execution_time =.*$/max_execution_time = 180/' \ | |
-e 's/^max_input_time =.*$/max_input_time = 240/' \ | |
-e 's/^memory_limit =.*$/memory_limit = 512M/' \ | |
-e 's/^upload_max_filesize =.*$/upload_max_filesize = 200M/' \ | |
-e 's/^post_max_size =.*$/post_max_size = 2G/' \ | |
-e 's/^.*date\.timezone =.*$/date.timezone = "'$timezone'"/' \ | |
-e 's/^.*max_input_vars =.*$/max_input_vars = 10000/' \ | |
php.ini | |
cp php.ini /etc/php/8.0/cli/ | |
echo "" | |
echo "Finished" | |
echo "" | |
echo "MySQL password was stored in $HOME/.my.cnf" | |
echo "" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment