Advertisement
lumiere1

LEMP 04.07.2024

Jul 4th, 2024
1,398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.78 KB | None | 0 0
  1. # Устанавливаем MySQL 8.1
  2. su -
  3. apt update -y
  4. apt install -y gnupg debconf
  5.  
  6. wget https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
  7. apt-key add RPM-GPG-KEY-mysql-2023
  8.  
  9. wget https://dev.mysql.com/get/mysql-apt-config_0.8.18-1_all.deb
  10. echo "mysql-apt-config mysql-apt-config/select-server select mysql-8.0" | debconf-set-selections
  11. dpkg-reconfigure -f noninteractive mysql-apt-config
  12. dpkg -i mysql-apt-config_0.8.18-1_all.deb
  13.  
  14. echo "mysql-community-server mysql-community-server/root-pass password 123321" | debconf-set-selections
  15. echo "mysql-community-server mysql-community-server/re-root-pass password 123321" | debconf-set-selections
  16. echo "mysql-community-server mysql-community-server/data-dir select '/data/'" | debconf-set-selections
  17.  
  18. mkdir /data
  19.  
  20. export DEBIAN_FRONTEND=noninteractive
  21.  
  22. apt update -y
  23.  
  24. apt install -y mysql-server
  25.  
  26.  
  27. # PHP 8.1 (Владелец sury.org заблокировал репозиторий с российских ip, используй VPN, либо локальное корпоративное зеркало)
  28.  
  29. apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
  30.  
  31. echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list
  32.  
  33. wget https://packages.sury.org/php/apt.gpg -O /usr/share/keyrings/deb.sury.org-php.gpg
  34. echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php-sury.list
  35.  
  36. chmod 644 /etc/apt/trusted.gpg.d/apt.gpg
  37.  
  38. apt update -y
  39.  
  40. apt install -y php8.1
  41. apt install php8.0-mysql
  42.  
  43.  
  44. # Nginx (собираем из исходников с желаемыми модулями и создаем файл для системы инициализации)
  45.  
  46. apt update && \
  47.     apt install -y --no-install-recommends \
  48.         build-essential \
  49.         libpcre3 \
  50.         libpcre3-dev \
  51.         zlib1g-dev \
  52.         libssl-dev \
  53.         unzip \
  54.         wget \
  55.         curl \
  56.         ca-certificates \
  57.         apache2-utils \
  58.         && rm -rf /var/lib/apt/lists/*
  59.  
  60. mkdir -p /var/lib/nginx/body /var/lib/nginx/proxy /var/lib/nginx/fastcgi
  61.  
  62. wget http://nginx.org/download/nginx-1.18.0.tar.gz && \
  63.     tar -xvf nginx-1.18.0.tar.gz && \
  64.     cd nginx-1.18.0 && \
  65.     ./configure \
  66.         --sbin-path=/usr/sbin \
  67.         --conf-path=/etc/nginx/nginx.conf \
  68.         --error-log-path=/var/log/nginx/error.log \
  69.         --pid-path=/var/run/nginx.pid \
  70.         --lock-path=/var/lock/nginx.lock \
  71.         --http-log-path=/var/log/nginx/access.log \
  72.         --http-client-body-temp-path=/var/lib/nginx/body \
  73.         --http-proxy-temp-path=/var/lib/nginx/proxy \
  74.         --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
  75.         --with-http_stub_status_module \
  76.         --with-http_v2_module \
  77.         --with-http_dav_module && \
  78.     make && \
  79.     make install
  80.  
  81. echo "[Unit]
  82. Description=The NGINX HTTP and reverse proxy server
  83. After=syslog.target network.target remote-fs.target nss-lookup.target
  84.  
  85. [Service]
  86. Type=forking
  87. PIDFile=/var/run/nginx.pid
  88. ExecStartPre=/usr/sbin/nginx -t
  89. ExecStart=/usr/sbin/nginx
  90. ExecReload=/bin/kill -s HUP $MAINPID
  91. ExecStop=/bin/kill -s QUIT $MAINPID
  92. PrivateTmp=true
  93.  
  94. [Install]
  95. WantedBy=multi-user.target" > /etc/systemd/system/nginx.service
  96.  
  97. systemctl daemon-reload
  98. systemctl enable nginx.service
  99. systemctl start nginx.service
  100.  
  101.  
  102. # nodejs 18 + 16
  103.  
  104. useradd -m newuser -s /bin/bash && echo 'newuser:123321' | chpasswd
  105. su - newuser
  106. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
  107.  
  108. export NVM_DIR="$HOME/.nvm"
  109. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
  110. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
  111. source ~/.bashrc
  112. nvm install 16
  113. nvm install 18
  114. nvm use 18
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement