mysql as option in lemp install

This commit is contained in:
Bachir Soussi Chiadmi 2021-05-18 10:52:02 +02:00
parent a79e147c3a
commit 591f67e6bc

View File

@ -29,25 +29,6 @@ fi
sleep 2
echo -e '\033[35m
__ ___ __
/ |/ /_ ___________ _/ /
/ /|_/ / / / / ___/ __ `/ /
/ / / / /_/ (__ ) /_/ / /
/_/ /_/\__, /____/\__, /_/
/____/ /_/
\033[0m'
echo -e "\033[35;1minstalling Mysql \033[0m"
sleep 3
apt-get --yes install mariadb-server
mysql_secure_installation
cp "$_assets"/mysql/innodb-file-per-table.cnf /etc/mysql/conf.d/
systemctl enable mariadb.service
systemctl restart mariadb.service
echo -e "\033[92;1mmysql installed\033[Om"
echo -e '\033[35m
____ __ ______
/ __ \/ / / / __ \
@ -64,11 +45,11 @@ sleep 3
# Failed to enable unit: Unit file php7.0-fpm.service does not exist.
# Failed to start php7.0-fpm.service: Unit php7.0-fpm.service not found.
apt-get --yes install php7.3-{fpm,mysql,opcache,curl,mbstring,zip,xml,gd,imagick,apcu} php-memcached
apt-get --yes install php7.3-fpm php7.3-mysql php7.3-opcache php7.3-curl php7.3-mbstring php7.3-zip php7.3-xml php7.3-gd php-memcached php7.3-imagick php7.3-apcu
# php7.3-mcrypt ??
mv /etc/php/7.3/fpm/php.ini /etc/php/7.3/fpm/php.ini.back
cp "$_assets"/php7.3-fpm.ini /etc/php/7.3/fpm/php.ini
cp "$_assets"/php-fpm.ini /etc/php/7.3/fpm/php.ini
echo "Configuring PHP"
@ -86,19 +67,6 @@ systemctl start php7.3-fpm
#
# systemctl start memcached
echo -e "\033[35;1mInstalling PHP 7.4 \033[0m"
apt-get -y install lsb-release apt-transport-https ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
apt-get update
apt-get -y install php7.4 php7.4-{fpm,mysql,opcache,curl,mbstring,zip,xml,gd,imagick,apcu}
mv /etc/php/7.4/fpm/php.ini /etc/php/7.4/fpm/php.ini.back
cp "$_assets"/php7.4-fpm.ini /etc/php/7.4/fpm/php.ini
systemctl enable php7.4-fpm
systemctl start php7.4-fpm
echo -e "\033[92;1mphp installed\033[Om"
echo -e '\033[35m
@ -119,44 +87,75 @@ systemctl enable nginx
systemctl restart nginx
echo -e "\033[92;1mNginx installed\033[Om"
echo -e '\033[35m
__ __ ___ ___ __ _
____ / /_ ____ / |/ /_ __/ | ____/ /___ ___ (_)___
/ __ \/ __ \/ __ \/ /|_/ / / / / /| |/ __ / __ `__ \/ / __ \
/ /_/ / / / / /_/ / / / / /_/ / ___ / /_/ / / / / / / / / / /
/ .___/_/ /_/ .___/_/ /_/\__, /_/ |_\__,_/_/ /_/ /_/_/_/ /_/
/_/ /_/ /____/
\033[0m'
echo -e "\033[35;1mInstalling phpMyAdmin \033[0m"
##### Building dependency tree
##### Reading state information... Done
##### Package phpmyadmin is not available, but is referred to by another package.
##### This may mean that the package is missing, has been obsoleted, or
##### is only available from another source
#####
##### E: Package 'phpmyadmin' has no installation candidate
##### cp: missing destination file operand after '/root/debian-web-server/assets/nginx-phpmyadmin.conf'
##### Try 'cp --help' for more information.
# TODO no pma package available :(
# apt-get --yes install phpmyadmin
# ln -s /usr/share/phpmyadmin /var/www/html/
# cp "$_assets"/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
# ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
# echo -e "\033[92;1mphpMyAdmin installed\033[Om"
# echo -e "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om"
# install from source
apt-get --yes install php-{mbstring,zip,gd,xml,pear,gettext,cgi}
cd /var/www/html/
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip
unzip phpMyAdmin-latest-all-languages.zip
mv phpMyAdmin-*-all-languages pma
rm phpMyAdmin-latest-all-languages.zip
# cp "$_assets"/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
# ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
echo -e "\033[92;1mphpMyAdmin installed\033[Om"
echo -e "\033[92;1mYou can access it at yourip/pma\033[Om"
while [ "$installmysql" != "yes" ] && [ "$installmysql" != "no" ]
do
echo -n "install mysql? [yes|no] "
read installmysql
# installmysql=${installmysql:-y}
done
if [ "$installmysql" = "yes" ]; then
echo -e '\033[35m
__ ___ __
/ |/ /_ ___________ _/ /
/ /|_/ / / / / ___/ __ `/ /
/ / / / /_/ (__ ) /_/ / /
/_/ /_/\__, /____/\__, /_/
/____/ /_/
\033[0m'
echo -e "\033[35;1minstalling Mysql \033[0m"
sleep 3
apt-get --yes install mariadb-server
mysql_secure_installation
cp "$_assets"/mysql/innodb-file-per-table.cnf /etc/mysql/conf.d/
systemctl enable mariadb.service
systemctl restart mariadb.service
echo -e "\033[92;1mmysql installed\033[Om"
echo -e '\033[35m
__ __ ___ ___ __ _
____ / /_ ____ / |/ /_ __/ | ____/ /___ ___ (_)___
/ __ \/ __ \/ __ \/ /|_/ / / / / /| |/ __ / __ `__ \/ / __ \
/ /_/ / / / / /_/ / / / / /_/ / ___ / /_/ / / / / / / / / / /
/ .___/_/ /_/ .___/_/ /_/\__, /_/ |_\__,_/_/ /_/ /_/_/_/ /_/
/_/ /_/ /____/
\033[0m'
echo -e "\033[35;1mInstalling phpMyAdmin \033[0m"
##### Building dependency tree
##### Reading state information... Done
##### Package phpmyadmin is not available, but is referred to by another package.
##### This may mean that the package is missing, has been obsoleted, or
##### is only available from another source
#####
##### E: Package 'phpmyadmin' has no installation candidate
##### cp: missing destination file operand after '/root/debian-web-server/assets/nginx-phpmyadmin.conf'
##### Try 'cp --help' for more information.
# TODO no pma package available :(
# apt-get --yes install phpmyadmin
# ln -s /usr/share/phpmyadmin /var/www/html/
# cp "$_assets"/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
# ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
# echo -e "\033[92;1mphpMyAdmin installed\033[Om"
# echo -e "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om"
# install from source
apt-get --yes install php-{mbstring,zip,gd,xml,pear,gettext,cgi}
cd /var/www/html/
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip
unzip phpMyAdmin-latest-all-languages.zip
mv phpMyAdmin-*-all-languages pma
rm phpMyAdmin-latest-all-languages.zip
# cp "$_assets"/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
# ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
echo -e "\033[92;1mphpMyAdmin installed\033[Om"
echo -e "\033[92;1mYou can access it at yourip/pma\033[Om"
fi