1
0

Обновить install.sh

This commit is contained in:
kosenka 2025-04-04 11:00:05 +03:00
parent c41a80b95e
commit 648b2f36cd

View File

@ -1,121 +1,85 @@
install "minimized server" #!/usr/bin/sh
*** after install: *** ColorRed='\033[0;31m'
# sudo -s ColorGreen='\033[0;32m'
ColorOff='\033[0m'
# apt-get -y update && apt-get -y upgrade # Function to display the confirmation prompt
function confirm() {
while true; do
read -p "$1? (y/n) " yn
case $yn in
[Yy]* ) return 0;;
[Nn]* ) return 1;;
esac
done
}
*** on proxmox *** clear
# apt-get install -y qemu-guest-agent && systemctl start qemu-guest-agent && systemctl enable qemu-guest-agent
# check if running as root in a bash script
# https://stackoverflow.com/a/28776100
if [ `id -u` -ne 0 ]
then echo Please run this script as root or using sudo!
exit
fi
echo -e "${ColorGreen}Введите IP-адрес сервера (пример: 192.168.1.1/24):${ColorOff}"
read server_ip
echo -e "${ColorGreen}Введите IP-адреса для nameserver's (пример: 192.168.1.1, 192.168.1.2):${ColorOff}"
read nameserver_ip
echo -e "${ColorGreen}Введите IP-адреса для gateway сервера (пример: 192.168.0.1):${ColorOff}"
read gatewayserver_ip
apt-get -y update && apt-get -y upgrade
### https://dondub.com/2021/07/udalenie-cloud-init-iz-ubuntu-server-21-04/ ### https://dondub.com/2021/07/udalenie-cloud-init-iz-ubuntu-server-21-04/
# sed -i -e 's/datasource_list:/# datasource_list:/g' /etc/cloud/cloud.cfg.d/90_dpkg.cfg sed -i -e 's/datasource_list:/# datasource_list:/g' /etc/cloud/cloud.cfg.d/90_dpkg.cfg
# echo "datasource_list: [ None ]" >> /etc/cloud/cloud.cfg.d/90_dpkg.cfg echo "datasource_list: [ None ]" >> /etc/cloud/cloud.cfg.d/90_dpkg.cfg
# dpkg-reconfigure cloud-init dpkg-reconfigure cloud-init
# apt purge -y cloud-init && rm -rf /etc/cloud/ && rm -rf /var/lib/cloud/ apt purge -y cloud-init && rm -rf /etc/cloud/ && rm -rf /var/lib/cloud/
# apt-get -y remove unattended-upgrades && systemctl stop apt-daily.timer && systemctl disable apt-daily.timer && systemctl stop apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer && systemctl disable apt-daily.service && systemctl daemon-reload apt-get -y remove unattended-upgrades && systemctl stop apt-daily.timer && systemctl disable apt-daily.timer && systemctl stop apt-daily-upgrade.timer && systemctl disable apt-daily-upgrade.timer && systemctl disable apt-daily.service && systemctl daemon-reload
# sed -i -e 's/APT::Periodic::Update-Package-Lists "1";/APT::Periodic::Update-Package-Lists "0";/g' /etc/apt/apt.conf.d/20auto-upgrades sed -i -e 's/APT::Periodic::Update-Package-Lists "1";/APT::Periodic::Update-Package-Lists "0";/g' /etc/apt/apt.conf.d/20auto-upgrades
# sed -i -e 's/APT::Periodic::Unattended-Upgrade "1";/APT::Periodic::Unattended-Upgrade "0";/g' /etc/apt/apt.conf.d/20auto-upgrades sed -i -e 's/APT::Periodic::Unattended-Upgrade "1";/APT::Periodic::Unattended-Upgrade "0";/g' /etc/apt/apt.conf.d/20auto-upgrades
# snap remove --purge snapd && apt-get -y remove snapd && apt-get -y autoremove snap remove --purge snapd && apt-get -y remove snapd && apt-get -y autoremove
# apt install -y netplan.io isc-dhcp-client isc-dhcp-common mc net-tools iputils-ping inetutils-traceroute htop ca-certificates apt-utils aptitude locales git squashfs-tools tzdata fdisk gdisk mc net-tools iputils-ping inetutils-traceroute htop ca-certificates apt-utils aptitude locales git iproute2 apt install -y netplan.io isc-dhcp-client isc-dhcp-common mc net-tools iputils-ping inetutils-traceroute htop ca-certificates apt-utils aptitude locales git squashfs-tools tzdata fdisk gdisk mc net-tools iputils-ping inetutils-traceroute htop ca-certificates apt-utils aptitude locales git iproute2
### ? systemctl disable snapd.service && systemctl disable snapd.socket && systemctl disable snapd.seeded.service && systemctl mask snapd.service && rm -rf /var/cache/snapd/ && apt autoremove --purge snapd -y && rm -rf ~/snap ### ? systemctl disable snapd.service && systemctl disable snapd.socket && systemctl disable snapd.seeded.service && systemctl mask snapd.service && rm -rf /var/cache/snapd/ && apt autoremove --purge snapd -y && rm -rf ~/snap
# timedatectl set-timezone Europe/Moscow timedatectl set-timezone Europe/Moscow
# apt -y install ntp apt -y install ntp
# aptitude install console-cyrillic aptitude install console-cyrillic
# dpkg-reconfigure locales dpkg-reconfigure locales
select [392] ru_RU.UTF-8 UTF-8 # select [392] ru_RU.UTF-8 UTF-8
# shutdown -r now rm /etc/netplan/50-cloud-init.yaml
# rm /etc/netplan/50-cloud-init.yaml touch /etc/netplan/10-netplan-config.yaml
echo "# This is the network config written by 'subiquity'
# touch /etc/netplan/10-netplan-config.yaml
# echo "# This is the network config written by 'subiquity'
network: network:
version: 2 version: 2
ethernets: ethernets:
[NET_DEVICE_ID]: [NET_DEVICE_ID]:
dhcp4: no dhcp4: no
addresses: addresses:
- [IP]/24 - $server_ip
nameservers: nameservers:
addresses: [IP_NAMESERVER] addresses: [$nameserver_ip]
routes: routes:
- to: default - to: default
via: [IP_GATEWAY] via: $gatewayserver_ip
" >> /etc/netplan/10-netplan-config.yaml " >> /etc/netplan/10-netplan-config.yaml
# chmod 600 /etc/netplan/10-netplan-config.yaml chmod 600 /etc/netplan/10-netplan-config.yaml
# netplan try netplan try
# netplan apply netplan apply
# systemctl restart systemd-networkd systemctl restart systemd-networkd
# shutdown -r now
# sudo su -
*** HESTIACP 1.9.3 ***
# gpg --no-default-keyring --keyring /usr/share/keyrings/hestia-keyring.gpg --keyserver hkp://185.125.188.26 --recv-keys A189E93654F0B0E5
# wget https://raw.githubusercontent.com/hestiacp/hestiacp/release/install/hst-install.sh
# bash hst-install.sh --lang 'ru' --hostname '[HOSTNAME]' --username '[USERNAME]' --email '[EMAIL]' --password '[PASSWORD]' --multiphp '8.2' --named no --postgresql yes --dovecot no --clamav no --spamassassin no
# reboot
*** login as 'root'
# usermod -aG sudo [USERNAME]
# apt-get install -y memcached php-memcached php8.2-memcached
# v-change-user-package [USERNAME] default
# v-change-user-shell [USERNAME] bash
# v-add-database [USERNAME] rfclass_pg rfclass_pg [DB_PASSWORD] pgsql localhost
# v-add-database [USERNAME] eis_pg eis_pg [DB_PASSWORD] pgsql localhost
# v-add-domain [USERNAME] [DOMAIN]
# v-delete-mail-domain [USERNAME] [DOMAIN]
*** relogin as '[USERNAME]'
# cd /home/[USERNAME]/web/[DOMAIN]/public_html/
# rm /home/[USERNAME]/web/[DOMAIN]/public_html/index.html
# rm /home/[USERNAME]/web/[DOMAIN]/public_html/robots.txt
# git clone https://git.kosenka.ru/kosenka/[DOMAIN].git .
# php composer.phar install
# sudo su -
# v-change-web-domain-docroot admin [DOMAIN] [DOMAIN] /web
# exit
*** install odbc-driver
** Add the signature to trust the Microsoft repo
** For Ubuntu versions < 24.04
# curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
** For Ubuntu versions >= 24.04
** curl https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
** Add repo to apt sources
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
** Install the driver
# sudo apt-get update
# sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
** optional: for bcp and sqlcmd
# sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
# echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
# source ~/.bashrc
** optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
# apt-get install -y php8.2-odbc
*** copy archive ***
*** restore database: admin_rfclass_pg
# grep -Eo "PASSWORD='[a-zA-Z0-9]+'" /usr/local/hestia/conf/pgsql.conf | awk -F "PASSWORD=" '{print $2}' | awk -F "'" '{print $2}'
# exit
# cd /home/admin/web/[SITE]/public_html
# php composer.phar install
if confirm "Перезагружаемся "; then
shutdown -r now
fi